Skip to main content
Inspiring
April 23, 2012
Question

question regarding as3 flashvars

  • April 23, 2012
  • 1 reply
  • 886 views

Hello guys! I just have a question on how to use a flashvars.

I know how to use it when using a timeline method but I can't see the value that i'm passing when using "class" method.

Here is my code.

package

{

          import flash.display.MovieClip;

          import flash.net.URLRequest;

          import flash.events.MouseEvent;

 

          public class powerade extends MovieClip

          {

                    public var face:mcFace;

                    public var test:mcTest;

                    public function powerade()

                    {

                              face=new mcFace();

                              addChild(face);

                              face.x=372.1;

                              face.y=246;

 

                              test=new mcTest();

                              addChild(test);

                              test.x=372.1;

                              test.y=450;

 

                              var flashvars1b=this.load.parameters;

                              var loader1b:Loader= new Loader();

                              loader1b.load(new URLRequest(flashvars1b.mainImage));

                              face.addChild(loader1b);

                    }

 

          }

}

it returns an error :

C:\wamp\www\powerade\src\powerade.as, Line 331046: Type was not found or was not a compile-time constant: Loader.
C:\wamp\www\powerade\src\powerade.as, Line 331180: Call to a possibly undefined method Loader.
C:\wamp\www\powerade\src\powerade.as, Line 321119: Access of possibly undefined property load through a reference with static type powerade.

but when I tried to remove the code into red color, it works well.

This topic has been closed for replies.

1 reply

_spoboyle
Inspiring
April 23, 2012

you need to import the loader class add it witht he rest of your import statements

import flash.display.Loader

Inspiring
April 23, 2012

Thank you sir but when I import the loader class it throws an error:

C:\wamp\www\powerade\src\powerade.as, Line 261119: Access of possibly undefined property load through a reference with static type powerade.
_spoboyle
Inspiring
April 23, 2012

it would help if you highlight that error lines e.g. int he last case which line is 26

but first change

var flashvars1b=this.load.parameters

to

var flashvars1b=this.loaderInfo.parameters