Getting external parameters in ActionScript 3

ActionScript 3.0

Actually this is not a big or complex post. I am a part time ActionScript 3.0 developer and recently in my company i2we, inc. I developed a customized jobs search widget for them. Where one of the criteria was when we include flash object in html, we can provide external parameter. Based on the parameter the flash widget customize its result.

So in this post, I will show how you can pass parameter from html and get them in your flash object. Please keep in mind that my code is based on ActionScript 3.0

Look at the html code

<object classid="clsid:xxxxxxxxxxxxxx" codebase=",0,0,0" width="250" height="370" id="widget" align="middle">
            <param name="allowScriptAccess" value="sameDomain" />
            <param name="allowFullScreen" value="false" />
            <param name="movie" value="" />
            <param name="quality" value="high" />
            <param name="bgcolor" value="#ffffff" />
            <embed src="" quality="high" bgcolor="#ffffff" width="250" height="500" name="widget" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="" />

Look I pass parameter company = facebook

Now I capture this parameter in my flash widget using actionscript by the following way

var globalParam = LoaderInfo(this.root.loaderInfo).parameters;
for (var element:String in globalParam) {
     if (element == 'company'){
           company =   globalParam[element];

This actionscript 3.0 codes first loads global parameters and put them in globalParam variable. Now I just check whether there is a parameter named company or not. As I provided the company parameter in html so within flash object, I will get company = facebook

Very easy, right? Cheers!

mahmud ahsan

Computer programmer and hobbyist photographer from Bangladesh, lives in Malaysia. My [Github | Business | Twitter | Linkedin | Youtube | Instagram | 500px]

You may also like


  • Andres
    July 2, 2010 at 11:58 pm

    It does not work

    1120: Access of undefined property company.

  • Wyatt Richlin
    August 2, 2010 at 10:30 am

    Hm ,.. Yes the best way is to just play like my friend Brenton Berber he just play games and enjoy his life.

  • Alex Mercer
    October 20, 2010 at 4:30 am

    thx… work’s fine

    to Andres, try to initializate a variable named ‘company’ before loop…

Comments are closed here.