Selteco.com > FlashDesignerZONE.com > Tutorials > T1037

Create automatic scroller.

The text will scroll when you move the mouse over the arrows.

Follow the steps below:

  1. Launch Flash Designer and create a blank document.
  2. Set the frame delay to "Stop" ("Frame" > "Frame Delay").
  3. Size the frame at about 300x200 ("Frame" > "Frame Size").
  4. Create a new dynamic text paragraph and enter a very long text with many line breaks.

  5. Choose "Item" > "Placement Properties" and make sure the item name is "HTMLText1" and "ActionScript Target" is checked. Rename it if necessary. Click OK.

  6. Choose "Insert" > "Navigation", select "Down" and click OK to insert down button. Repeat the same an insert "Up" button.

  7. Position both triangles at the right

Next define ActionScript code:

  1. Choose Frame > ActionScript and enter:

    function scrl()
    {
    	HTMLText1.scroll=HTMLText1.scroll+scrolldelta;
    }
    
    setInterval(scrl,100);
    
    //setinterval runs the "scrl" function every 100 milliseconds
    //scrl function adjusts txt.scroll by the value of "scrolldelta"
    //the variable "scrolldelta" will be 1,-1, or 0 
    
    
  2. Select up arrow, choose "Action" > "OnOver" and enter the following ActionScript code:

    scrolldelta=-1;

  3. Choose "Action" > "OnOut" and enter the following ActionScript code:

    scrolldelta=0;

  4. Select down arrow, choose "Action" > "OnOver" and enter the following ActionScript code:

    scrolldelta=1;

  5. Choose "Action" > "OnOut" and enter the following ActionScript code:

    scrolldelta=0;

Hit F9 to play the file.

OnOver and OnOut actions are executed on mouse events. scrl function executes every 50 miliseconds. To speed up scrolling decrease the delay to 30 or less miliseconds.

Download source project t1037.zip

Products | Purchase | Downloads | Support | Flash Tutorials | Contact
Copyright © 1999-2017 Selteco Software, Inc. www.selteco.com, ph: +1 810 377 5778