Jump to content

Need Actionscript 2.0 Help with Variable Scope


Recommended Posts

Yeah, wrong forum.  Sue me.  The var called "img" loads from a PHP page so I guess it might qualify as a PHP question!  lol

 

var foo = "cheese";

  if (vars_sent != 1)
    {
    var loader:MovieClipLoader = new MovieClipLoader();
    loader.loadClip(img,ph);

    var pl:Object = new Object();
    loader.addListener(pl);

    pl.onLoadInit = function(target)
      {
      cheese = "burgerTacoWax"; //gross, just like McDonalds
      }

    trace(cheese);
    vars_sent = 1;
    }

 

How do I change the variable cheese to the new value outside the function pl.onLoadInit?  I know its a scope problem, but AS is not the same as PHP and _global.var_name doesnt work.  Googling hasnt helped either.  Can anyone explain?

Yeah, wrong forum.  Sue me.  The var called "img" loads from a PHP page so I guess it might qualify as a PHP question!  lol

 

Suprise suprise, I have no idea....

 

I had to post pointlessly here, but isn't that kind of what you've done anyway?

 

Try an actionscript forum?

I didnt feel like going thru the hassle of finding some site with a forum with a bunch of active users at 3AM and signing up, registering, waiting for admin approval if required, etc, etc, etc...

 

As far as I understand this is a relatively easy actionscript question for those with experience in that screwball language...  Was just hoping somebody with AS experience might point this out...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.