I created a symbol (MovieClip) in my fla file and added it to the frame. Then i give it instance name at properties panel: "myMC"
Then tried to control it from my class file in directory: root\Test\MyClass.as
package Test {
import flash.display.MovieClip;
public class MyClass extends MovieClip{
public function MyClass() {
var myMC:MovieClip = getChildByName("myMC") as MovieClip;
myMC.gotoAndStop(2);
}
}
}
After that, imported the class to fla and tried to run:
import Test.MyClass;
var LaunchMyClass:MyClass = new MyClass();
and get this error,
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Test::MyClass()
at Test_fla::MainTimeline/frame1()
Note that i'm trying to control a MovieClip already in the stage, not calling it from library.