p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Flash (all versions) (http://p2p.wrox.com/forumdisplay.php?f=59)
-   -   timeline immune variables (http://p2p.wrox.com/showthread.php?t=66813)

132591 March 21st, 2008 08:29 PM

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


All times are GMT -4. The time now is 10:50 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.