Detailed instructions for use are in the User's Guide.
[. . . ] Flash Lite 1. x ActionScript Language Reference
Trademarks 1 Step RoboPDF, ActiveEdit, ActiveTest, Authorware, Blue Sky Software, Blue Sky, Breeze, Breezo, Captivate, Central, ColdFusion, Contribute, Database Explorer, Director, Dreamweaver, Fireworks, Flash, FlashCast, FlashHelp, Flash Lite, FlashPaper, Flash Video Endocer, Flex, Flex Builder, Fontographer, FreeHand, Generator, HomeSite, JRun, MacRecorder, Macromedia, MXML, RoboEngine, RoboHelp, RoboInfo, RoboPDF, Roundtrip, Roundtrip HTML, Shockwave, SoundEdit, Studio MX, UltraDev, and WebHelp are either registered trademarks or trademarks of Macromedia, Inc. and may be registered in the United States or in other jurisdictions including internationally. Other product names, logos, designs, titles, words, or phrases mentioned within this publication may be trademarks, service marks, or trade names of Macromedia, Inc. or other entities and may be registered in certain jurisdictions including internationally. [. . . ] If the condition is true, Flash Lite runs the statements that follow the condition inside curly braces ({}). If the condition is false, Flash Lite skips the statements inside the curly braces and runs the statements following the braces. Use the if statement to create branching logic in your scripts.
Example
In the following example, the condition inside the parentheses evaluates the variable name to see if it has the literal value "Erica". If it does, the play() function runs.
if(name eq "Erica"){ play(); }
72
Flash Lite Statements
switch
Availability
Flash Lite 1. 0.
Usage
switch (expression){ caseClause: [defaultClause:] }
Parameters
expression caseClause
Any numeric expression.
A case keyword followed by an expression, a colon, and a group of statements to execute if the expression matches the switch expression parameter.
defaultClause
An optional default keyword followed by statements to execute if none of the case expressions match the switch expression parameter.
Description
Statement; creates a branching structure for ActionScript statements. Similar to the if statement, the switch statement tests a condition and executes statements if the condition evaluates to true. If no other statements are true, the default statement is executed.
switch
73
Example
In the following example, if the myNum parameter evaluates to 1, the trace() statement that follows case 1 executes; if the myNum parameter evaluates to 2, the trace() statement that follows case 2 executes; and so on. If no case expression matches the number parameter, the trace() statement that follows the default keyword executes.
switch (myNum) { case 1: trace ("case 1 tested true"); break; case 2: trace ("case 2 tested true"); break; case 3: trace ("case 3 tested true"); break; default: trace ("no case tested true") }
In the following example, the first case group doesn't contain a break, so if the number is 1, both A and B appear in the Output panel:
switch (myNum) { case 1: trace ("A"); case 2: trace ("B"); break; default: trace ("D") }
See also
case
while
Availability
Flash Lite 1. 0.
Usage
while(condition) { statement(s); }
74
Flash Lite Statements
Parameters
condition
The expression that is evaluated each time the while statement executes. The instructions to execute when the condition evaluates to true.
statement(s)
Description
Statement; tests an expression and runs a statement or series of statements repeatedly in a loop as long as the expression is true. Before the statement block is run, the condition is tested; if the test returns true, the statement block is run. If the condition is false, the statement block is skipped and the first statement after the while statement's statement block is executed. Looping is commonly used to perform an action when a counter variable is less than a specified value. At the end of each loop, the counter is incremented until the specified value is reached. Each repetition of steps 1 through 4 is called an iteration of the loop. If condition evaluates to true or a value that converts to the Boolean value true, such as a nonzero number, go to step 3. Otherwise, the while statement completes and execution resumes at the next statement after the while loop.
3. Go to step 1.
Example
The following example executes a loop as long as the value of the index variable i is less than 10:
i = 0; while(i < 10) { trace ("i = " add ++i);// Output: 1, 2, 3, 4, 5, 6, 7, 8, 9 }
See also
continue, do. . while, for
while
75
76
Flash Lite Statements
CHAPTER 4
Flash Lite Operators
This section describes the syntax and use of the Macromedia Flash Lite 1. x ActionScript operators. However, some operators are symbols and are alphabetized by their text descriptions. The operators in this section are summarized in the following table:
Operator
add (string concatenation) += (addition assignment) and = (assignment)
4
Description
Concatenates (combines) two or more strings. Assigns the value of expression2 (the operand on the right) to the variable or property in expression1. Any characters that appear between the opening comment tag (/*) and the closing comment tag (*/) are interpreted as a comment and ignored by the ActionScript interpreter. Evaluates expression1, then expression2, and returns the value of expression2. Any characters that appear between the comment delimiter (//) and the end-of-line character are interpreted as a comment and ignored by the ActionScript interpreter. [. . . ] 0: Supported.
fscommand2()
151
Example
The following statement resets the soft keys to their original settings:
status = fscommand2("ResetSoftKeys");
See also
SetSoftKeys
SetInputTextType
Availability
Flash Lite 1. 1.
Description
Specifies the mode in which the input text field should be opened:
Command Parameters Value returned
"SetInputTextType" variableName
0: Failure. type One of the values Numeric, Alpha, Alphanumeric, Latin, NonLatin, or NoRestriction.
Flash Lite supports input text functionality by asking the host application to start the generic device-specific text input interface, often referred to as the front-end processor (FEP). When the SetInputTextType command is not used, the FEP is opened in default mode.
152
Flash Lite Specific Language Elements
The following table shows what effect each mode has, and what modes are substituted:
Mode specified
Numeric Alpha Alphanumeric Latin NonLatin NoRestriction
N OT E
Sets the FEP to one of these mutually exclusive modes
Numbers only (0 to 9) Alphabetic characters only (A to Z, a to z) Alphanumeric characters only (0 to 9, A to Z, a to z) Latin characters only (alphanumeric and punctuation) Non-Latin characters only (for example, Kanji and Kana) Default mode (sets no restriction on the FEP)
If not supported on current device, opens the FEP in this mode
Alphanumeric Alphanumeric Latin NoRestriction NoRestriction
Not all mobile phones support these input text field types. For this reason, you must validate the input text data.
Example
The following line of code sets the input text type of the field associated with the input1 variable to receive numeric data:
status = fscommand2("SetInputTextType", "input1", "Numeric");
SetQuality
Availability
Flash Lite 1. 1.
Description
Sets the quality of the rendering of the animation.
Command
"SetQuality"
Parameters
quality "high", "medium", or "low".
Value returned
The rendering quality; must be -1: Not supported. [. . . ]