Posted by baoputzi in SWF Studio V3 on Apr 02 2008, 02:17 pm

this is the code:
ssCore.Shell.invoke({path:"startdir://" + file, width:appW, height:appH, x:appX,y:appY, waitForExit:true, forceChild:true},{callback:'onExit', scope: _level0});

function onExit(return_obj, callback_obj, error_obj)
{
if (return_obj.success)
{
ssDebug.trace("in pps callback");
_root.closeContBtn_mc.enabled = true;
_root.closeAllContent();
}
else
{
ssDebug.trace('pps ERROR: '+return_obj.Error.description);
}

}

I tried out with added scope (_level0, _root, -this) and also setting waitForWindow to false, I tried with and without quotation marks around the function call, I even tried with Flashplayer8 and 9 without any success. The Powerpoint application does send an exitCode (259) but the call to the onExit function, inititated by the callback, fails.


Posted by microsup in SWF Studio V3 on Apr 02 2008, 03:14 pm

In your code I highlighted it bold

ssCore.Shell.invoke({path:"startdir://" + file, width:appW, height:appH, x:appX,y:appY, waitForExit:true, forceChild:true},{callback: 'onExit', scope: _level0});

use: {callback:onExit} if you use function don't use ""


Posted by mbd in SWF Studio V3 on Apr 02 2008, 04:45 pm

microsup, please take a look at the documentation:

QUOTE:
The callback property can be specified as a string (name of the function) or as a function reference.

And in the notes:

QUOTE:
If the callback property is specified as a string and the scope property is not specified, ssCore will attempt to identify the scope of the function. For instance, if you specify the callback property as "_level0.NavBar.myFunction" then ssCore will understand that the function "myFunction" resides on _level0.NavBar. If you only specify the function as "myFunction", ssCore will assume the function resides on _level0.

baoputzi,

QUOTE:
I even tried with Flashplayer8 and 9 without any successDid you switch to an older version of SWF Studio? Do you mean you are publishing for Flash Player 8/9?

QUOTE:
The Powerpoint application does send an exitCode (259) but the call to the onExit function, inititated by the callback, fails.Are you saying that the success property is false? Or that the callback function isn't called? If it isn't called, how do you know it's returning an exitCode of 259?


Posted by microsup in SWF Studio V3 on Apr 02 2008, 04:54 pm

sorry, my bad. I always used function reference and have no problem, and some times I used it as string function name, and it faild, now I know why. :)

Thanks.


Posted by baoputzi in SWF Studio V3 on Apr 03 2008, 10:34 am

Thank you all
- the callback function is not called
- I know the exit code by just using the sync call method instead and reading out the result_obj.
-but using the sync call here gives me a flashplayer error "a script in flash player is causing your system to run slow ...." according to ago's suggestion I made the call async which avoided that problem but presented me another one...
- I am using swfStudio 3.5 build 314 and did not switch back.
- I am publishing for FlashPlayer9 but I also tested that issue with publish settings set to FlashPlayer8 just to make sure...

- same issue on Vista64/Vista32/XP32
- same issue with different Powerpoint Show settings


Posted by mbd in SWF Studio V3 on Apr 03 2008, 10:56 am

Can you try launching the same file using the example from the web site?:
http://www.northcode.com/v3/exampleitem.php?link=25


Posted by baoputzi in SWF Studio V3 on Apr 03 2008, 11:25 am

This works also with my powerpoint samples. The exit code is the same


Posted by mbd in SWF Studio V3 on Apr 03 2008, 11:45 am

So the example works? Then there might be something wrong with your project.

Can you post a simple example that fails for you?


Posted by mojo in SWF Studio V3 on Apr 03 2008, 12:56 pm

I'm several hours into this & no luck.
Have tried every way possible, latest is below without ""s or scope, both functions reside in my _root like below.
testfile.php is retrieved and testfile.txt is created, I get nothing from the HTTP.read callback though?

function doIt() {
ssCore.HTTP.protocol({protocol:"HTTP"});
ssCore.HTTP.host({host:"mysite.com"});
ssCore.HTTP.resource({resource:"testfile.php"});
ssCore.HTTP.local({path:"startdir://testfile.txt"});
ssCore.HTTP.start();
ssCore.HTTP.read({}, {callback: _root.testFunc});
}
function testFunc(r, c, e)
{
if (r.success)
{message = r.result;
debugger = "woot";
ssCore.HTTP.stop();
}
else
{message = 'ERROR: '+e.description;
debugger = "shit";
ssCore.HTTP.stop();
}
ssCore.App.showMsgBox({prompt:message});
}

I'm simply out of ideas, figured it was time to ask :)
Thanks


Posted by mbd in SWF Studio V3 on Apr 03 2008, 01:09 pm

You should wait for the start to complete before calling the read. The read should fail if the start has failed, but if you're executing the start command asynchronously the read might be getting confused.

I would check the start return object in any case, since the connection can fail, which would make the read attempt less than useful.


Posted by mojo in SWF Studio V3 on Apr 03 2008, 01:14 pm

OK, will go back & try that again.
I had tried a callback on start also, then fire the read on a start success, but the start callback failed me too last try.


Posted by mojo in SWF Studio V3 on Apr 03 2008, 01:54 pm

I can't get a callback from anything to work.


Posted by mbd in SWF Studio V3 on Apr 03 2008, 02:04 pm

Can you provide a simple example?

Can you try this with nothing else in the FLA/SWI:

ssCore.init();

_level0.createTextField('text_txt', 1, 0, 0, 200, 30);

_level0.text_txt.text = 'showing messagebox...';

ssCore.Win.show();

ssCore.App.showMsgBox({prompt:'Hello'}, {callback:onAnswer});

function onAnswer(r, c, e)
{
   _level0.text_txt.text = 'onAnswer';
}

Here's an example with the code in it.

Does that work for you?

attachments: callbacks.spx  


Posted by mojo in SWF Studio V3 on Apr 03 2008, 03:01 pm

Your spx worked fine & I got one to work, but had to create my own textfield.
The callback fired after clicking OK in the prompt.
I'm getting nothing from callbacks related to the http plugin though.

P.S. Getting blank or garbled pages 50% of the time today on the forum too.


Posted by Dan in SWF Studio V3 on Apr 03 2008, 03:27 pm

Can you verify that the HTTP plugin is selected in the plugins tab? (I'm just trying to start with the basics.)

I ask because if the core functionality works, but the plugins don't, then that is often the issue.


Posted by mbd in SWF Studio V3 on Apr 03 2008, 03:47 pm

Can you try this example?

Btw, the forum garbling seems to only happen with Firefox. I use FF and get this at an annoying rate. Apparently this never happens with IE, though. Not sure if something on the server is sending something that FF doesn't like and IE doesn't care about, or what. I only get this with our site.

Note: The app won't display anything. Have SWF Studio open to the Trace tab and you'll see messages appear there.

attachments: callbacks.spx  


Posted by mojo in SWF Studio V3 on Apr 03 2008, 05:18 pm

Thanks guys, still no luck & I do have the http plugin checked.

Running FF beta, so that explains the forum problem ;)

Time for a break...


Posted by baoputzi in SWF Studio V3 on Apr 04 2008, 09:58 am

I dont know what should be wrong with my project. The syntax for ssCore.Shell.invoke seems to be ok and the trace of the variables shows correct values and the pps/ppsx is opend at the correct place. The exit code is given just the callback function is not called. I also tried to add sync:false without success. Is there any situation preventing callback from executing?


Posted by mbd in SWF Studio V3 on Apr 04 2008, 10:39 am

There are many things that can stop a callback from being executed.

From where is the call to ssCore.Shell.invoke being made? Inside a movieclip, on a movieclip, on a button, from a button's onRelease, from a component's event handler?

Can you call the function directly from where the ssCore.Shell.invoke call is made? For example, comment out the call and just call onExit directly, or after a timeout (just in case the function doesn't actually exist or is overwritten at some point).

Can you check the Task Manager to see if powerpoint or the powerpoint viewer is still open?


Posted by baoputzi in SWF Studio V3 on Apr 04 2008, 02:09 pm

thank you for the idea.

ssCore.Shell.invoke was placed inside a switch statement and so was the callback function. Once placed outside of the switch statement. The callback was executed properly.
function (lookfor, file)
{
function onExit(return_obj)
{
//my code here
}

switch(lookfor)
{
case "pps":

// invoke
break;
case "ppsx" :
//invoke
break;

}
}