views:

29

answers:

2

Currently in Flash I am trying to pull in a value based on the querystring. Example..

Html code:

myVideo.swf?video=ThreeGuysOneBall.flv

Flash code:

_textbox1.text = video;

This works in the main flash actionscript, but I need the querystring in a class constructor that I created. How can I pass the querystring to a separated out actionscript file?

+1  A: 

try loaderInfo.parameters.video

Once the swf is loaded/ready you should be able access flash vars through the parameters object.

George Profenza
Thanks George. I have attempted this previously, but it doesn't seem to be working. When I try to debug it throws a compiler error"there is no class or package with 'flash.display.LoaderInfo'."I also tried different import methods including..import.flash.display.*;import.flash.display.loaderinfo;import.flash.display.DisplayObject.loaderInfo;None of them seem to be working. Sorry it's been a long, long time since I have worked in flash. How do I get loaderinfo to be recognized in my class?
goodwince
@goodwince If you look at the diagram from the documentation(http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/LoaderInfo.html) you will notice that you either use the loaderInfo property for the 'root' LoaderInfo instance or contentLoaderInfo property for content loaded with the Loader class. so picture this.loaderInfo, where this is the reference to your main Document class. Does this make sense ? Also, watch the spelling :)
George Profenza
@goodwince LoaderInfo is in the flash.display package so import flash.display.LoaderInfo; should work. You are using actionscript 3.0, right ?
George Profenza
I thought maybe I could convert it to actionscript 3.0 but my video controls don't work properly. I'm actually using actionscript 2.0. How can I get it to work in 2.0?
goodwince
@goodwince I'm retagging your question to actionscript then. In actionscript 2.0 you can access flash variables through _root( e.g. trace(_root.video); ) when the swf is loaded ( bytesLoaded == bytesTotal )
George Profenza
Appreciate your help George. I got it the loaderInfo piece, but you were really helpful in finding it and I didn't write it in my add on answer so you got the answer! ;]
goodwince
A: 

Ok. I solved my querystring issue. Thanks you George for helping me think about my issue in more detail.

The external actionscript had to have the parent converted to movieclip for me to be able to grab the parameter.

var par:MovieClip = MovieClip(this._parent);
_textbox1.text =  par.video;
goodwince