Scroll text anywhere on stage using the AS

Date: 24.11.2008, 12:52    Total views: 19098

In this simple Action Script tutorial, I will teach you how to scroll text anywhere on flash stage using the arrows key on the keyboard. You will also learn how to convert any text into a Movie Clip Symbol, how to apply action script code on it, how to type action script code in action sript panel and much more!




Click once on photo using the Selection Tool (V) and scroll text using the Arrows key on the keyboard!




Step 1

Create a new flash document. Press Ctrl+J key on the keyboard (Document Properties) and set your Flash movie's frame rate to 24 and click ok.





Step 2


Take the Text Tool (T) and type any the on flash stage!

Step 3

While the text is still selected, press F8 key (Convert to Symbol) to convert this text into a Movie Clip Symbol. (Note: Registration must be set up in the midst!) See the picture below!



Step 4

Double-click now on the movie clip on stage with the Selection tool(V). You should now be inside the Movie Clip.



Step 5

Now, press F6 key (Keyframe) four times. See the picture below!



Step 6

Go back now on the first frame and open the Action Script Panel (F9). Then, enter this code inside the actions panel:

stop();

Do the same for everyone else's frame

Step 7

Go back now on the main stage (Scene 1)



Step 8

Take now the Selection TOol (V) and click once on text to select it. Then, go again to the AS Panel (F9) and enter this code inside the actions panel:

onClipEvent (load) {
 speed = 10;
}

onClipEvent (enterFrame) {
 if (Key.isDown(Key.RIGHT)) {
  this.gotoAndStop(2);
  this._x += speed;
 } else if (Key.isDown(Key.LEFT)) {
  this.gotoAndStop(4);
  this._x -= speed;
 }

 if (Key.isDown(Key.UP)) {
  this.gotoAndStop(1);
  this._y -= speed;
 }

 if (Key.isDown(Key.DOWN)) {
  this.gotoAndStop(3);
  this._y += speed;
 }
}

That's it!

Test Your Movie (Ctrl+Enter)!

Have a nice day!

Download source file (.fla)

  Digg it! Add this tutorial to del.icio.us! Furl it! Add this tutorial to reddit! Spurl it! Add this tutorial to technorati!
Share
ShareSidebar