Topic: sh script called from flash widget executes repeatedly

Strange issue here.
I am calling my test.sh script from flash like this:

var test_xml:XML = new XML();
test_xml.load('http://*chumby*/cgi-bin/custom/test.sh');

Testing the widget from outside the chumby, the test.sh gets executed once (exactly how i want it).
BUT testing the widget from the Chumby test.sh gets executed repeatedly.

I can only think of two possible reasons:
1. The load function from flash is constantly trying to acces test.sh (and therefore executing it all the time)
2. The sh script once called, runs itself in an endless loop.

What's starnge about this, is that it only appears when ran from the chumby.

I would need some help to figure out what the source of the error is and how to prevent it from running more than once.

Thanks in advance!

Re: sh script called from flash widget executes repeatedly

Hey,

could you provide an example of your code?
While I am a newbie in flash programming, I think it might be interesting to see it and it would help those who know more about flash.

If you want to find out whether one of the two possible reasons you mentioned is the problem, you could add some self made debug output.
E.g. put some text output before the .load, perhaps some counter.

Re: sh script called from flash widget executes repeatedly

Those two lines are all the code there is (plus a System.security.loadPolicyStatemnt - which is not the problem).
I think the problem is that the flash lite player on the chumby behaves different than the regular flash player.

On the flash player an onLoad Event is fired (with success = false as it is not an xml file).
On the chumby no Event is fired !! (The load process keeps on going, that's why the script is executed repeatedly)

I tried loadVars also with the same result.
An answer to one of these question could really help me solve the problem:

1. Is there a way to stop the load method (like the close() method on an AS3 Loader Class)? - I tried without success:

my_xml = null; unload(my_xml); my_xml = new XML(); stop();

2. Is there maybe another way to execute the shell script besides XML.load or LoadVars?

3. Is there maybe a way to trick the flash lite player into thinking he actually loaded an XML (or LoadVars) by adding some lines to the shell script?

Re: sh script called from flash widget executes repeatedly

You could try the fscommand:
http://livedocs.adobe.com/flash/9.0_de/ … 01177.html

With the "exec" argument it will execute a program.


Do you use "chumbyflashplayer.x -i xx.swf" to start your widget or is it mixed into your channels using a profile.xml?
If you have mixed it in you could try to kill the old control panel "stop_control_panel" and then start it again with "start_control_panel".
This will give you some debug output in the shell, perhaps that can help to find the error.

Re: sh script called from flash widget executes repeatedly

I think fscommand is not supported by the chumby.

I tried the following code from the chumby, but also without success (this time it didn't even execute the code once)

var my_xml:XML = new XML();
my_xml.ignoreWhite = true;
my_xml.load('exec://cgi-bin/custom/test.sh');  // tried this as well 'exec:/cgi-bin/custom/test.sh'

is exec:// supported by the chumby classic?

Re: sh script called from flash widget executes repeatedly

Flash Lite as it comes from Adobe does not support exec://

On Chumby, exec:// is only supported for "privileged" widgets and the Control Panel - the ability to execute arbitrary executables is considered a security hole.

The best approach here is to determine why the CGI is not operating correctly.

Re: sh script called from flash widget executes repeatedly

hi thanks,

and how canI find this out?
(What I really don't get is that it works from everywhere, except from the chumby itself..)

Re: sh script called from flash widget executes repeatedly

What I'd try:

1) make sure the script outputs *something*, even if it's just an HTTP header block
2) use the "onData" handler instead of the "onLoad" handler in order to avoid invoking the XML parser.

Re: sh script called from flash widget executes repeatedly

Hey Duane,

Returning an HTTP Header made the trick!
AWESOME!