i am trying to run 2 functions on the timeline from inside a movieclip and i cannot seem to understand why the “removeCharacter” function works while the “tlHolderReset” wont… flash gives me a message “tlHolderReset is not a function. at police1/::frame4()”
i have two movieclips in the library called “police1” and “police2”… they both have a “stop();” action on frame 1 and the following code on frame 4:
stop();
Object(root).removeCharacter(); //This works
Object(root).tlHolderReset(); // <<<< THIS IS MY PROBLEM
when the user clicks on the movieclip, it should play… and once it hits frame 4, the code above should run…
on the main timeline, this is the code…
var characterArray:Array = [new police1(), new police2()];
tlHolderReset();
var tl_holder:MovieClip;
function tlHolderReset():void
{
tl_holder = new HolderClass();
stageholder.addChild(tl_holder);
tl_holder.x = 116
tl_holder.y = 69
var tl_timer:Timer = new Timer(3000, 1);
tl_timer.addEventListener(TimerEvent.TIMER, ac_TL);
tl_timer.start();
}
function ac_TL(event:TimerEvent):void
{
var tl_character = characterArray[Math.floor(Math.random() * characterArray.length)];
tl_holder.addChild(tl_character);
tl_character.addEventListener(MouseEvent.MOUSE_DOWN, handleTarget);
}
function handleTarget(event:MouseEvent):void
{
event.target.play();
}
function removeCharacter():void
{
tl_holder.removeEventListener(Event.ENTER_FRAME, TL_window);
stageholder.removeChild(tl_holder);
}