ActionScript2:Controlling a Scrolling text box

From virtualMV2015wiki
Jump to: navigation, search
 Home  Flash10 (CS4), Flash11 (CS5) <

Introduction

Unfortunately, The UIScrollBox does not appear to consistently work. So here is an alternative way to control a scrolling text box.

Scrolling Text box using buttons and ActionScript2


Icon Objective.png

Objective

By the end of this exercises you should be able to:

  • Add some buttons and use ActionScript 2 to control the scrolling

Tutorial

1. Create a scrolling text box (as shown in the Text scroll box example but don't add the UIScrollBar ). For the Text box make the instance Name TextScroll.

2. Add an up button and a down button (Adding buttons)

3. To the up button add

on (press) {TextScroll.scroll -= 1;
}

4. To the down button add

on (press) {TextScroll.scroll += 1;
}


Icon Example.png

Example

Extensions

1. Change the ActionScript to on (rollOver). What happens?

2. Can you get the scrolling text box so that when you rollover a button it continues to scroll? -- if you have a solution put it here and I will add an answer page :)

3. Can you implement a solution where the scrolling occurs relative to the position in the scroll box (i.e. Stops in the middle, goes up faster as you move to the top, and down faster as you move to the bottom. -- if you have a solution put it here and I will add an answer page :)


Icon References.png References


ActionScript2:Controlling a Scrolling text box. (2017). In virtualMV's ( Michael Verhaart ) wiki. Retrieved December 13, 2017, from http://www.virtualmv.com/wiki/index.php?title=ActionScript2%3AControlling_a_Scrolling_text_box    (zotero)