A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Cannot Access flashvars inside loaded AS2 SWF

  1. #1
    Junior Member
    Join Date
    Mar 2009
    Posts
    4

    Cannot Access flashvars inside loaded AS2 SWF

    Hi all,

    Here's what i am trying to do. I have an AS3 swf which loads and external AS2 swf. Inside the AS2 swf i have the following code which fetches the flashvars passed through html.

    flashpar.text = "Params: " + _level0.name;

    When i run the AS2 SWF independently passing the param through HTML. It works fine.

    But when i load the AS2 swf inside AS3 swf. It is not able to fetch the flashvars, which is strange cz if i load the AS2 SWF inside another AS2 swf it works fine.

    Can anyone please suggest as to how should i fetch the flashvars inside the loaded AS2 SWF.

    Please help guys.

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    The AS2 swf is not operating at the top level - so in your html page there is an AS3 swf embedded object - that's where the flashvars get picked up, then inside that the flash player is loading a second instance of itself to run the AS2 swf inside the AS3. So the AS2 is inside a little vacuum...you could probably pass those through a shared object or through the local connection but other than that there's not a good way to move data across the AS2/3 boundry. (Check out Grant Skinner's swfBridge).

  3. #3
    Junior Member
    Join Date
    Mar 2009
    Posts
    4
    thank you so much for the reply. I think ill have to use a wrapper SWF or some kinda proxy SWF which loads my other SWF's and pass on all the flashvar data to this proxy SWF which will pass on to the SWF loaded within it.

    is there any way in which i can fetch all the flashvars data in one go. any loop of some sorts??

  4. #4
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Sure - all the flashvars come in through the stage's loaderInfo.parameters object, you could loop through with a for...each or for...each in loop:

    PHP Code:
    for(var key:String in loaderInfo.parameters){
        
    trace("{" key "," loaderInfo.parameters[k] + "}");    


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center