Wrox Programmer Forums
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Flash (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 21st, 2008, 08:29 PM
Authorized User
 
Join Date: Sep 2006
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





Similar Threads
Thread Thread Starter Forum Replies Last Post
variables daniel.mihalcea Javascript 1 September 9th, 2008 07:06 PM
using variables webgrphx Classic ASP Basics 3 April 11th, 2007 06:46 PM
Visio Timeline deepalikd Forum and Wrox.com Feedback 0 May 30th, 2005 02:06 AM
Global variables ps124 ASP.NET 1.0 and 1.1 Basics 6 April 6th, 2004 02:48 PM





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