Posted by BGoulette in SWF Studio V3 on Jun 02 2008, 11:09 am

I'm sure this is a stupid question, but no matter what I try (or what I read), I can't seem to figure it out.

My application relies heavily on external files -- all of which live under the directory in which the compiled EXE lives.

I've tried the following to no avail:


var tmpPath:Object=ssCore.App.setBasePath({path:"startdir://"});
appPath=tmpPath.result;


Am I doing it wrong? Or is there a better way to get the path of the EXE?

Additionally, I've tried this (after the above snippet):


ssDebug.trace(appPath);
ssCore.App.showMsgBox({prompt:appPath});


and nothing shows up! Not in the trace panel or in a message box (and I do have enable debug mode checked!).

Any thoughts? I can provide more information if necessary. Thanks!


Posted by northcode in SWF Studio V3 on Jun 02 2008, 11:14 am

The result from setBasePath is NOT what you are expecting, it's a Return Object and the App.setBasePath function does not return an output parameter.

use one of these calls to set the base path to the start dir:

ssCore.App.setBasePath({path:"startdir://"});
ssCore.App.setBasePath){path:ssGlobals.ssStartDir}); // equivalent to using startdir://

use this if you need to know where the startdir:// moniker is pointing:

appPath = ssGlobals.ssStartDir;

There are sGlobals equivalents of all the File Monikers in SWF Studio.


Posted by BGoulette in SWF Studio V3 on Jun 02 2008, 11:43 am

Wow -- thanks for the fast reply!

And that definitely clears something up for me. I didn't even know to search for FileMonikers, though knowing it exists will most likely be quite helpful.

That said, I'm still not sure what I'm doing wrong :(

If I do Test Movie (Ctrl-Enter) in Flash, my app "works" (though, expectedly, the ssCore stuff doesn't work); if I publish it then build it in SWF Studio, it suddently doesn't work -- and statements like ssCore.App.showMsgBox({prompt:"Hey there!"}); don't work, either :(

If I use the Flash debugger, I get a statement that says a #1009 error occurs at Kiosk.$init (or something close to that). It's probably ridiculous to ask, but I will anyway, because I have no pride :( -- do you have any idea what would cause the equivalent of a runtime error in SWF Studio but not in the Flash IDE? I'd be happy to post the (horribly convoluted) .as file if you think it'd help. In fact, I'll do that anyway, just in case...

I'd appreciate any help!

(The Kiosk.as file is my document class and requires numerous other files to actually do anything.)

attachments: Kiosk.as  


Posted by mbd in SWF Studio V3 on Jun 02 2008, 01:34 pm

I've been threatening to write a FAQ about this for some time so I'll get to it today!

Here's a post where I've explained:
http://www.northcode.com/forums/showpost.php?p=44460&postcount=2


Posted by BGoulette in SWF Studio V3 on Jun 02 2008, 02:12 pm

Derek, thanks for the heads-up. I'll re-write my constructor to use ADDED_TO_STAGE.

Though in other tests, I seem to be experiencing some weird behavior if the first thing my app does is show a message box: namely, I see the box flash ever-so-briefly on the screen, then my whole app dies silently. Here's the sample class I wrote just to see what was going on:


package
{
   import flash.events.*;
   
   import flash.display.MovieClip;
   
   public class SSTest extends MovieClip
   {
      public function SSTest ()
      {
         this.addEventListener(Event.ADDED_TO_STAGE, doInit);
      }
      
      public function doInit (evt:Event):void
      {
         ssCore.init();
         
         trace ("Added to stage.");

         ssDebug.trace("Tracing: hey there");
         ssCore.App.showMsgBox({icon:"information", buttons:"OkOnly", prompt:"Hey there!", title:"Hey!"}, {callback:getMsgResult});
         
         this.stop();
      }
      
      private function getMsgResult (r:Object, c:Object, e:Object):void
      {
         if (r.success) {
            ssDebug.trace("User clicked: ", r.result);
         }
         else {
            ssDebug.trace("Crap!");
         }
      }
   }
}


Has anyone else observed this behavior? Thanks for any advice.

(I'm attaching an spx, fyi -- though I can't promise I created it properly!)

Edit: It's worth mentioning that as soon as I comment out the line with showMsgBox, everything (else) works as it should (I see the trace statements in the Trace Ouput window).

attachments: sstest.spx  


Posted by BGoulette in SWF Studio V3 on Jun 02 2008, 03:20 pm

I are an idiot! :rtfm:

Apparently, when I add the callback:


{sync:true}


everything works as advertised. I apologize for the unnecessary hassle :(

I'm trying, I really am! To which Tim and Derek respond, "Yes, you are trying...our patience! :D


Posted by mbd in SWF Studio V3 on Jun 02 2008, 03:30 pm

You shouldn't HAVE to make the showMsgBox call synchronous. You can, although I usually advise that people make calls to dialogs asynchronously since you are waiting for feedback from the user.

Your project worked fine for me.

What version of SWF Studio are you using?

What OS are you using?


Posted by BGoulette in SWF Studio V3 on Jun 02 2008, 06:15 pm

I'm using the trial version of SWF Studio 3.5 (Build 314), and I'm using Win XP SP2.

The example I provided worked for you? I guess that's good -- if only it'd work for me! :D Granted, I'm noticing some other problems on my machine itself (I think something I tried disabled almost everything when I click Ctrl-Alt-Del -- even after rebooting :( )

But if you can think of something I might be doing wrong (re: having to set sync to true), I'm all ears. Thanks!


Posted by northcode in SWF Studio V3 on Jun 02 2008, 10:25 pm

Kiosk mode in SWF Studio can cause what you're seeing (with Ctrl+Alt+Del). Check out AGo's Kiosk Killer application, it will help you undo the lingering side-effects of kiosk mode.


Posted by BGoulette in SWF Studio V3 on Jun 02 2008, 10:39 pm

Awesome -- thanks for letting me know! I'll give it a shot and see how it goes. Again, thanks!