1. Home
  2. Computing & Technology
  3. Animation

Animating with ActionScripts

By , About.com Guide

7 of 7

Lastly, we need to tell Flash what to do in all other existing conditions that don’t satisfy the if statement (in this case, in any point where this._x is greater than 625). To do this, add a new else statement below and outside of the if statement, but still nested inside the onClipEvent(enterFrame):

onClipEvent (load){
this._x = 10;
}
onClipEvent (enterFrame) {
if (this._x<=625)
this._x = this._x+5;
}
else {
this._x = 10;
}
}

What that tells Flash is that in all other conditions, when this._x is not less than or equal to 625, then this._x needs to return to x coordinate 10, taking the movie clip symbol back where it started.

You can see mine sliding across the screen here.

Explore Animation
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. Animating with ActionScripts

©2009 About.com, a part of The New York Times Company.

All rights reserved.