0
votes

This is the MOST basic of questions, but I can't find it anywhere. I have a movieClip in my main lib. I am loading a class called Main.as from the Flash cs6 IDE. I have an mc in lib called myMC. It's checked to export to actionscript.

But I just can't get this simple code to work.

package 
{

    import flash.display.MovieClip;
    import flash.events.MouseEvent;



    public class Main extends MovieClip
    {



        public function Main()
        {
            if (stage)
            {
                init();
            }

        }

        public function init()
        {

            addChild(myMC); // Does not work.

        }


    }

}
1

1 Answers

1
votes

You have to instantiate an object for it to be usable in ActionScript. Also, try to give your symbols in your library proper class names when making them available for ActionScript, starting with an uppercase letter.

public function init()
{
    var mc:myMC = new myMC();   
    addChild(mc);

}

This is assuming that the class name you set in your library for this symbol is myMC