|
|
|
Philips Pronto Professional Forum - View Post
|
|
|
|
|
|
|
The following page was printed from RemoteCentral.com:
"Argument is not a function?"
| |
|
Topic: | "Argument is not a function?" This thread has 4 replies. Displaying all posts. |
|
Post 1 made on Thursday October 7, 2010 at 10:14 |
rap Long Time Member |
Joined: Posts: | September 2006 59 |
|
|
This code: if (initialization.indexOf("NKN") >= 1) scheduleAfter (100, CF.widget("GOTO", "SAVE_STUFF_HERE", "HOME").scheduleActions()); // set state vars
Throws this error:
ProntoScript error: Argument is not a function Offending activity script: Tag: 'HOME' Offending line #23: "scheduleAfter (100, CF.widget("GOTO", "SAVE_STUFF_HERE", "HOME").scheduleActions()); // set state vars"
The .scheduleActions() is a function, is it not? What's throwing the error?
THank you,
|
|
Post 2 made on Thursday October 7, 2010 at 12:11 |
I think that scheduleAfter expects a function. So try: function saveStuff(){ CF.widget("GOTO", "SAVE_STUFF_HERE", "HOME").scheduleActions(); } scheduleAfter (100,saveStuff);
Others on here will be able to confirm this for sure.
|
|
Post 3 made on Thursday October 7, 2010 at 12:46 |
Lyndel McGee RC Moderator |
Joined: Posts: | August 2001 12,999 |
|
|
That is correct. The error message indicates what is the problem. In fact, the Dev Guide does a great job of explaining the parameters and providing rather solid examples.
What Aslan did above was to declare a function that gets called when the timer expires. Note that he could also have done this inline as:
CF.activity().scheduleAfter(100,function(){CF.widget("GOTO", "SAVE_STUFF_HERE", "HOME").scheduleActions(); });
or
Declare a function with a parameter and pass the actual widget as 3rd parameter to scheduleAfter which in turn will get passed as w when your function is called.
CF.activity().scheduleAfter (100,function(w){w.scheduleActions();}, CF.widget("GOTO", "SAVE_STUFF_HERE", "HOME"));
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|
OP | Post 4 made on Thursday October 7, 2010 at 19:28 |
rap Long Time Member |
Joined: Posts: | September 2006 59 |
|
|
Thank you all. When I first put in the code I used executeActions(). No errors with this. For reasons discussed on RC and in the Developer's Guide I changed it to scheduleActions() and the error began.
While implementing the changes discussed here I started with:
// INITIALIZE any state tracking variables on boot & ensure all state vars are initialized function gotoInit() { CF.widget("GOTO", "SAVE_STUFF_HERE", "HOME").scheduleActions(); } if (System.getGlobal("tv_on") === null) gotoInit(); if (System.getGlobal("zone2on") === null) gotoInit(); if (System.getGlobal("main_zone_on") === null) gotoInit();
Not really elegant but working without errors and "Busy Executing" issues. I realixzed, though I forgot to use the scheduleAfter() but, it seems it's not needed.
|
|
Post 5 made on Thursday October 7, 2010 at 20:38 |
Lyndel McGee RC Moderator |
Joined: Posts: | August 2001 12,999 |
|
|
scheduleAfter() should, for sure, be used in Page scripts vs using executeActions() on a widget to prevent exceptions/errors as noted in the ProntoScript FAQ. This is documented here: [Link: pronto.philips.com]Note that it is very likely that this is why Widget.scheduleActions() was introduced. I have not tested this but I'm sure this was likely the case.
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|
|
Before you can reply to a message... |
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now. |
Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.
|
|
|
|