-
resetting variable with mouse events
I have three MCs and three buttons. The MCs have four frames each. I want the mouse overs to make each clip advance one frame to 2 and stay. If they click, I want it to go to frame 3. If they mouse out and then mouse over again, I want it to stay on frame 3. I wanted to use the following code to advance one frame only if it was the first mouse over.
this is my logic:
var starts at 0
mouse over sets it to 1 (++)
mouse out sets it back to 0 (= 0)
2nd mouse over sees that the var is 0, sets it back to 1
This is the code for one button...
var correct = 0;
var wronga =0;
var checka =0;
var wrongb =0;
var checkb =0;
correct_btn1.addEventListener(MouseEvent.MOUSE_OVE R, pop1);
function pop1(event: MouseEvent): void {
correct ++;
if (correct ==1){
correct_mc1.nextFrame();
}
}
correct_btn1.addEventListener(MouseEvent.MOUSE_DOW N, correct1);
function correct1(event: MouseEvent): void {
correct_mc1.nextFrame();
wrong_mc1.gotoAndStop(1);
wrong_mc2.gotoAndStop(1);
}
correct_btn1.addEventListener(MouseEvent.MOUSE_OUT , out1);
function out1(event: MouseEvent): void {
correct = 0;
checka = 0;
wronga = 0;
checkb = 0;
wrongb = 0;
}
Thanks in advance!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|