PDA

View Full Version : LoadFlashVars



bencam
September 17th, 2008, 03:42 PM
I am trying to load a delimited string from an html wrapper to tell flash which frame label to go to. So far it doesn't work, even though my script is no different from script I've seen thus far.

Here is the code:
var loadedVars:Object = LoaderInfo(MyMovie.mainTimelineRef.loaderInfo).par ameters;

MyMovie is the document class and mainTimelineRef = MyMovie(this.root);

I test this in an html wrapper and expect it to go to a frame label specified in the wrapper:
<param name="FlashVars" value="frameToShow=FrameLabel2_1>

an externalInterface.call is executed after the swf is loaded to get FlashVars.

I don't know what else to provide, but I'm not an expert at actionscript 3.0 and I have tried many times to solve this problem. There is a great deal of other code but it all seems to work except where I have to bring the information in from the html wrapper.

Any help would be very much appreciated.

rosyTown
September 17th, 2008, 09:19 PM
In your document class you need to write this in the constructor.

var params:Object = LoaderInfo.parameters;
trace(params.frameToShow);

It should trace out "FrameLabel2_1" (assuming you have Flash Tracer)

bencam
September 22nd, 2008, 12:15 PM
I am not sure how to get this to work. I am getting the error:

1119: Access of possibly undefined property parameters through a reference with static type Class.

when I put this in myMovie. Do I have to import a class for this to work?

rosyTown
September 22nd, 2008, 08:33 PM
Static Document Class? WTF. I'm gonna need to have a look at your document class code.

sekasi
September 22nd, 2008, 08:40 PM
loaderInfo.parameters

Capital L is another thing. :)

bencam
September 23rd, 2008, 03:45 PM
Here is the attached test file. It has a bunch of associated files. Any help would be deeply appreciated.