View Single Post
  #1 (permalink)  
Old March 21st, 2008, 08:29 PM
132591 132591 is offline
Authorized User
 
Join Date: Sep 2006
Location: , , .
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default timeline immune variables

Ok, so I am creating a flash program where I can put these little reds dot movie clips at the mouse coordinates. I have 3 dots and want to be able to move them all. (first dot number 1, then 2, then 3, then 1 again.)

So I have a variable that determines what dot number I am moving, however each time a the animation of 3 frames finishes, the variable resets, and I can only move 1 dot. How do I make the dot_num variable timeline immune?

Code:
var coord_text = xmouse + ", " + ymouse;

var xmouse = (Math.round(_root._xmouse / 4));
var ymouse = (Math.round(_root._ymouse / 4));

var coord_text = xmouse + ", " + ymouse;

var mouseListener:Object = new Object();

mouseListener.onMouseMove = function(){
    coords_text.text = coord_text;
}

var dot_num = 1;

mouseListener.onMouseDown = function(){


    if(dot_num == 1){
        dot1._x = xmouse * 4;
        dot1._y = ymouse * 4;

        dot_num = 2;
    } else if (dot_num == 2){
        dot2._x = xmouse * 4;
        dot2._y = ymouse * 4;

        dot_num = 3;
    } else if (dot_num == 3){
        dot3._x = xmouse * 4;
        dot3._y = ymouse * 4;

        dot_num = 1;
    }
}

clear_btn.onRelease = function(){
    dot1._x = -300;
    dot2._x = -300;
    dot3._x = -300;
}

Mouse.addListener(mouseListener);

gotoAndPlay(1);
"Judge a man by his questions, not by his answers."
-Voltaire
__________________
\"Judge a man by his questions, not by his answers.\"
-Voltaire
Reply With Quote