LiveMotionCentral - A Resource Site for Adobe LiveMotion
Tutorial


 Getting Started
 Animation
 Optimization
 Interactivity
 Sound
 Physics
 Dynamic Content
 Player Scripting
 App. Scripting
 Additional Utilities

 LiveMotion™ 1

 Add a Tutorial

more »

Latest News

 LiveMotion 2
 GoLive 6
 Interviews
 News Letter
more »
Loading Dynamic Text Part II LiveMotion 2 Difficulty: Beginner Download
  By: Jon Thompson Email: phxnow@cox.net URL: www.phxnow.com 03.09.2002  
 


Part II in a Two part series, here we show you how to make your text scroll. No matter how much text you add to your text box, our scroller will work just perfectly!

 

   
 

Loading Dynamic Text Part II

In Part I of this two part tutorial, we learned how to setup a Text Field to receive text from a text file on your server or hard drive. Now you may be asking, what if I have TONS of text I want to put in my new text box, how do I scroll it? Well, with a few buttons, and a few lines of code in each button, you will be scrolling your text like a duck in water.

Part I

Lets open up the LIV file that we were working on before, this will save us some setup time. Remember the file name? It was textLoader.liv. If you don't have it, just download the one we made from the last tutorial. Now because I was not thinking a head, we have to resize our composition to make room for our scroll buttons. You can do this by clicking on Edit -> Composition Settings.

You should be presented with the composition settings and it will look like it does below.

Now we need to chang ethe Width to give us a little room. 230 should be more then enough room, so udpate your width and click on ok. You should now see that your composition is resized, you may need to resize your window to see the entire composition.

Now, we need to draw some buttons, you can also use the buttons that I have included in this tutorial. Infact, they will contain the code needed to scroll your text field! Now how simple is that!

So, when you have completed drawing your up and down arrow buttons, you need to convert them to Movie Clip Group's. Convert each button to a Movie Clip Group, and make the scroll up buttons name up and make the down buttons name down, and give each of them a down state from your States Palette.

Now, select both buttons, and CUT them. Now double click on the textMCG to open it up and select the Dynamic Text [var = myText] Object. Now paste the buttons into the Movie Clip Group.

You will now see three objects in your textMCG. 1. Dynamic Text [var = myText], 2. down, 3. up.

Part II

Now we are going to add the code needed in each button, to make your text scroll!!! We could do this several ways, but we are going to do this in a way that resembers doing it in LM1. I will explain another way to do this when we have finished the tutorial.

Select your scroll button that says down and select its down state. In your timeline window, click on the Loop Movie Clip icon to make our buttons timeline loop in the down state. Now double click on the down object in your timeline to open it up. In the very first frame, we are going to add a new script to the timeline. To do this, click on the Script Icon to add a new script to frame 00. This will open your script window where you can copy and paste the following code.

if(_root.textMCG.myText.scroll < _root.textMCG.myText.maxscroll){
    _root.textMCG.myText.scroll ++;
}

Now, I know your wondering what this code is saying exactly. It says, If the myText variable's value is less then the myText variables maxscroll, scroll one line. Scroll will return the current scroll position of your text box, maxscroll figures out how many lines you have in your text box. So if you have 10 lines of text, and you are at line 1, when the person presses the scroll button, it will scroll a line of text. and because we have the Loop turned on, the user wont have to push the down button for every line of text. They can simply hold the mouse button down and the text will scroll non stop. Now close the sript editor and click on the back arrow on the Movie Clip Menu.

Now select the up button, and do exactly as above, but use the below code for its down state.

if(_root.textMCG.myText.scroll > 1){
    _root.textMCG.myText.scroll --;
}

As you can see, this bit of code is much smaller. Remember the "scroll" returns the current position number for the text box. So, all we are saying here is; ifmyText's scroll position is greater then 1 line of text, scroll backwards one. Thats it!!! Simple save and export your composition after you have positioned your scroll buttons to where you want them and your ready to go! Just don't scroll around too much!

Copyright © 2002 LiveMotionCentral.com, All Rights Reserved RESOURCES  |  NEWS  |  SUBMIT  |  ABOUT  |  HOME
LiveMotionCentral.com is in no way affiliated with Adobe Systems Incorporated

Adobe, After Effects, AlterCast, Atmosphere, Design Team, GoLive, Illustrator, LiveMotion, Photoshop and SVG Viewer are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries.
Visit Adobe Systems Incorporated to learn more.

Visit Adobe.com