You need to keep track of the previous x value and compare that to the
new x value. The simplest way to achieve this is an onEnterFrame
function (although note this is the least efficient way).

For example try putting a movie clip called "ball_mc" on your stage and
add this code to the first frame, run it and try dragging the movie clip
around.

var oldX:Number = ball_mc._x;

onEnterFrame = function(){
        if(ball_mc._x > oldX){
                trace("is moving right");
        } else if (ball_mc._x < oldX){
                trace("is moving left");
        } else {
                trace("not moving along x axis");
        }
        oldX = ball_mc._x;
}


ball_mc.onPress = startDrag;
ball_mc.onRelease = stopDrag;

Hope that helps!
-Dan

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gustavo
Duenas
Sent: Friday, February 16, 2007 11:42 AM
To: Flashcoders mailing list
Subject: [Flashcoders] (no subject)

hi, I'm doing something pretty simple, I have a movie clipo which 
starts drag, I'd like to move this in the x axis, but I don't know 
how to program this to launch an event if the x axis is positive and 
other is the x axis is negative,
or simpler how can I trigger an event is the movie clip is moving 
right and trigger other event is the movieClip is moving left....
any ideas?


so far I'm using this.


var xright = this._x+1;
var xleft = this._x-1;

if (this._x==xright){
launching
}
if(this._x==xleft){
launching2
}





Gustavo Duenas

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

This e-mail and its attachments are intended only for the use of the 
addressee(s) and may contain privileged, confidential or proprietary 
information. If you are not the intended recipient, or the employee or agent 
responsible for delivering the message to the intended recipient, you are 
hereby notified that any dissemination, distribution, displaying, copying, or 
use of this information is strictly prohibited. If you have received this 
communication in error, please inform the sender immediately and delete and 
destroy any record of this message. Thank you.
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to