Skip to main content
Inspiring
November 3, 2008
Answered

Dynamically writing flashvars

  • November 3, 2008
  • 2 replies
  • 748 views
Can anyone tell me how to get a flashvar into flash without using javascript? Is it even possible anymore?

I have a flash movie embedded in an aspx page that needs to dynamically load an xml file based on a parameter in the querystring. Everywhere I look all I see are posts telling me that the only way to do it is to add the flashvar to the AC_FL_Runcontent script, however I can't be certain that all my clients will have javascript enabled and I know at least a few who are not allowed to have it turned on.

When I use the object and embed tags and add my flashvar param and inline tag I get nothing in the loaderInfo object in my movie.

Am I out of luck with AS3 in this regard?
This topic has been closed for replies.
Correct answer Colin Holgate
Look at this page, which even includes an ASP example:

http://www.permadi.com/tutorial/flashVars/index.html

then in Flash make sure you're looking for the variables in the main time line. You would say:

var vars:Object=this.loaderInfo.parameters;

and that would give you an object variable, vars, that has each of the things set up in flashvars.

2 replies

Colin Holgate
Inspiring
November 4, 2008
As far as I know the loaderinfo is there as soon as the swf opens. I've never used a listener to wait for it.


MaxManNHAuthor
Inspiring
November 4, 2008
Interesting. I simply copied the code from the link you send me wholesale. The author is using an event to verify the loaderInfo object is completed. I don't know what the deal with that is, but either way it works. Thanks again.
Colin Holgate
Colin HolgateCorrect answer
Inspiring
November 4, 2008
Look at this page, which even includes an ASP example:

http://www.permadi.com/tutorial/flashVars/index.html

then in Flash make sure you're looking for the variables in the main time line. You would say:

var vars:Object=this.loaderInfo.parameters;

and that would give you an object variable, vars, that has each of the things set up in flashvars.
MaxManNHAuthor
Inspiring
November 4, 2008
Thank you for the link Colin.

I got it working, but I noticed a little hiccup. The Event.COMPLETE event never seems to fire in IE7 when you add your event listener to the loaderInfo object.

I added the listener to Event.INIT and now it seems to be working fine. Thanks again for the link to the tute!