[Flashcoders] problem moving an object

2007-01-26 Thread Gustavo Duenas

hi, this is code:



this.onEnterFrame = function(){
if (this.myLoader._x eq this.myLoader._x-1){
delete onEnterFrame;

}
else{ this.myLoader._x-=2;
}
}


I'm trying to move this loader created by code and it looks ok, it  
moves, but it doesn't stop,

I hope you might know what I'm doing wrong, you are my last resource.


Regards


Gustavo Duenas




___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] problem moving an object

2007-01-26 Thread eka

Hello :)

1 - eq keyword is depreciated !! don't use eq but the == operator :)

if ( x == 2)
{
   // do it
}

2 - to move a movieclip, a simple example :

// the speed of the move
var speed = 10 ;

// the max x position
var xMax = 500 ;

mc.onEnterFrame = function()
{
 this._x += speed ;
 if ( mc._x   xMax )
 {
   delete this.onEnterFrame ;
 }
}

3 - better solution if you use the Tween class (exist in FlashMX2004 and
Flash8 with a FP7 or FP8 compiler in AS2), you can find this class in the
documentation of flash 8 in the reference of the components. Example :

import mx.transitions.Tween ;
import mx.transitions.easing.* ;

var tw:Tween = new Tween( mc , _x, Elastic.easeOut, mc._x , 500 , 24 ) :
tw.stop() ;

mc.onPress = function
{
   tw.start() ;
}

You can use the Elastic, Bounce, Back, Expo, etc.. class to launch the
interpolation with a custom easing effect :)

The tween class is the work of robertpenner : http://www.robertpenner.com

EKA+ :)

2007/1/26, Gustavo Duenas [EMAIL PROTECTED]:


hi, this is code:



this.onEnterFrame = function(){
if (this.myLoader._x eq this.myLoader._x-1){
delete onEnterFrame;

}
else{ this.myLoader._x-=2;
}
}


I'm trying to move this loader created by code and it looks ok, it
moves, but it doesn't stop,
I hope you might know what I'm doing wrong, you are my last resource.


Regards


Gustavo Duenas




___
Flashcoders@chattyfig.figleaf.com
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


___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] problem moving an object

2007-01-26 Thread Andy Herrman

I'm pretty sure this line:
if (this.myLoader._x eq this.myLoader._x-1){

will never resolve to true, given that no number is equal to the same
number minus one.  Thus, the code in that if statement will never
trigger.

Should one of those this.myLoader values be a different variable?

  -Andy

On 1/26/07, Gustavo Duenas [EMAIL PROTECTED] wrote:

hi, this is code:



this.onEnterFrame = function(){
if (this.myLoader._x eq this.myLoader._x-1){
delete onEnterFrame;

}
else{ this.myLoader._x-=2;
}
}


I'm trying to move this loader created by code and it looks ok, it
moves, but it doesn't stop,
I hope you might know what I'm doing wrong, you are my last resource.


Regards


Gustavo Duenas




___
Flashcoders@chattyfig.figleaf.com
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


___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] problem moving an object

2007-01-26 Thread Gustavo Duenas

Thanks for your help guys, It worksregards


Gustavo

___
Flashcoders@chattyfig.figleaf.com
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