A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11336 Flash Movies | 2 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Surjit Dhami
» Title: Book
» Description: Book
» More by Surjit Dhami


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 5848 Flash Sites | 0 New Flash Links
What's New | Top 100 Flash Site

Featured Site

» Posted in the Flash Kit Links section
» Title: All-American Rejects
» Description: Get to know this great band by exploring their "practice room".


Random Links | Add your own Flash Related Links
Flash Tutorials 1277 Tutorials 7 New Tutorials Added!
What's New | Top100

» Create xml slideshow with free template
» How to Insert a Multilingual Subtitle Into Your Flash Video Studio
» How to Create Cool Halloween Slideshow
» Debugging flash using the Firebug console
» Create Flash Slideshow on Blogger
» FLASH TRICKS IN WEB ADVERTISING: FLASH BANNERS
» HTML Photo Gallery Tutorial
» Create your first flash site – PART 1
» How to Make a Flash Photo Gallery
» Unknown Tag: Title10
Random Tutorial | Add Site

Trading Customer Accounting (IL)
Next Step Systems
US-IL-Chicago

Justtechjobs.com Post A Job | Post A Resume


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Categories Make your own scroll bar in Flash MX
Author: Vera Fleischer | Website: http://www.mediasparkles.com |

 
Page 2
«prev 1 2 3 4 5 6 next»

The text field and scroll track

Open a new file in MX.

At the root level of Scene 1 add two extra layers to make it a total of three. Name the top layer "functions", the one below it "actions" and the bottom one "movie clip" or whatever else fits your purposes. We'll add the code later.

Create a dynamic text field in the bottom layer. Use a font, color, and size of your choice and drag it out to display a maximum of about 5 or 6 lines or however many you like. For this example, we will use a maximum of 6 lines that can be displayed at the same time. Make sure that "multiline" is selected and that "selectable" is not selected in the text properties. Give the text field an instance name of "w_field" (short for "window field" in my example). Don't worry about assigning a variable name. Lastly, click on "Character..." and select whichever character sets you would like to include.

For the main movie clip that contains everything else, select the text field and press F8 to convert it to a symbol. Choose movie clip for the behavior, name the symbol "main_mc" and give it an instance name "main". Now go into main_mc and rename the layer with the text field "text" and add a few more layers from top to bottom: "labels", "actions", "functions", "scroll thumb", "scroll buttons", and "scroll track". Once we add these graphics, well put them in their respective layers. If you want to include any other graphics, such as a window, add layers for those elements too.
Add two frames to each layer of this movie clip. Label the first frame "no_scroll", the second one "scroll_loop", and the third frame doesn't need a label. In the second frame of the "scroll thumb", "scroll buttons", and "scroll track" layers, add a keyframe each.



For the scroll track, go to the second frame of the "scroll track" layer. Draw a rectangle of the width you want your scroll bar to be, and make sure that its height is about the same as your dynamic text field. Line it up just to the right of your text field. Convert it to a movie clip symbol and assign it an instance name of "scroll_track".

We'll also add some code to this movie clip. In the actions layer of the first frame, just put

stop();
In the second ("scroll_loop") frame, put
play();
We'll add a little more to this later. And in the last frame put
gotoAndPlay("scroll_loop");
Now go back to the root level one more time, and we'll add some code there. In the functions layer, put the following:

function showText(message) {
 main.w_field.text = message;
 if (main.w_field.maxscroll > main.w_field.scroll) {
 main.gotoAndPlay("scroll_loop");
 }
}
And in the actions layer, put this code:
my_text = "Put lots of text here, or the scroll bar won't show up!";
showText(my_text);
stop();
We're setting this up in a way that the scroll bar is only visible when the text field has more lines than can be diplayed at one time.

«prev 1 2 3 4 5 6 next»

» Level Advanced

Added: : 2002-03-23
Rating: 7.21 Votes: 116
Hits: 3771
» Author
I have been flashing for almost two years, first at an online learning company and now at a university. My dream is to one day work for Macromedia as an ActionScript Engineer!
» Download
Download the files used in this tutorial.
Download (68 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments
 
   
 

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs