View your Shopping CartFrequently Asked QuestionsEmail Us
Home | About Us | Contact Us
SmartWebby.com provides best web design & web programming services globally
We specialize in Rapid Web Design, ASP.net, ASP and PHP web programmingBest Web Design, Best Web Programming, Global Service Provider - Dependable Professionals to build your website right!

Text Scrollbars in Flash

Flash Tutorial to create Simple & Advanced Text Scrollers using Actionscript

This tutorial explains how to create simple and advanced scrollers for textboxes in Flash using Actionscript. When there is only a limited area for text in Flash, it sometimes becomes a necessity to have scrollers.

Macromedia Flash MX Professional 2004Tool(s) Required:

Software: Macromedia Flash MX or above
Recommended: Macromedia Flash MX Pro 2004


Simple Scrollers for Flash Textboxes

  1. In Flash, textboxes are of 3 types namely - Static, Dynamic & Input. The size of Dynamic/Input text varies depending on the source file/user input and hence may require the use of scrollers.
  2. Create a Dynamic textbox with Multiline property selected using the Properties panel, name the variable and the instance as 'addr' and 'scrtxt' respectively.
  3. Create 2 buttons for Upward and Downward scrolling and write the following Actionscript code:
  4. Upward Button
    on(press)
    {
    scrtxt.scroll=scrtxt.scroll-1;
    }

    Downward Button
    on(press)
    {
    scrtxt.scroll=scrtxt.scroll+1;
    }

  5. Save your work and test the Movie (Ctrl + Enter). That's it you have learnt how to create simple scrollers for textboxes in Flash using Actionscript.


Simple Scrollbars

Advanced Scrollers for Flash Textboxes

  1. Functions can be used to control the button's scrolling action to create a more advanced type of text scrolling as explained below.
  2. Write two Actionscript functions, scrup and scrdown for scrolling upwards and downwards as shown below:
  3. function scrup()
    {
    scrtxt.scroll=scrtxt.scroll-1;
    }

    function scrdown()
    {
    scrtxt.scroll=scrtxt.scroll+1;
    }

  4. Call these functions from the two Buttons using the following Actionscript code:
  5. Upward Button
    on(press)
    {
    upint=setInterval(scrup,100);
    }

    on(release)
    {
    clearInterval(upint);
    }

    Downward Button
    on(press)
    {
    downint=setInterval(scrdown,100);
    }

    on(release)
    {
    clearInterval(downint);
    }

  6. SetInterval is used to call a function after a certain period of time until it is cleared using the ClearInterval.
  7. Thus they help in creating scrollers that can scroll until the mouse is released as shown below.
  8. Save your work and test the Movie (Ctrl + Enter). That's it you have learnt how to create simple scrollers for textboxes in Flash using Actionscript.


Advanced Scrollbars using Mouse Press and Mouse Over Actions

Note: This is also applicable to Input text type. The rollOver and rollOut events of a Buttons can also be used to enable scrolling during mouseover events as shown above in the second swf.

Absolutely FREE Web Templates
Check out these quality free web templates and download them without any registration or sign-up!

FREE Web Design Guide
From web design tips & ideas to HTML, CSS Styles, Fireworks & Dreamweaver you'll find all you need to know about effective web site design right here!

Quality Dreamweaver Templates
Professional quality dreamweaver templates in over 20 categories, starting at just $9.95! Instant download & easy customization