Posted by flashDev01 in SWF Studio V3 on Jun 23 2008, 11:45 am

Hi,

I am completely new to flash and SWFStudio.

I am having terrible trouble trying to get messageboxes to work using SWF studio.

Whenever I call a message box routine the function within which it is called returns immediately.

Asa for the simplest example, in the main function of my document class:

public function CMain()
{
ssDefaults.synchronousCommands = true;
ssCore.App.showMsgBox({icon:"exclamation", buttons:"OkCancel", defaultButton:"button2", prompt:"Message", title:"Warning"});

setupGameLoopTimer();
}

Running this application I see the messagebox for like a second then the application quits. If i comment out the showMsgBox function then the game runs fine (the setupgameLoop timer sets up an onEnter frame event listener and the game runs).

Is there something I am doing wrong? I am using windows Vista.

many thanks for any help


Posted by AGo in SWF Studio V3 on Jun 24 2008, 11:37 am

Hi and welcome aboard,

there are a few caveats you might look at in your scenario.
try this first,...

http://www.northcode.com/v3/kbitem.php?link=8

and then about document classes in AS3 check out this thread

http://www.northcode.com/forums/showthread.php?t=9000&highlight=document+class

(afaict still no FAQ yet, Derek :P )

hope that gets you started

edit: well, actually the second link is the one most important for you ;)


Posted by flashDev01 in SWF Studio V3 on Jun 25 2008, 06:32 am

Hi,

Thank you very much for your reply AGo.

I've looked at the threads you posted and I am very confused.

Are you saying that the reason my synchronousCommands aren't working is that the stage property of the SWF hasn't been setup yet?

This very simple document class does the same thing as I described in my original post...


public class CMain extends Sprite
{

public function CMain()
{
trace(stage);
this.addEventListener(Event.ADDED_TO_STAGE, init);
}


private function init(event:Event):void
{
ssCore.init();
ssDefaults.synchronousCommands = true;
ssCore.Win.show({});

var r = ssCore.App.showMsgBox({prompt:"running"});
}

All throughout my program all return objects from sychronous calls return null:

ie...

var return_obj = ssCore.FileSys.fileExists({path:m_pathStr});
ssDebug.trace(return_obj.result);

null appears in the trace window.

I do not use any frame scripts, the entry point for my game is through the constructor of the document class.

Is there something i need to do in the constructor of the document class... something i need to wait for before I can then go on to run my game code.

Thank you very much for any help!

btw AGo, is your AutoBuilder tool still available? I tried to download it from your site but the link is broken.


Posted by mbd in SWF Studio V3 on Jun 25 2008, 11:12 am


QUOTE:
All throughout my program all return objects from sychronous calls return null:
From your code, the return object isn't returning null, if it was a Flash player runtime error would be occurring since you would be trying to access a property on a null value, and the trace would never happen. The result property is null, which would indicate that there might be an error occurring. Have you checked the success property? If that is returning false, you should display the description property of the Error object on the return object:

var return_obj = ssCore.FileSys.fileExists({path:m_pathStr});
if (return_obj.success)
{
   ssDebug.trace(return_obj.result);
}
else
{
   ssDebug.trace('ERROR: '+return_obj.Error.description);
}


Posted by flashDev01 in SWF Studio V3 on Jun 25 2008, 12:15 pm

thank you very much for your reply...

I have checked the error description field. It said that synchronous calls weren't turned on. it appears that in trying to get my messageboxes working i had deleted the ssDefaults.synchronousCommands = true statement.

I am still stuck trying to get my messageboxes to work though!

Cheers,


Posted by flashDev01 in SWF Studio V3 on Jun 26 2008, 12:00 pm

I have attached a spx file which demostrates the problem I am having.

In this application calling the message box causes an error and the application quits.

I'm obviously not understanding something fundamental here as I can't seem to find anybody else with the same problem.

If anybody can point out what I am doing wrong I would be very grateful.

Many thanks.

attachments: test.spx  


Posted by AGo in SWF Studio V3 on Jun 26 2008, 12:07 pm

Glad you made that example!

Try removing the ssCore.Win.show() command, and If my assumption is right, your application will stay alive (thus not showing the dialog, but that´s ok for now)

The reason I asked is that I once got that very same problem, but was not able to produce an example that allowed to reproduce this issue.

What happens for you if you remove ssCore.Win.show() ?

btw, what do you use to complie your swf, or did you just forget to include the fla file?

edit: btw, thanks for the note about the link, it´s now fixed


Posted by flashDev01 in SWF Studio V3 on Jun 26 2008, 12:26 pm

Hi AGo,

Thanks for your reply.

Removing the Win.show command hs no effect. I briefly see the window, the messgabox pops up very briefly and the app closes.

I am using Flash CS3 to compile the SWF.

Do you have any other ideas?

Cheers