Working With Text And Strings - MACROMEDIA FLASH 8-LEARNING FLASH LITE 1.X ACTIONSCRIPT Manual

Learning flash lite 1.x actionscript
Table of Contents

Advertisement

In addition to letting you reference existing variables, you can also use the
the left side of a variable assignment to create variables at runtime. For example, suppose you
want to maintain a list of high scores as a user plays a game. Each time the user completes a
turn, you add their score to the list:
eval("highScore" add scoreIndex) = currentScore;
scoreIndex++;
Each time this code executes, it adds a new item to the list of high scores and then increments
the
variable, which determines each item's index in the list. For instance, you
scoreIndex
might end up with the following variables:
highScore1 = 2000
highScore2 = 1500
highScore3 = 3000

Working with text and strings

Flash Lite provides some basic ActionScript commands and properties for working with text.
You can get and set the values of text fields, concatenate strings, URL-encode or URL-decode
text strings, and create scrolling text fields.
This section contains the following topics:
"Concatenating strings" on page 12
"Scrolling text" on page 12
Concatenating strings
To concatenate strings in Flash Lite, you use the
shows:
city = "Boston";
team = "Red Sox";
fullName = city add " " add team;
// Result:
// fullName = "Boston Red Sox"
Scrolling text
You can use the
scroll
current scroll position. You can also use the
current scroll position relative to the maximum scroll position. For an example of how to
create a scrolling text field, see "Creating scrolling text (Flash Professional Only)" in
Developing Flash Lite Applications.
12
Flash 4 ActionScript Primer
property of dynamic and input text fields to get or set the field's
maxscroll
operator, as the following example
add
position to determine a text field's
function on
eval()

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash 8

Table of Contents