mouseover, then click
by Josef Brett
on
Dec 13, 2007 at 8:59:59 am
This is probably a simple question, but I'm new to Flash, so I'm struggling with it.
I have an SWF (that I made in After Effects). It's 18 frames long. The first 8 frames are a transition (from one colour square to another) and the last 10 frames conatin a simple animation (a ball bouncing, withing the coloured square).
What i would like to do is have the first 8 frames play when the mouse rolls over, then last 10 frames play when the mouse clicks on the square.
Is this possible? I am using Flash CS3 on a mac. Any help would be greatly appriciated (and if it could be put in simple terms, that'd be better)!
Re: mouseover, then click by Chris Lupetti on Dec 13, 2007 at 2:08:11 pm
Hi Joe,
I would make this an Movie Clip. Name the movie clip and give it an instance name. I prefer giving the MC (Movie Clip) the same name as the Instance name. Let's call it Button1 You give it the instance name in the properties panel. In order for it to have an instance name it must be on your stage. Therefore, drag it from the Library to your stage.
Doubleclick on the Movie Clip to go into it.
Put a stop(); ActionScript at the beginning of the MC. Next, put a label that says playOne where you want the animation to start playing on the roll over. Before playOne put a stop(); ActionScript. Start the animation in the next keyframe after the stop(); Action. You give the label name almost anything you want. I'm just using this as an example. Make sure you are case sensitive. For the mouseclick give a label called playTwo. Right before the playTwo label put a stop(); action. Therefore, the playTwo will be right after the stop();. Make the animation start right after the stop(); just like the playTwo label. They will be on the same number keyframe.
Create an invisible button. This means creating a button that will overlap the MC. Once in the button just fill in the last keyframe within the button. You will know it's an invisible button if it has an almost transparent blue box. If you can see the button then it's not an invisible button. Make sure the button is only in the HIT STATE within the button keyframe. Call the Invisible Button invButton. Remember to keep everything case-sensitive.
Put the invisible button over your MC. User another layer. Give the invisible button an instance name. (Make sure it's a Button and not a Graphic or Movie Clip).
Once the Invisible Button is over the MC give the invisible button this actionscript:
********
on (rollOver) {
this.button1.gotoAndPlay("playOne");
}
on (press) {
this.button1.gotoAndPlay("playTwo");
}
Re: mouseover, then click by Josef Brett on Dec 14, 2007 at 9:50:14 am
Hi.
I gave that a try and I couldn't figure it out. I couldn't make an invisible button, I wasn't sure which frames I was mean to put the playOne and playTwo Actionscript on and I kept getting an error message that read something along the lines of 'couldn't access unidentified object playOne'.
Sorry, I'm a bit thick with this...
Don't worry too much about it though, I'm fairly happy to settle with what I've got.
Re: mouseover, then click by Chris Lupetti on Dec 14, 2007 at 10:37:56 am
Good morning Josef Brett,
No problem. It takes practice.
To make an invisible button create a shape to the size you want. Then press f8. Choose the button option. Once you're inside the button just have the shape visible on the last keyframe and not the first three. The last keyframe is the hit state. That's where you want the shape to be. That is an invisible button.