I want to make a cool start menu. I was wondering if you guys know how to do like this: When you rollover the play button with the cursor, an arrows pops up beside it. And when you take the cursor away from the play button, it dissappears again Thanks in advance!
You can do it either with code or with the button mc... on the 'over' state of the button, simply add the arrow! With code, add two event listeners, one for rollover and one for rollout, and add the cursor with addChild on the rollover, and remove it with removeChild on the rollout!
Thank you very much pixelsmash! Do you have a tutorial on youtube or something? Because im not that practised, and dont understand how to set up the codes and the over state thing yet.
first, you need your button, ofcourse. Since it's with code, you don't have much need for a 'button', you can also use a movieclip.
//the button MC var button:MovieClip = new buttonMCYouMade();
//the arrow MC var arrow:MovieClip = new arrowMCYouMade();
//now add the event listeners button.addEventListener(MouseEvent.MOUSE_OVER, buttonOver); button.addEventListener(MouseEvent.MOUSE_OUT, buttonOut);
//also define the functions you'll use with the mouse events private function buttonOver(e:MouseEvent):void{ if(!button.contains(arrow)){ button.addChild(arrow); } //also add any animation you want here for the button }
private function buttonOut(e:MouseEvent):void{ if(button.contains(arrow)){ button.removeChild(arrow); } //animation here as well, if you like }
You might wonder why I also use button.contains() here, but that's mostly because I've had a few projects where occasionally one of the two functions didn't fire, so you'd have multiple arrows on one button... which means you'll always see an arrow, wether you're over the button or not.
lol, that's up to you Animate the movieclips in the .fla, and use a 'stop()' to prevent the animation, and you can use either 'lay()' or 'gotoAndPlay("somewhere"'