Internet Cross Logo
Internet Cross your one stop web tutorial website

Scroll Component

by Anand

This tutorial will show you how to use Flash MX Default Scroll Component.

Let's start.


1. Create a dynamic text field with Var name "txt". Insert it into movie clip with instance name "mc1"(this movie clip will make scroll effect).

 
2. Then insert movie clip "mc1" in new movie clip "mc2"(instance name).

3. Drag ScrollBar Component from component panel on the right side of the stage. Give name "com" in the property inspector.

4. Creat a new layer with name "action". Select the key frame, then open action panel and enter action given below.

mc2.mc1.txt="Welcome to Flash Triangle the one stop Flash resource. Flash Triangle Flash Tuorial, Flash Components and more vasdfasdfas asdf dfvasd adfadf ads fa sdf adf asd fa afdbadgg",
com.setScrollTarget("mc2.mc1");
com.setScrollProperties(5, -50, 100);
com.setScrollPosition(20);
com.setChangeHandler("change");
function change(){
mc2.mc1._y=-com.getScrollPosition();
}

 

 

Description:


mc2.mc1.txt="enter text here"    -      You can enter text in the double quotes.

com.setScrollTarget("mc2.mc1");   -  This action set the target movie clip (mc1) for scrolling.

com.setScrollProperties(5, -50, 100);  -  Value 5 represents page size, -50 represents minimum position of movie clip (mc1) w.r.t component(com), 100 represents maximum position w.r.t. component(com) position

com.setScrollPosition(20);   -   This property scrolls the target (mc1) w.r.t line.

com.setChangeHandler("change"); - This action is change handler for scroll component(com). This will call the function(change) every time the bar changes.

function change(){
mc2.mc1._y=-com.getScrollPosition();
}
-  This function is called when scroll bar changes its position. And this make a change in the position of target movie clip(mc1)


[Page 1]
Visit our forums to discuss / post your problems.