Bobby Francis Joseph
Bobby Francis Joseph

Reputation: 600

Accessing a variable declared in fla from as file

On the stage I have a movieclip by the name of rect_mc. Inside it have have a MovieClip sqaure_mc.

In the time line that I get when I double click on rect_mc (timeline of rect_mc) I have written the following code

var width1:Number;
width1 = sqaure_mc.width;

How can I access width1 from the document class?

Upvotes: 0

Views: 214

Answers (1)

Marty
Marty

Reputation: 39456

Export your square_mc for ActionScript and define a class. Then in this class, define your variables.

package
{
    import flash.display.MovieClip;

    public class SquareMC extends MovieClip
    {
        public var width1:Number;

        public function SquareMC()
        {
            width1 = width;
        }
    }
}

The properties defined within this will be accessible from the document class via:

rect_mc.square_mc.width1;

Upvotes: 1

Related Questions