ButtonMC qustion for da scripterz

Ok, I know I posted something like this the other day, but I figured out the solution. Now I have a question that experienced scripters might be able to answer for me.

When the mouse rolls onto the clip, the animation plays. When it rolls off, it plays. However, if the user moves off before either animation is finished, the results are less than desireable. I’m thinking I need some sort of test or anything like that. I’ve thrown up the .fla and if anyone can help me out, many thanks to you :slight_smile:

peace

ayanami

You can use hitTest, I modified your button using hitTest, I hope that’s what you’re looking for. =)

nay, eg, this makes more sense:

i hope you follow my drift:

on the button:

[AS]on(rollOver){
_root.turn = true;
}

on(rollOut, dragOut){
_root.turn = false;
}[/AS]

on frame one of the timeline:

[AS]fscommand (“fullscreen”, “false”);
fscommand (“allowscale”, “false”);
stop();

//dont use Hand Cursor
box.useHandCursor = false;

//handle the turn Function
box.onEnterFrame = function(){
if(turn){
this.nextFrame();
}else{
this.prevFrame();
}
};[/AS]

This is an If/Else statement that tells the movie clip box to advance to the next frame of the movie as long as the user’s cursor is on the box, then play in reverse as soon as the cursor is off of the box.

I think that mine is much simpler to understand.

Pick mine! Pick Mine! JK…

sorry here’s the .fla :

liam, hahah that’s the same thing as the hitTest I used, your method just requires more scripting.

Either way, they both work. :stuck_out_tongue:

yeah but for someone who is new to scripting it could be easier to understand than a hitTest…

liam: hitTest is more accurate than rollOver and rollOut, so TECHNICALLY the hitTest method is better, but it depends on the situation. It is good to know both methods.

nice, thanks EG. that’s exactly what I was looking for. hehe, when i was looking for a solution, i found a post you put up for someone else with similar coding and i modified it a bit. i got it working like 10 mins before i came back here. :slight_smile: thanks everyone

peace

ayanami

no problem, glad it worked for you. =)