Url Variable in Action script 3
Friday, October 12th, 2007Thing were easy in Actionscript 2 when you need to pass value from browser to the flash the you could do
<object classid=“clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″
codebase=“http://download.macromedia.com/
pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0″ width=“210″ height=“120″> <param name=“movie” value=“aflash.swf?var1=value1&var2=value2″> <param name=“quality” value=“high”> <param name=“wmode” value=“transparent”> <param name=“menu” value=“false”> <embed src=“aflash.swf?var1=value1&var2=value2 ” width=“210″ height=“120″ quality=“high”
pluginspage=“http://www.macromedia.com/go/getflashplayer”
type=“application/x-shockwave-flash” wmode=“transparent” menu=“false”></embed>
Here i am passing two variable var1 and var2
in actionscript i can just refer the variables as var1 and var2 in the main time line or the time line of _root
but in Action script 3 the code goes like this
(Code in the main time line)
var1=this.loaderInfo.parameters.var1;
What is loaderInfo ?
loaderInfo is an object of flash.display.LoaderInfo . It provides information about loaded media such as content type, content length, url , bytesloaded
The Class DisplayObject has a property loaderInfo of type LoderInfo which means all the classes like movieclip, buttons (sub classes of Displaybjet) have this property so does the main time line . so we are using parameters property to get url variable .