3 Replies Latest reply on Jun 22, 2006 8:09 PM by NSurveyor

    Accessing JSFL from a SWF

      I'm trying to create a little app where I can execute methods i've written in a JSFL file from my SWF. All the documentation says this is possible but only refers to it when the SWF is loaded externally into some type of HTML or other container where the JavaScript would be automatically present. What i'm trying to do is get at JavaScript that would be held in a *.jsfl file and not linked by the SWFs container. I do not see any way in the docs to be able to identify a specific file to load in order to execute the JavaScript. Does anyone know how to accomplish this? Thanks in advance.
        • 1. Re: Accessing JSFL from a SWF
          NSurveyor Level 2
          I don't get what you are trying to do. JSFL is for the authoring environment, e.g. making it easier to do something within Flash. If you make your SWF a Flash panel (a panel in the authoring environment), you can call jsfl files with something like:


          But note, ALL OF THIS is happening within Flash.
          • 2. Re: Accessing JSFL from a SWF
            caskater Level 1
            Yea thats what I am working on .... a flash panel. Its having a problem running though. It doesn't seem to like a relative path name, it wants a full path name such as file://C|/...../myfile.jsfl which isnt very helpful since the location will vary depending on installation and platform. Also, does this return values... part of me needing to execute through the JSFL is to get stuff back, how can I get return information into the SWF?
            • 3. Re: Accessing JSFL from a SWF
              NSurveyor Level 2
              OK, just making sure...

              Ok so, I think you could use _url property to make an absolute path based on the current swf... Also, instead of just calling the JSFL file, call a specific function within the JSFL file that returns a value, and you can pass arguments if you like. Note, this value will be a string:

              var path = _url.split("/").slice(0,-1).join("/")+"/makeEverythingBlue.jsfl"
              var jsfl = 'fl.runScript("'+path+'","functionInTheFile","arg1",2,"arg3!!");'
              MMExecute("success = "+jsfl);

              I haven't tested the above, but it looks awright to me.