Calculating a scroll percent


show more Calculating a scroll percent provides you with in-depth training on Web. Taught by Todd Perkins as part of the Flash CS3 Professional Beyond the Basics show less
please wait ...

Calculating a scroll percent

In order to connect our scrollbar to a text field, we need to get something called a scroll percent. And by scroll percent I mean the percentage that the scrollbar is scrolled down. With that value we can then move our text field. The file that I'm working in is called 03_Scroll_Percent.fla in the Chapter 04 folder in the Exercise Files folder. Let's select the first keyframe of the actions layer and open the Actions panel by pressing Option+F9 on the Mac, or F9 on the PC. At the very top of your code, below the other two variables that were already created, create a new variable called scrollPercent, capital P. The data type of this variable will be a Number and we'll set the initial value to 0. At the bottom of the dragScroller function, below all the rest of the code inside of that function, type stage.addEventListener.

The event will be an Event.ENTER_FRAME, all caps. And we'll run a function called a setScrollPercent. So once you start dragging the scrollbar it will...

Calculating a scroll percent
Video duration: 5m 20s 5h 21m Intermediate

Viewers:

Calculating a scroll percent provides you with in-depth training on Web. Taught by Todd Perkins as part of the Flash CS3 Professional Beyond the Basics

Subject:
Web
Software:
Flash Professional
Author:
please wait ...