PDA

View Full Version : Flickering Movie Clip Link


ori_ori
01-21-2009, 08:48 AM
Hello!

I hope you can help me with this.. I created a movieclip that has 2 keyframes that loop so that it creates a somewhat "flickering" (on/off) effect. [keyframe 1 = on/ keyframe 2 = off]

Now what I wanted to do was for the flickering effect to:
1) stop at frame 1 when I rollover the mouse on it.
2) resume playing after I rollout the mouse on it.

I tried writing "gotoAndStop(1)" but it still continued flickering.
__________________________________________________ _________
here's how my code looks so far:

mc_HERE.addEventListener(MouseEvent.ROLL_OVER, rollOver);
mc_HERE.addEventListener(MouseEvent.ROLL_OUT, rollOut);

function rollOver(e:MouseEvent):void{
gotoAndStop(1);
};
function rollOut(e:MouseEvent):void{
gotoAndPlay(1);
}
__________________________________________________ __________
Now the problem was:

1) when I rollover, it doesn't seem to stop at the said frame. (it continues "flickering")
2) when I rollout, sometimes it disappears (I guess it activated and stayed at keyframe 2) and won't continue flickering anymore until I rollover on it again.


This is so weird. Can you please tell me what's wrong with my code?:confused:

Thanks in advance guys for your help!


** ori_ori **

RefreshGFX
01-21-2009, 05:13 PM
Hey. I haven't done AS 3.0 (yet). But, maybe AS 3.0 isn't all that different from 2.0 in requiring which mc to "gotoAndStop". Meaning in AS 2.0 I would put ... mc_HERE.gotoAndStop(1); // otherwise would it know which mc to stop?

Ooh and alternatively instead of gotoAndStop couldn't you just use ....

mc_HERE.stop(); // to stop the animation on Mouse Over
- and -
mc_HERE.play(); // to start the animation on Mouse Out

Let me know if any of those help. (I'm interested ... like I said - I'm interested in learning AS 3.0)

ori_ori
01-21-2009, 06:47 PM
Hi there!

I tried your suggestions.. and here's how it turned out:
__________________________________________________ _____
mc_HERE.addEventListener(MouseEvent.ROLL_OVER, rollOver);
mc_HERE.addEventListener(MouseEvent.ROLL_OUT, rollOut);

function rollOver(e:MouseEvent):void{
mc_HERE.gotoAndStop(1);
};
function rollOut(e:MouseEvent):void{
mc_HERE.play();
}
__________________________________________________ _____
No luck... It still behaved the same way as it did from before as I mentioned
on my previous post.

I believe the problem with just stating "stop" is that when the user hovers
during the "off" keyframe, it would stay off and would not be visible.

But really... thanks for your suggestions! I'm quite a complete flash noob right now and still also grasping AS3 myself :p

svenjoypro
01-21-2009, 09:13 PM
May I suggest naming the instance of the movie clip. You have a movie clip maybe named mc_HERE, but you have to name the instance of it. Click on your movie clip and in the properties bar at the top it says "<Instance Name>" just type "mc_HERE" and it should work

RefreshGFX
01-22-2009, 06:05 PM
Maybe we're going about this too complicated ... just add a third frame to your mc_Here movie-clip. Then is it possible in AS 3.0 to add actions directly inside of mc_Here? I thought I heard that wasn't allowed anymore in AS 3.0 (which would make a movie-clip nothing more than a graphic). So, hopefully I misread that.

Anyway, if you still can add actions directly into movie-clips in AS 3.0 then you could...

1. Add a third frame to the mc_Here movie-clip (which would be your static "NON-Flickering" button)
2. Add a new layer to mc_Here call it "actions"
3. On frame 2 of the actions layer put "gotoAndPlay(1);"
4. On frame 3 of the actions layer put "stop();"

Then your button code would be:

function rollOver(e:MouseEvent):void{
mc_Here.gotoAndPlay(1); // which would start the loop between frames 1 & 2 of mc_Here
};
function rollOut(e:MouseEvent):void{
gotoAndPlay(3); // which would send the playhead to the static frame of mc_Here.

This is why - I'm not looking forward to learning AS 3.0 -- cause in AS 2.0 what you're trying to do would take all of 5-10 minutes. I think in AS 3.0 it said you can't add code directly to movie-clips (but, hopefully - you can still add AS in the movie-clip timeline .. cause that would really stink if I can't do that anymore).

Anyway, let me know if any of that works for you.
}