Reputation: 4055
If my Document.as adds a movieclip to the stage how can I remove that movieClip when it reaches its last frame?
Document.as
private var MainVideo:MovieClip = new my_video();
addChild(MainVideo);
MainVideo.addEventListener("movieclip_stopped", _stopHandler);
function _stopHandler(e:Event):void
{
trace('mc was stopped');
}
And on the last frame of my MovieClip I put:
stop();
MainVideo.dispatchEvent(new Event("movieclip_stopped"));
But of course I am getting ReferenceError: Error #1065: Variable MainVideo is not defined.
since the movieclip doesnt understand who or what created it.
Upvotes: 0
Views: 600
Reputation: 3522
Make that:
this.dispatchEvent(...);
From inside the movie clip you refer to the movie clip using this
. From outside, you use a reference to the object, like MainVideo
.
Upvotes: 1