i want to add more fish to my flash fish tank by clicking a button..i tried this code but my fish animation is not getting animated after i click the button..and i'm using action script 3..
function fl_MouseClickHandler_2(event:MouseEvent):void
{
// Start your custom code
// This example code displays the words "Mouse clicked" in the Output panel.
trace("Mouse clicked");
addChild(f3);
addChild(eat) ;
addChild(hello) ;
addChild(f2) ;
addChild(f1) ;
// End your custom code
}
f1,f2,f3,eat,hello are my fishes..
This is my infinite scrolling code..all the fishes are in separate layers..so for each layer i have put this code..by just changing the instance name and the function.
f3.addEventListener(Event.ENTER_FRAME, fnewm);
function fnewm(evt:Event)
{
if(f3.x + f3.width <= 0) //movieclip is outside left side of stage
{
//set new position
f3.x = stage.stageWidth;
}
else
f3.x -= 5;
}
As you "Mouse clicked" message don't show in console I can assume either of two options:
I can't tell you exactly, but you can try manually set button's depth. More info on how to do it can be found here