Read the parameters of a movie in Actionscript 3.0

With Flash CS3 has changed the way to read the parameters passed to a movie, or as params that as GET parameters. In previous versions of Flash it is a parameter was available as a variable directly in the first frame. Now, fortunately, we have an object that handles parameter passing, and not only: LoaderInfo .

The class LoaderInfo provides information about a SWF or image file (JPEG, GIF or PNG). LoaderInfo objects are available for any display object. The information provided includes load progress, the URLs of the loader and loaded content, the total number of bytes in the media and the nominal height and width the same.

As indicated in the documentation LoaderInfo object is available for any display object:

image

To retrieve the parameters is sufficient to read the property parameters . This property is an object - dynamic read-only - which contains the name-value pairs, exposed as properties that meet our parameters. You can also use a loop for-in to extract all the name-value pairs.
For example, if we sent a GET parameter like this:

1

or like this:

1
2
3
"flash/filmato.swf" type = "application/x-shockwave-flash" height = "200" width = "200" > < object data = "Flash / filmato.swf" type = "application / x-shockwave-flash" height = "200" width = "200">
"valore=5" name = "flashvars" / > < param value = "value = 5" name = "flashvars" />
</ object >

in the first frame of your movie insert:

1
loaderInfo . parameters . valore ) ; trace (loaderInfo. parameters. value);

The object LoaderInfo , then there are other very interesting properties that I recommend you go and see. Actually delivers a lot of information about the "container", the version of ActionScript, the MIME type (application / x-shockwave-flash or image / jpeg) events to handle upload and much more.

One Response to "Read the parameters of a movie in Actionscript 3.0"

  1. June 16, 2008 Creating a preloader generic Actionscript 3.0 | Undolog.com :

    [...] ...) Must be run past in some way. The technique I used is that described in Reading the parameters of a movie in Actionscript 3.0. In practice we would use: PLAIN TEXT [...]

Leave a comment

XHTML TAG PERMIT: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> INSERTION CODE:
 <pre></pre> // blocco generico <code></code> // blocco generico [cc_actionscript][/cc_actionscript] // Actionscript [cc_actionscript3][/cc_actionscript3] // Actionscript 3 [cc_css][/cc_css] // CSS Style Sheet [cc_html][/cc_html] // HTML [cc_js][/cc_js] // Javascript [cc_objc][/cc_objc] // Objective-C [cc_php][/cc_objc] // PHP [cc_sql][/cc_sql] // SQL