Old 26-06-2007, 16:08   #1 (permalink)
jwalker80
Registered User
 
jwalker80's Avatar
 
Join Date: Dec 2005
Location: Dublin, Ireland
Posts: 91
x position

Hey,

Simple bit of actionscript needed...

I am moving a movieclip with this code:

Code:
onClipEvent(enterFrame) { speed = 1; this._x += speed; }

i want to say if this object goes off the screen bring it back to the beginning so that it loops

so e.g.... if (x position is 400) set back to -40

whats the correct syntax for this??
  Reply With Quote
Old 27-06-2007, 09:55   #2 (permalink)
jwalker80
Registered User
 
jwalker80's Avatar
 
Join Date: Dec 2005
Location: Dublin, Ireland
Posts: 91
i got it, this is what i was trying to do

oh such the novice

Code:
onClipEvent(enterFrame) { onscreen = true; if (this._x >= 390) { onscreen = false; } if (onscreen == true) { speed = 1; this._x += speed; } else if (onscreen == false) { this._x = -30; onscreen = true; } }
  Reply With Quote
Old 28-06-2007, 12:35   #3 (permalink)
dan
Iris Folder
 
dan's Avatar
 
Join Date: Apr 2003
Location: smokey
Posts: 2,676
or more briefly...

Code:
onClipEvent(enterFrame) { if (this._x <= 390) { speed = 1; this._x += speed; }else{ this._x = -30; } }
  Reply With Quote
Old 28-06-2007, 13:44   #4 (permalink)
John Good
+
 
John Good's Avatar
 
Join Date: May 2005
Location: Tropical Networks
Posts: 1,422
onClipEvent(enterFrame) {
this._x = this._x <= 390 ? this._x+1 : 30;
}
__________________
Fonts are like cologne: A bad choice speaks louder than a good one. Justin Feinstein
  Reply With Quote
Old 29-06-2007, 11:06   #5 (permalink)
dan
Iris Folder
 
dan's Avatar
 
Join Date: Apr 2003
Location: smokey
Posts: 2,676
Indeed
  Reply With Quote
Old 02-07-2007, 05:06   #6 (permalink)
jwalker80
Registered User
 
jwalker80's Avatar
 
Join Date: Dec 2005
Location: Dublin, Ireland
Posts: 91
nice!
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8