Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > Flash (all versions)
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 21st, 2008, 08:29 PM
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
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 01:40 PM.


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