Hi …
I have one main class to attach MovieClip from library call “Circle” and everything was attach and display to stage smoothly…my problem is how to call a methods from this Main class form Circle MovieClip I mean inside “Circle.as” …u can see my code below
Main.as
package{
import flash.display.Sprite;
import flash.display.Stage;
import flash.display.DisplayObjectContainer;
import flash.display.MovieClip;
import flash.events.Event;
public class Main extends Sprite{
private var _stage:DisplayObjectContainer;
public function Main(stage_:Stage){
_stage = stage_;
}
public function attachCircle():void{
var circle:Circle = new Circle();
//circle.x = 100;
//circle.y = 100;
_stage.addChild(circle);
}
public function callMe():void{
trace("foo");
}
}//end class
}
Circle.as
package{
import flash.display.MovieClip;
import flash.events.Event;
public class Circle extends MovieClip{
public function Circle(){
this.addEventListener(Event.ENTER_FRAME, moveCircle);
}
private function moveCircle(e:Event):void{
var mc:MovieClip = (e.target as MovieClip);
mc.y = 100;
if(mc.x < 400){
mc.x += 10;
}else{
mc.removeEventListener(Event.ENTER_FRAME, moveCircle);
//how to call function in main class here in another words equivalent some sort of _global function in AS2
callMe();
//it thrown this error for my attempt so far ...
**//1180: Call to a possibly undefined method callMe.**
}
}
}
}
Hope someone can give me some shed on light on it…really need help…tq…