Flash Lite 1.
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 eith
Contents Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Sample entry for most ActionScript elements . . . . . . . . . . . . . . . . . . . . . . 7 Samples folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Typographical conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Chapter 1: Flash Lite Global Functions . . . . . . . . . . . . . . . . . . . . . . .
set() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 setProperty() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 stop() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 stopAllSounds(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 String() . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 4: Flash Lite Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 add (string concatenation) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 += (addition assignment). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 and . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 = (assignment). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
Introduction This manual describes the syntax and use of ActionScript elements as you use them to develop applications for Flash Lite 1.0 and Flash Lite 1.1, collectively referred to as Flash Lite 1.x. Flash Lite 1.x ActionScript is based on the version of ActionScript that was used in Flash 4. To use examples in a script, copy the code example from this manual, and paste it into the Script pane or into an external script file.
Operands This section describes any parameters listed in the syntax. Description This section identifies the type of element (for example, operator, function, and so on), what values if any that the element returns, and then describes how to use the element. Example This section provides a code sample demonstrating how to use the element. See also This section lists related ActionScript dictionary entries.
1 CHAPTER 1 Flash Lite Global Functions This section describes the syntax and use of the Macromedia Flash Lite 1.1 ActionScript global functions. It includes the following functions: Function Description call() Executes the script in the called frame without moving the playhead to that frame. chr() Converts ASCII code numbers to characters. duplicateMovieClip() Creates an instance of a movie clip while the SWF file plays. eval () Accesses variables, properties, objects, or movie clips by name.
Function Description loadVariables() Reads data from an external file, such as a text file or text generated by a ColdFusion, CGI ASP, PHP, or Perl script, and sets the values for variables in a Flash Lite level. This function can also update variables in the active SWF file with new values. loadVariablesNum() Reads data from an external file, such as a text file or text generated by a ColdFusion, CGI, ASP, PHP, or Perl script, and sets the values for variables in a Flash Lite level.
Function Description toggleHighQuality() Turns anti-aliasing on and off in Flash Lite. Anti-aliasing smooths the edges of objects but slows down SWF file playback. trace() Evaluates the expression and shows the result in the Output panel in test mode. unloadMovie() Removes a movie clip from Flash Lite that was loaded using loadMovie() loadMovieNum(), or duplicateMovieClip().
Example The following examples execute the script in the myScript frame: // to execute functions in frame with label "myScript" thisFrame = "myScript"; trace ("Calling the script in frame: " add thisFrame); // to execute functions in any other frame on the same timeline call("myScript"); chr() Availability Flash Lite 1.0. Usage chr(number) Operands number An ASCII code number. Description String function; converts ASCII code numbers to characters.
Operands target The target path of the movie clip to duplicate. newname A unique identifier for the duplicated movie clip. A unique depth level for the duplicated movie clip. The depth level indicates a stacking order for duplicated movie clips. This stacking order is much like the stacking order of layers in the timeline; movie clips with a lower depth level are hidden under clips that have a higher depth level.
eval () Availability Flash Lite 1.0. Usage eval(expression) Operands expression A string containing the name of a variable, property, object, or movie clip to retrieve. Description Function; accesses variables, properties, objects, or movie clips by name. If expression is a variable or a property, the value of the variable or property is returned. If expression is an object or movie clip, a reference to the object or movie clip is returned.
getProperty() Availability Flash Lite 1.0. Usage getProperty(my_mc, property) Operands my_mc The instance name of a movie clip for which the property is being retrieved. property A property of a movie clip. Description Function; returns the value of the specified property for the my_mc movie clip.
Example The following example sets the timeElapsed variable to the number of milliseconds that elapsed since the SWF file started playing: timeElapsed = getTimer(); trace (timeElapsed);// Output: milliseconds of time movie has been playing getURL() Availability Flash Lite 1.0. Usage getURL(url [ , window [, "variables"]]) Operands url The URL from which to obtain the document. An optional parameter that specifies the window or HTML frame that the document should load into.
Flash Lite 1.0 recognizes only the HTTP, HTTPS, mailto, and tel protocols. Flash Lite 1.1 recognizes these protocols, and in addition, the file, SMS (short message service), and MMS (multimedia message service) protocols. Flash Lite passes the call to the operating system, and the operating system handles the call with the registered default application for the specified protocol. Only one getURL() function is processed per frame or per event handler.
Method 2: Define each parameter within the getURL() function, as in this example: on (release, keyPress "#"){ getURL("mailto:somebody@anywhere.com?cc=cc@anywhere.com&bcc=bcc@anywhere. com&subject=I am the email subject&body=I am the email body"); } Method 1 results in automatic URL encoding, while Method 2 preserves the spaces in the strings.
gotoAndPlay() Availability Flash Lite 1.0. Usage gotoAndPlay([scene,] frame) Operands scene An optional string specifying the name of the scene to which the playhead is sent. A number representing the frame number, or a string representing the label of the frame, to which the playhead is sent. frame Description Function; sends the playhead to the specified frame in a scene and begins playing from that frame. If no scene is specified, the playhead moves to the specified frame in the current scene.
Description Function; sends the playhead to the specified frame in a scene and stops it. If no scene is specified, the playhead is sent to the frame in the current scene. You can use the scene parameter only on the root timeline, not within timelines for movie clips or other objects in the document.
Example The following example uses the ifFrameLoaded function to check if Frame 10 of the SWF file is loaded. If the frame is loaded, the trace() command prints “frame number 10 is loaded” to the Output panel. The output variable is also defined with a variable of frame loaded: 10. ifFrameLoaded(10) { trace ("frame number 10 is loaded"); output = "frame loaded: 10"; } See also _framesloaded int() Availability Flash Lite 1.0.
length() Availability Flash Lite 1.0. Usage length(expression) length(variable) Operands A string. expression variable The name of a variable. Description String function; returns the number of characters of the specified string or variable name. Example The following example returns the length of the string "Hello": length("Hello"); The result is 5. The following example validates an e-mail address by checking that it contains at least six characters: email = "someone@macromedia.
Operands url A string specifying the absolute or relative URL of the SWF file to load. A relative path must be relative to the SWF file at level 0. Absolute URLs must include the protocol reference, such as http:// or file:///. target A reference to a movie clip or a string representing the path to a target movie clip. The target movie clip is replaced by the loaded SWF file. An optional string parameter specifying an HTTP method for sending variables. The parameter must be the string GET or POST.
loadMovieNum() Availability Flash Lite 1.1. Usage loadMovieNum(url, level [, method]) Operands A string specifying the absolute or relative URL of the SWF file to be loaded. A relative path must be relative to the SWF file at level 0. For use in the stand-alone Flash Lite player or for use in test mode in the Flash authoring application, all SWF files must be stored in the same folder and the filenames cannot include folder or drive specifications.
Use unloadMovieNum() to remove SWF files or images that were loaded with loadMovieNum(). Example The following example loads the SWF file into level 2: loadMovieNum("http://www.someserver.com/flash/circle.swf", 2); See also _level, loadMovie(), unloadMovieNum() loadVariables() Availability Flash Lite 1.1. Usage loadVariables(url, target [, variables]) Operands A string representing an absolute or relative URL where the variables are located.
To load variables into a specific level, use the loadVariablesNum() function instead of the loadVariables() function. Example The following examples load variables from a text file and from a server: // load variables from text file on local file system (Symbian Series 60) on(release, keyPress "1") { filePath = "file://c:/documents/flash/myApp/myvariables.txt"; loadVariables(filePath, _root); } // load variables (from server) into a movieclip urlPath = "http://www.someserver.com/myvariables.
Description Function; reads data from an external file, such as a text file or text generated by a ColdFusion, CGI, ASP, PHP, or Perl script, and sets the values for variables in a Flash Lite level. This function can also update variables in the active SWF file with new values. The text at the specified URL must be in the standard MIME format application/x-wwwform-urlencoded (a standard format used by CGI scripts). Any number of variables can be specified.
Example The following example converts ASCII code numbers to their mulitibyte character equivalents: trace (mbchr(65));// Output: A trace (mbchr(97));// Output: a trace (mbchr(36));// Output: $ myString = mbchr(51) - mbchr(49); trace ("result = " add myString);// Output: result = 2 See also mblength(), mbsubstring() mblength() Availability Flash Lite 1.0. Usage mblength(string) Operands string A string. Description String function; returns the length of the multibyte character string.
mbord() Availability Flash Lite 1.0. Usage mbord(character) Operands character The character to convert to a multibyte number. Description String function; converts the specified character to a multibyte number.
Operands value The multibyte string from which to extract a new multibyte string. index The number of the first character to extract. count The number of characters to include in the extracted string, not including the index character. Description String function; extracts a new multibyte character string from a multibyte character string.
Example In the following example, when the user clicks the button, the playhead moves to the next frame and stops: on (release) { nextFrame(); } See also prevFrame() nextScene() Availability Flash Lite 1.0. Usage nextScene() Operands None. Description Function; sends the playhead to Frame 1 of the next scene and stops it.
Number() Availability Flash Lite 1.0. Usage Number(expression) Operands expression An expression to convert to a number. Description Function; converts the parameter expression to a number and returns a value as described in the following list: ■ If expression is a number, the return value is expression. ■ If expression is a Boolean value, the return value is 1 if expression is true; 0 if expression is false.
on() Availability Flash Lite 1.0. Usage on(event) { // statement(s) } Operands statement(s) The instructions to execute when event occurs. This trigger is called an event. When a user event occurs, the statements following it within curly braces ({}) execute. Any of the following values can be specified for the event parameter: event The button is pressed while the pointer is over the button. ■ press ■ release The button is released while the pointer is over the button.
ord() Availability Flash Lite 1.0. Usage ord(character) Operands character The character to convert to an ASCII code number. Description String function; converts characters to ASCII code numbers. Example The following example uses the ord() function to display the ASCII code for the character A: trace ("multibyte number = " add ord("A"));// Output: multibyte number = 65 play() Availability Flash Lite 1.0. Usage play() Operands None.
Example The following example uses an if statement to check the value of a name that the user enters. If the user enters Steve, the play() function is called, and the playhead moves forward in the timeline. If the user enters anything other than Steve, the SWF file does not play, and a text field with the variable name alert appears. stop(); if (name == "Steve") { play(); } else { alert="You are not Steve!"; } prevFrame() Availability Flash Lite 1.0. Usage prevFrame() Operands None.
prevScene() Availability Flash Lite 1.0. Usage prevScene() Operands None. Description Function; sends the playhead to Frame 1 of the previous scene and stops it. Example In this example, when the user clicks a button that has the following handler attached to it, the playhead is sent to the previous scene: on(release) { prevScene(); } See also nextScene() random() Availability Flash Lite 1.0. Usage random(value) Operands value An integer.
Example The following examples generate a number based on an integer specifying the range: //pick random number between 0 and 5 myNumber = random(5); trace (myNumber);// Output: could be 0,1,2,3,4 //pick random number between 5 and 10 myNumber = random(5) + 5; trace (myNumber);// Output: could be 5,6,7,8,9 The following examples generate a number, and then concatenate it onto the end of a string being evaluated as a variable name. This is an example of how Flash Lite 1.
set() Availability Flash Lite 1.0. Usage set(variable, expression) Operands variable An identifier to hold the value of the expression parameter. expression A value assigned to the variable. Description Statement; assigns a value to a variable. A variable is a container that holds data. The container is always the same, but the contents can change.
setProperty() Availability Flash Lite 1.0. Usage setProperty(target, property, value/expression) Operands The path to the instance name of the movie clip whose property is to be set. target property value The property to be set. The new literal value of the property. expression An equation that evaluates to the new value of the property. Description Function; changes a property value of a movie clip as the movie plays.
Description Function; stops the SWF file that is currently playing. The most common use of this function is to control movie clips with buttons. Example The following statement calls the stop() function when the user clicks the button associated with this event handler: on(release) { stop(); } stopAllSounds() Availability Flash Lite 1.0. Usage stopAllSounds() Operands None. Description Function; stops all sounds currently playing in a SWF file without stopping the playhead.
String() Availability Flash Lite 1.0. Usage String(expression) Operands expression An expression to convert to a string. Description Function; returns a string representation of the specified parameter as described in the following list: ■ If expression is a number, the return string is a text representation of the number. ■ If expression is a string, the return string is expression. ■ If expression is a Boolean value, the return string is true or false.
Operands string The string from which to extract the new string. The number of the first character to extract. index count The number of characters to include in the extracted string, not including the index character. Description Function; extracts part of a string. This function is one-based, whereas the String class methods are zero-based.
Example In the following example, tellTarget() controls the ball movie clip instance on the main timeline. Frame 1 of the ball instance is blank and has a stop() function so that it isn’t visible on the Stage. When the user presses the 5 key, tellTarget() tells the playhead in ball to go to Frame 2 where the animation starts. on(keyPress "5") { tellTarget("ball") { gotoAndPlay(2); } } toggleHighQuality() Availability Flash Lite 1.0. Usage toggleHighQuality() Operands None.
trace() Availability Flash Lite 1.0. Usage trace(expression) Operands An expression to evaluate. When a SWF file opens in the Flash authoring tool (by means of the Test Movie command), the value of the expression parameter appears in the Output panel. expression Description Function; evaluates the expression and shows the result in the Output panel in test mode. Use this function to record programming notes or to display messages in the Output panel while testing a SWF file.
Description Function; removes a movie clip from Flash Lite that was loaded by means of loadMovie(), loadMovieNum(), or “duplicateMovieClip()”. Example When the user presses the 3 key, the following code responds by unloading the draggable_mc movie clip on the main timeline and loading movie.swf into level 4 of the document stack: on (keypress "3") { unloadMovie ("/draggable_mc"); loadMovieNum(“movie.
Flash Lite Global Functions
2 CHAPTER 2 Flash Lite Properties This section describes the properties that Macromedia Flash Lite 1.x recognizes. The entries are listed alphabetically, ignoring any leading underscores. The properties are summarized in the following table: Property Description / (Forward slash) Specifies or returns a reference to the main movie timeline. _alpha Returns the alpha transparency value of a movie clip. _currentframe Returns the number of the frame in which the playhead is located in the timeline.
Property Description _target Returns the target path of the movie clip instance. _totalframes Returns the total number of frames in a movie clip. _visible Indicates whether a movie clip is visible. _width Returns the width of the movie clip, in pixels. _x Contains an integer that sets the x coordinate of a movie clip. _xscale Sets the horizontal scale (percentage) of the movie clip, as applied from the registration point of the movie clip.
Example 3: The car variable in the movie clip instance mc2 nested in the movie clip instance mc1 that resides on the main Timeline: /mc1/mc2/:car Example 4: The car variable in the movie clip instance mc2 that resides on the current Timeline: mc2/:car _alpha Availability Flash Lite 1.0. Usage my_mc:_alpha Property; the alpha transparency value of the movie clip specified by the my_mc variable. Valid values are 0 (fully transparent) to 100 (fully opaque), which is the default value.
Example The following example uses the _currentframe property and the gotoAndStop() function to direct the playhead of the my_mc movie clip to advance five frames ahead of its current location: tellTarget("my_mc") { gotoAndStop(_currentframe + 5); } See also gotoAndStop() _focusrect Availability Flash Lite 1.0. Usage _focusrect = Boolean; Description Property (global); specifies whether a yellow rectangle appears around the button or text field that has the current focus.
_framesloaded Availability Flash Lite 1.0. Usage my_mc:_framesloaded Description Property (read-only); the number of frames that have been loaded from a dynamically loaded SWF file. This property is useful for determining whether the contents of a specific frame, and all the frames before it, have loaded and are available locally in the browser. It is also useful as a monitor while large SWF files download.
_height Availability Flash Lite 1.0. Usage my_mc:_height Description Property (read-only); the height of the movie clip, in pixels. Example The following example of event handler code sets the height of a movie clip when the user clicks the mouse button: on(release) { tellTarget("my_mc") { _height = 200; } } _highquality Availability Flash Lite 1.0. Usage _highquality Description Property (global); specifies the level of anti-aliasing applied to the current SWF file.
_level Availability Flash Lite 1.0. Usage _levelN Description Identifier; a reference to the root timeline of _levelN. You must use the loadMovieNum() function to load SWF files into the Flash Lite player before you use the _level property to target them. You can also use _levelN to target a loaded SWF file at the level assigned by N. The initial SWF file that loads into an instance of the Flash Lite player automatically loads into _level0.
maxscroll Availability Flash Lite 1.1 Usage variable_name:maxscroll Description Property (read-only); indicates the line number of the first visible line of text in a scrollable text field when the last line in the field is also visible. The maxscroll property works with the scroll property to control how information appears in a text field. This property can be retrieved but not modified.
Description Property; the instance name of the movie clip that my_mc specifies. It applies only to movie clips and not to the main timeline. Example The following example displays the name of the bigRose movie clip in the Output panel as a string: trace(bigRose:_name); _rotation Availability Flash Lite 1.0. Usage my_mc:_rotation Description Property; the rotation of the movie clip, in degrees, from its original orientation.
scroll Availability Flash Lite 1.1. Usage textFieldVariableName:scroll Description Property; controls the display of information in a text field associated with a variable. The scroll property defines where the text field begins displaying content; after you set it, Flash Lite updates it as the user scrolls through the text field. You can use the scroll property to create a scrolling text field or to direct a user to a specific paragraph in a long passage.
_totalframes Availability Flash Lite 1.0. Usage my_mc:_totalframes Description Property (read-only); returns the total number of frames in the my_mc movie clip. Example The following code loads mySWF.swf into Level 1, and then 25 frames later, checks to see whether it is loaded: loadMovieNum("mySWF.swf", 1); // 25 frames later in the main timeline if (_level1._framesloaded >= _level1._totalframes) { tellTarget("_level1/") { gotoAndStop("myLabel"); } } else { // loop...
Example The following code disables the my_mc movie clip when the user presses the 3 key, and enables it when the user presses the 4 key: on(keyPress "3") { my_mc:_visible = 0; } on(keyPress "4") { my_mc:_visible = 1; } _width Availability Flash Lite 1.0. Usage my_mc:_width Description Property; the width of the movie clip, in pixels.
Description Property; an integer that sets the x coordinate of a movie clip (represented here by my_mc), relative to the local coordinates of the parent movie clip. If a movie clip is in the main timeline, its coordinate system refers to the upper-left corner of the Stage as (0, 0). If the movie clip is inside another movie clip that has transformations, the movie clip is in the local coordinate system of the enclosing movie clip.
Example The following example changes the horizontal scale of the my_mc movie clip when the user presses the 7 key: on(keyPress "7") { my_mc:_xscale = 10; } See also _x, _y, _yscale _y Availability Flash Lite 1.0. Usage my_mc:_y Description Property; an integer that sets the y coordinate of a movie clip (represented here by my_mc), relative to the local coordinates of the parent movie clip.
_yscale Availability Flash Lite 1.0. Usage my_mc:_yscale Description Property; sets the vertical scale (percentage) of the movie clip, as applied from the registration point of the movie clip. The default registration point is (0, 0). Scaling the local coordinate system affects the _x and _y property settings, which are defined in pixels.
Flash Lite Properties
3 CHAPTER 3 Flash Lite Statements This section describes the syntax and use of the Macromedia Flash Lite 1.x ActionScript statements, which are language elements that perform or specify an action. The statements are summarized in the following table: Statement Description break Instructs Flash Lite to skip the rest of the loop body, stop the looping action, and execute the statement following the loop statement. case Defines a condition for the switch statement.
Statement Description switch Similar to the if statement, the switch statement tests a condition and executes statements if the condition evaluates to true. while Tests an expression and runs a statement or series of statements repeatedly in a loop as long as the expression is true. break Availability Flash Lite 1.0. Usage break Parameters None. Description Statement; appears within a loop (for, do..
case Availability Flash Lite 1.0. Usage case expression: statements Parameters expression Any expression. statements Any statements. Description Statement; defines a condition for the switch statement. The statements in the statements parameter execute if the expression parameter that follows the case keyword equals the expression parameter of the switch statement. If you use the case statement outside a switch statement, it produces an error and the code doesn’t compile.
In the following example, no break occurs in the first case group, 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 switch continue Availability Flash Lite 1.0. Usage continue Parameters None. Description Statement; jumps past all remaining statements in the innermost loop and starts the next iteration of the loop as if control had passed through to the end of the loop normally.
Example In the following while loop, continue causes Flash Lite to skip the rest of the loop body and jump to the top of the loop, where the condition is tested: i = 0; while (i < 10) { if (i % 3 == 0) { i++; continue; } trace(i); i++; } In the following do..
do..while Availability Flash Lite 1.0. Usage do { statement(s) } while (condition) Parameters statement(s) The statement(s) to execute as long as the condition parameter evaluates to true. condition The condition to evaluate. Description Statement; executes the statements, and then evaluates the condition in a loop for as long as the condition is true.
else Availability Flash Lite 1.0. Usage if (condition){ t-statement(s); } else { f-statement(s); } Parameters condition An expression that evaluates to true or false. t-statement(s) The instructions to execute if the condition evaluates to true. f-statement(s) An alternative series of instructions to execute if the condition evaluates to false. Description Statement; specifies the statements to run if the condition in the if statement evaluates to false.
else if Availability Flash Lite 1.0. Usage if (condition){ statement(s); } else if (condition){ statement(s); } Parameters condition An expression that evaluates to true or false. statement(s) A series of statements to run if the condition specified in the if statement is false. Description Statement; evaluates a condition and specifies the statements to run if the condition in the initial if statement returns a false value.
for Availability Flash Lite 1.0. Usage for (init; condition; next) { statement(s); } Parameters An expression to evaluate before beginning the looping sequence, typically an assignment expression. init condition An expression that evaluates to true or false. The condition is evaluated before each loop iteration; the loop exits when the condition evaluates to false. An expression to evaluate after each loop iteration; usually an assignment expression using the increment (++) or decrement (--) operator.
if Availability Flash Lite 1.0. Usage if (condition) { statement(s); } Parameters condition An expression that evaluates to true or false. statement(s) The instructions to execute if the condition evaluates to true. Description Statement; evaluates a condition to determine the next action in a SWF file. If the condition is true, Flash Lite runs the statements that follow the condition inside curly braces ({}).
switch Availability Flash Lite 1.0. Usage switch (expression){ caseClause: [defaultClause:] } Parameters expression 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. caseClause An optional default keyword followed by statements to execute if none of the case expressions match the switch expression parameter.
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.
Parameters condition The expression that is evaluated each time the while statement executes. statement(s) The instructions to execute when the condition evaluates to true. 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.
Flash Lite Statements
4 CHAPTER 4 Flash Lite Operators This section describes the syntax and use of the Macromedia Flash Lite 1.x ActionScript operators. All entries are listed alphabetically. However, some operators are symbols and are alphabetized by their text descriptions. The operators in this section are summarized in the following table: Operator Description add (string concatenation) Concatenates (combines) two or more strings. += (addition assignment) Assigns expression1 the value of expression1 + expression2.
Operator Description –– (decrement) Subtracts 1 from expression. The pre-decrement form of the operator (––expression) subtracts 1 from expression and returns the result as a number. The post-decrement form of the operator (expression––) subtracts 1 from expression and returns the initial value of expression (the value before the subtraction). / (divide) Divides expression1 by expression2. /= (division assignment) Assigns expression1 the value of expression1 / expression2. .
Operator Description == (numeric equality) Tests for equality; if expression1 is equal to expression2 , the result is true. > (numeric greater than) Compares two expressions and determines whether expression1 is greater than expression2 ; if it is, the operator returns true. If expression1 is less than or equal to expression2 , the operator returns false.
Operator Description lt (string less than) Compares the string representation of expression1 to the string representation of expression2 and returns a true value if expression1 is less than expression2; otherwise, it returns false. le (string less than or equal to) Compares the string representation of expression1 to the string representation of expression2 and returns a true value if expression1 is less than or equal to expression2; otherwise, it returns false.
+= (addition assignment) Availability Flash Lite 1.0. Usage expression1 += expression2 Operands Numbers or strings. expression1, expression2 Description Operator (arithmetic compound assignment); assigns expression1 the value of expression1 + expression2. For example, the following two statements have the same result: x += y; x = x + y; All the rules of the addition (+) operator apply to the addition assignment (+=) operator.
Description Operator; performs a logical AND operation. Example The following example uses the and operator to test whether a player has won the game. The turns variable and the score variable are updated when a player takes a turn or scores points during the game. The following script shows “You Win the Game!” in the Output panel when the player’s score reaches 75 or higher in three turns or less.
Example The following example uses the assignment (=) operator to assign a numeric value to the variable weight: weight = 5; The following example uses the assignment (=) operator to assign a string value to the variable greeting: greeting = "Hello, " and personName; /* (block comment) Availability Flash Lite 1.0 Usage /* comment */ /* comment comment */ Operands comment Any characters. Description Comment delimiter; indicates one or more lines of script comments.
, (comma) Availability Flash Lite 1.0. Usage expression1, expression2 Operands expression1, expression2 Numbers or expressions that evaluate to numbers. Description Operator; evaluates expression1, then expression2, and returns the value of expression2.
The following example is identical to the previous example except for the addition of the parentheses () operator and illustrates once again that when used with the parentheses () operator, the comma (,) operator returns the value of the last expression in the series: v = 0; z = 0; v = (v + 4, z++, v + 6); trace(v); // output: 6 trace(z); // output: 1 See also for, () (parentheses) // (comment) Availability Flash Lite 1.0 Usage // comment Operands comment Any characters.
?: (conditional) Availability Flash Lite 1.0. Usage expression1 ? expression2 : expression3 Operands An expression that evaluates to a Boolean value, usually a comparison expression, such as x < 5. expression1 expression2, expression3 Values of any type. Description Operator; instructs Flash Lite to evaluate expression1, and if the value of expression1 is true, it returns the value of expression2; otherwise, it returns the value of expression3.
Description Operator (arithmetic); a pre-decrement and post-decrement unary operator that subtracts 1 from expression. The pre-decrement form of the operator (––expression) subtracts 1 from expression and returns the result as a number. The post-decrement form of the operator (expression––) subtracts 1 from expression and returns the initial value of expression (the value before the subtraction).
/= (division assignment) Availability Flash Lite 1.0. Usage expression1 /= expression2 Operands expression1, expression2 Numbers or expressions that evaluate to numbers. Description Operator (arithmetic compound assignment); assigns expression1 the value of expression1 / expression2.
Description Operator; used to navigate movie clip hierarchies to access nested (child) movie clips, variables, or properties. Example The following example identifies the current value of the variable hairColor in the movie clip person_mc: person_mc.hairColor This is equivalent to the following slash notation syntax: /person_mc:hairColor See also / (Forward slash) ++ (increment) Availability Flash Lite 1.0. Usage ++expression expression++ Operands None.
Example The following example uses ++ as a post-increment operator to make a while loop run five times: i = 0; while (i++ < 5){ trace("this is execution " + i); } The following example uses ++ as a pre-increment operator: a = ""; i = 0; while (i < 10) { a = a add (++i) add ","; } trace(a);// output: 1,2,3,4,5,6,7,8,9,10, This script shows the following result in the Output panel: 1,2,3,4,5,6,7,8,9,10, The following example uses ++ as a post-increment operator: a = ""; i = 0; while (i < 10) { a = a add (
Description Operator (logical); performs a Boolean operation on the values of one or both of the expressions. The operator evaluates expression1 (the expression on the left side of the operator) and returns false if the expression evaluates to false. If expression1 evaluates to true, expression2 (the expression on the right side of the operator) is evaluated. If expression2 evaluates to true, the final result is true; otherwise, it is false.
! (logical NOT) Availability Flash Lite 1.0. Usage !expression Operands None. Description Operator (logical); inverts the Boolean value of a variable or expression. If expression is a variable with the absolute or converted value of true, the value of !expression is false. If the expression x && y evaluates to false, the expression !(x && y) evaluates to true.
Description Operator (logical); evaluates expression1 and expression2. The result is true if either or both expressions evaluate to true; the result is false only if both expressions evaluate to false. You can use the logical OR operator with any number of operands; if any operand evaluates to true, the result is true. With non-Boolean expressions, the logical OR operator causes Flash Lite to evaluate the expression on the left; if it can be converted to true, the result is true.
Example The following code shows a numeric example that uses the modulo (%) operator: trace (12 % 5);// output: 2 trace (4.3 % 2.1);// output: 0.0999... %= (modulo assignment) Availability Flash Lite 1.0. Usage expression1 %= expression2 Operands expression1, expression2 Numbers or expressions that evaluate to numbers. Description Operator (arithmetic compound assignment); assigns expression1 the value of expression1 % expression2.
Operands expression1, expression2 Numbers or expressions that evaluate to numbers. Description Operator (arithmetic compound assignment); assigns expression1 the value of expression1 * expression2.
Example Usage 1: The following statement multiplies the integers 2 and 3: 2 * 3 The result is 6, which is an integer. Usage 2: The following statement multiplies the floating-point numbers 2.0 and 3.1416: 2.0 * 3.1416 The result is 6.2832, which is a floating-point number. + (numeric add) Availability Flash Lite 1.0. Usage expression1 + expression2 Operands expression1, expression2 Numbers. Description Operator; adds numeric expressions.
== (numeric equality) Availability Flash Lite 1.0. Usage expression1 == expression2 Operands expression1, expression2 Numbers, Boolean values, or variables. Description Operator (comparison); tests for equality; the exact opposite of the <> operator. If expression1 is equal to expression2, the result is true. As with the <> operator, the definition of equal depends on the data types being compared: ■ Numbers and Boolean values are compared by value. ■ Variables are compared by reference.
> (numeric greater than) Availability Flash Lite 1.0. Usage expression1 > expression2 Operands expression1, expression2 Numbers or expressions that evaluate to numbers. Operator (comparison); compares two expressions and determines whether expression1 is greater than expression2; if it is, the operator returns true. If expression1 is less than or equal to expression2, the operator returns false. Example The following examples show true and false results for numeric comparisons: trace(3.
Example The following examples show true and false results: trace(3.14 >= 2);// output: 1(true) trace(3.14 >= 4);// output: 0(false) See also ge (string greater than or equal to) <> (numeric inequality) Availability Flash Lite 1.0. Usage expression1 <> expression2 Operands expression1, expression2 Numbers, Boolean values, or variables. Description Operator (comparison); tests for inequality; the exact opposite of the equality (==) operator.
< (numeric less than) Availability Flash Lite 1.0. Usage expression1 < expression2 Operands Numbers. expression1, expression2 Description Operator (comparison); compares two expressions and determines whether expression1 is less than expression2; if so, the operator returns true. If expression1 is greater than or equal to expression2, the operator returns false. The < (less than) operator is a numeric operator.
Example The following examples show true and false results for numeric comparisons: trace(5 <= 10);// output: 1(true) trace(2 <= 2);// output: 1(true) trace (10 <= 3);// output: 0 (false) See also le (string less than or equal to) () (parentheses) Availability Flash Lite 1.0. Usage (expression1 [, expression2]) (expression1, expression2) expression1, expression2 Numbers, strings, variables, or text.
Example Usage 1: The following statements show the use of parentheses to control the order in which expressions are executed (the value of each expression appears in the Output panel): trace((2 + 3) * (4 + 5)); // displays 45 trace(2 + (3 * (4 + 5))); // // displays 29 trace(2 + (3 * 4) + 5); // displays 19 Usage 1: The following statements show the use of parentheses to control the order in which expressions are executed (the value of each expression is written to the log file): trace((2 + 3) * (4 + 5));
eq (string equality) Availability Flash Lite 1.0. Usage expression1 eq expression2 Operands expression1, expression2 Numbers, strings, or variables. Description Comparison operator; compares two expressions for equality and returns true if the string representation of expression1 is equal to the string representation of expression2; otherwise, the operation returns false.
Description Operator (comparison); compares the string representation of expression1 to the string representation of expression2 and returns a true value if expression1 is greater than expression2; otherwise, it returns a false value. Strings are compared using alphabetical order; digits precede all letters, and all capital letters precede lowercase letters.
Example The following examples show true and false results: animals = "cats"; breeds = 7; trace trace trace trace trace trace ("cats" ge "cattle");// output: 0(false) (animals ge "cats");// output: 1(true) ("persons" ge "people");// output: 1(true) (animals ge "Cats");// output: 1(true) (breeds ge "5");// output: 1(true) (breeds ge 7);// output: 1(true) See also >= (numeric greater than or equal to) ne (string inequality) Availability Flash Lite 1.0.
lt (string less than) Availability Flash Lite 1.0. Usage expression1 lt expression2 Operands expression1, expression2 Numbers, strings, or variables. Description Operator (comparison); compares the string representation of expression1 to the string representation of expression2 and returns a true value if expression1 is less than expression2; otherwise, it returns a false value. Strings are compared using alphabetical order; digits precede all letters, and all capital letters precede lowercase letters.
Operands expression1, expression2 Numbers, strings, or variables. Description Operator (comparison); compares the string representation of expression1 to the string representation of expression2 and returns a true value if expression1 is less than or equal to expression2; otherwise, it returns a false value. Strings are compared using alphabetical order; digits precede all letters, and all capital letters precede lowercase letters.
Description Operator (arithmetic); used for negating or subtracting. Usage 1: When used for negating, it reverses the sign of the numeric expression. Usage 2: When used for subtracting, it performs an arithmetic subtraction on two numeric expressions, subtracting expression2 from expression1. When both expressions are integers, the difference is an integer. When either or both expressions are floating-point numbers, the difference is a floating-point number.
Description Operator (arithmetic compound assignment); assigns expression1 the value of expression1 - expression2. No value is returned. For example, the following two statements are the same: x -= y; x = x - y; String expressions must be converted to numbers; otherwise, -1 is returned.
Flash Lite Operators
CHAPTER 5 5 Flash Lite Specific Language Elements This section describes both the platform capabilities and variables that Macromedia Flash Lite 1.1 recognizes, and the Flash Lite commands you can execute using the fscommand() and fscommand2() functions. The functionality described in this section is specific to Flash Lite. The contents of this section are summarized in the following table: Language element Description _capCompoundSound Indicates whether Flash Lite can process compound sound.
Language element Description _cap4WayKeyAS Indicates whether Flash Lite executes ActionScript expressions attached to key event handlers associated with the Right, Left, Up, and Down Arrow keys. $version Contains the version number of Flash Lite. fscommand() A function used to execute the Launch command (see next entry).
Language element Description GetMaxBatteryLevel Returns the maximum battery level of the device. GetMaxSignalLevel Returns the maximum signal strength level. GetMaxVolumeLevel Returns the maximum volume level of the device as a numeric value. GetNetworkConnectStatus Returns a value that indicates the current network connection status. GetNetworkName Sets a parameter to the name of the current network.
Language element Description SetSoftKeys Remaps the Left and Right soft keys of the device, provided that they can be accessed and remapped. StartVibrate Starts the phone’s vibration feature. StopVibrate Stops the current vibration, if any. Unescape Decodes an arbitrary string that was encoded to be safe for network transfer into its normal, unencoded form. Capabilities This section describes the platform capabilities and variables that Macromedia Flash Lite 1.1 recognizes.
_capEmail Availability Flash Lite 1.1. Usage _capEmail Description Numeric variable; indicates whether the Flash Lite client can send e-mail messages by using the GetURL() ActionScript command. If so, this variable is defined and has a value of 1; if not, this variable is undefined. Example If the host application can send e-mail messages by using the GetURL() ActionScript command, the following example sets canEmail to 1: canEmail = _capEmail; if (canEmail == 1) { getURL("mailto:someone@somewhere.
Example If the host application can perform dynamic loading of movies and variables, the following example sets iCanLoad to 1: canLoad = _capLoadData; if (canLoad == 1) { loadVariables("http://www.somewhere.com/myVars.php", GET); } else { trace ("client does not support loading dynamic data"); } _capMFi Availability Flash Lite 1.1. Usage _capMFi Description Numeric variable; indicates whether the device can play sound data in the Melody Format for i-mode (MFi) audio format.
_capMIDI Availability Flash Lite 1.1. Usage _capMIDI Description Numeric variable; indicates whether the device can play sound data in the Musical Instrument Digital Interface (MIDI) audio format. If so, this variable is defined and has a value of 1; if not, this variable is undefined.
Example The following example sets canMMS to 1 in Flash Lite 1.1, but leaves it undefined in Flash Lite 1.0 (however, not all Flash Lite 1.1 phones can send MMS messages, so this code is still dependent on the phone): on(release) { canMMS = _capMMS; if (canMMS == 1) { // send an MMS myMessage = "mms:4156095555?body=sample mms message"; } else { // send an SMS myMessage = "sms:4156095555?body=sample sms message"; } getURL(myMessage); } _capMP3 Availability Flash Lite 1.1.
_capSMAF Availability Flash Lite 1.1. Usage _capSMAF Description Numeric variable; indicates whether the device can play multimedia files in the Synthetic music Mobile Application Format (SMAF). If so, this variable is defined and has a value of 1; if not, this variable is undefined. Example The following example sets canSMAF to 1 in Flash Lite 1.1, but leaves it undefined in Flash Lite 1.0 (however, not all Flash Lite 1.
Example The following example sets canSMS to 1 in Flash Lite 1.1, but leaves it undefined in Flash Lite 1.0 Flash Lite 1.0 (however, not all Flash Lite 1.1 phones can send SMS messages, so this code is still dependent on the phone): on(release) { canSMS = _capSMS; if (canSMS) { // send an SMS myMessage = "sms:4156095555?body=sample sms message"; getURL(myMessage); } } _capStreamSound Availability Flash Lite 1.1.
_cap4WayKeyAS Availability Flash Lite 1.1. Usage _cap4WayKeyAS Description Numeric variable; indicates whether Flash Lite executes ActionScript expressions attached to key event handlers associated with the Right, Left, Up, and Down Arrow keys. This variable is defined and has a value of 1 only when the host application uses four-way key navigation mode to move between Flash controls (buttons and input text fields). Otherwise, this variable is undefined.
$version Availability Flash Lite 1.1. Usage $version Description String variable; contains the version number of Flash Lite. It contains a major number, minor number, build number, and an internal build number, which is generally 0 in all released versions. The major number reported for all Flash Lite 1.x products is 5. Flash Lite 1.0 has a minor number of 1; Flash Lite 1.1 has a minor number of 2. Example In the Flash Lite 1.
Launch Availability Flash Lite 1.1. Usage status = fscommand("Launch", "application-path, arg1, arg2,..., argn") Parameters The command specifier. In Flash Lite, you use the fscommand() function only to execute the Launch command. "Launch" "application-path, arg1, arg2,..., argn" The name of the application being started and the parameters to it, separated by commas. Description Command executed through the fscommand() function; launches another application on the device.
fscommand2() Availability Flash Lite 1.1. Usage returnValue = fscommand2(command [, expression1 ... expressionN]) Parameters command A string passed to the host application for any use or a command passed to Flash Lite. A comma-delimited list of strings passed as parameters to the command specified by command. parameter1...parameterN Description Function; allows the SWF file to communicate with either Flash Lite or the host environment, such as the phone or device’s operating system.
Example Examples are provided with the specific commands that you execute using the fscommand2() function, which are described in the rest of this section. See also fscommand() Escape Availability Flash Lite 1.1. Description Encodes an arbitrary string into a format that is safe for network transfer. Replaces each nonalphanumeric character with a hexadecimal escape sequence (%xx, or %xx%xx in the case of multibyte characters).
FullScreen Availability Flash Lite 1.1. Description Sets the size of the display area to be used for rendering. The size can be full screen or lessthan full screen. This command is supported only when Flash Lite is running in stand-alone mode. It is not supported when the player is running in the context of another application (for example, as a plug-in to a browser).
Example The following example sets the battLevel variable to the current level of the battery: battLevel = fscommand2("GetBatteryLevel"); See also GetMaxBatteryLevel GetDateDay Availability Flash Lite 1.1. Description Returns the day of the current date. It is a numeric value (without a leading 0). Valid days are 1 through 31. Command Parameters Value returned "GetDateDay" None. -1: Not supported. 1 to 31: The day of the month.
GetDateMonth Availability Flash Lite 1.1. Description Returns the month of the current date as a numeric value (without a leading 0). Command Parameters Value returned "GetDateMonth" None. -1: Not supported. 1 to 12: The number of the current month.
GetDateWeekday Availability Flash Lite 1.1. Description Returns a numeric value that is the name of the day of the current date, represented as a numeric value. Command Parameters Value returned "GetDateWeekday" None. -1: Not supported. 0: Sunday. 1: Monday. 2: Tuesday. 3: Wednesday. 4: Thursday. 5: Friday. 6: Saturday.
GetDateYear Returns a four-digit numeric value that is the year of the current date. Command Parameters Value returned "GetDateYear" None. -1: Not supported. 0 to 9999: The current year. Availability Flash Lite 1.1.
Example The following code example assigns the device identifier to the statusdevice variable, and then updates a text field with the generic device name. These are some sample results and the devices they signify: D506i DFOMA1 F506i FFOMA1 N506i NFOMA1 A Mitsubishi 506i phone. A Mitsubishi FOMA1 phone. A Fujitsu 506i phone. A Fujitsu FOMA1 phone. An NEC 506i phone. An NEC FOMA1 phone. Nokia3650 p506i A Nokia 3650 phone. A Panasonic 506i phone. PFOMA1 A Panasonic FOMA1 phone.
case "P506i": /:myText += "device: break; case "PFOMA1": /:myText += "device: break; case "SH506i": /:myText += "device: break; case "SHFOMA1": /:myText += "device: break; case "SO506i": /:myText += "device: break; Panasonic 506i" add newline; Panasonic FOMA1" add newline; Sharp 506i" add newline; Sharp FOMA1" add newline; Sony 506i" add newline; } GetDeviceID Sets a parameter that represents the unique identifier of the device (for example, the serial number).
GetFreePlayerMemory Returns the amount of heap memory, in kilobytes, currently available to Flash Lite. Command Parameters Value returned "GetFreePlayerMemory" None. -1: Not supported. 0 or positive value: Available kilobytes of heap memory. Availability Flash Lite 1.1. Example The following example sets status equal to the amount of free memory: status = fscommand2("GetFreePlayerMemory"); See also GetTotalPlayerMemory GetLanguage Availability Flash Lite 1.1.
Sets a parameter that identifies the language currently used by the device. The language is returned as a string in a variable that is passed in by name. Command Parameters Value returned "GetLanguage" language String to receive the language code. It can be either the name of a variable or a string value that contains the name of a variable. The value returned is one of the following: cs: Czech. da: Danish. de: German. en-UK: UK or international English. en-US: US English. es: Spanish. fi: Finnish.
Example The following example assigns the language code to the language variable, and then updates a text field with the language recognized by the Flash Lite player: statuslanguage = switch(language) case "cs": /:myText += break; case "da": /:myText += break; case "de": /:myText += break; case "en-UK": /:myText += break; case "en-US": /:myText += break; case "es": /:myText += break; case "fi": /:myText += break; case "fr": /:myText += break; case "hu": /:myText += break; case "it": /:myText += break; case
case "pl": /:myText += break; case "pt": /:myText += break; case "ru": /:myText += break; case "sv": /:myText += break; case "tr": /:myText += break; case "xu": /:myText += break; case "zh-CN": /:myText += break; case "zh-TW": /:myText += break; "language is Polish" add newline; "language is Portuguese" add newline; "language is Russian" add newline; "language is Swedish" add newline; "language is Turkish" add newline; "language is indeterminable" add newline; "language is simplified Chinese" add new
Example The following example attempts to return the long form of the current date in the longDate variable. It also sets the value of status to report whether it was able to do so. status = fscommand2("GetLocaleLongDate", "longdate"); trace (longdate); // output: Tuesday, June 14, 2005 See also GetLocaleShortDate, GetLocaleTime GetLocaleShortDate Availability Flash Lite 1.1.
GetLocaleTime Availability Flash Lite 1.1. Description Sets a parameter to a string representing the current time, formatted according to the currently defined locale. Command Parameters Value returned "GetLocaleTime" -1: Not String variable to receive the value of the supported. current time, such as "6:10:44 PM" or "18:10:44". It can be either the name of a variable or a string value 0: Supported. that contains the name of a variable.
Example The following example sets the maxBatt variable to the maximum battery level: maxBatt = fscommand2("GetMaxBatteryLevel"); GetMaxSignalLevel Availability Flash Lite 1.1. Description Returns the maximum signal strength level. It is a numeric value greater than 0. Command Parameters Value returned "GetMaxSignalLevel" None. -1: Not supported. Other numeric values: The maximum signal level.
Example The following example sets the maxvolume variable to the maximum volume level of the device: maxvolume = fscommand2("GetMaxVolumeLevel"); trace (maxvolume); // output: 80 See also GetVolumeLevel GetNetworkConnectStatus Availability Flash Lite 1.1. Description Returns a value that indicates the current network connection status. Command Parameters Value returned "GetNetworkConnectStatus" None. 140 Flash Lite Specific Language Elements -1: Not supported.
Example The following example assigns the network connection status to the connectstatus variable, and then uses a switch statement to update a text field with the status of the connection: connectstatus = fscommand2("GetNetworkConnectStatus"); switch (connectstatus) { case -1 : /:myText += "connectstatus not supported" add newline; break; case 0 : /:myText += "connectstatus shows active connection" add newline; break; case 1 : /:myText += "connectstatus shows attempting connection" add newline; break; cas
Example The following example assigns the name of the current network to the myNetName variable and a status value to the netNameStatus variable: netNameStatus = fscommand2("GetNetworkName", myNetName); GetNetworkRequestStatus Availability Flash Lite 1.1. Description Returns a value indicating the status of the most recent HTTP request. Command Parameters Value returned "GetNetworkRequestStatus" None. 142 Flash Lite Specific Language Elements -1: The command is not supported.
Example The following example assigns the status of the most recent HTTP request to the requesttatus variable, and then uses a switch statement to update a text field with the status: requeststatus = fscommand2("GetNetworkRequestStatus"); switch (requeststatus) { case -1: /:myText += "requeststatus not supported" add newline; break; case 0: /:myText += "connection to server has been made" add newline; break; case 1: /:myText += "connection is being established" add newline; break; case 2: /:myText += "pend
GetNetworkStatus Availability Flash Lite 1.1. Description Returns a value indicating the network status of the phone (that is, whether there is a network registered and whether the phone is currently roaming). Command Parameters Value returned "GetNetworkStatus" None. -1: The command is not supported. 0: No network registered. 1: On home network. 2: On extended home network. 3: Roaming (away from home network).
GetPlatform Availability Flash Lite 1.1. Description Sets a parameter that identifies the current platform, which broadly describes the class of device. For devices with open operating systems, this identifier is typically the name and version of the operating system. Command Parameters "GetPlatform" Value returned -1: Not supported. platform String to receive the 0: Supported. identifier of the platform. It can be either the name of a variable or a string value that contains the name of a variable.
GetPowerSource Availability Flash Lite 1.1. Description Returns a value that indicates whether the power source is currently supplied from a battery or from an external power source. Command Parameters Value returned "GetPowerSource" None. -1: Not supported. 0: Device is operating on battery power. 1: Device is operating on an external power source.
GetTimeHours Availability Flash Lite 1.1. Description Returns the hour of the current time of day, based on a 24-hour clock. It is a numeric value (without a leading 0). Command Parameters Value returned "GetTimeHours" None. -1: Not supported. 0 to 23: The current hour.
Example The following example sets the minutes variable to the minute portion of the current time of day, or to -1: minutes = fscommand2("GetTimeMinutes"); trace (minutes); // output: 38 See also GetTimeHours, GetTimeSeconds, GetTimeZoneOffset GetTimeSeconds Availability Flash Lite 1.1. Description Returns the second of the current time of day. It is a numeric value (without a leading 0). Command Parameters Value returned "GetTimeSeconds" None. -1: Not supported. 0 to 59: The current second.
GetTimeZoneOffset Availability Flash Lite 1.1. Description Sets a parameter to the number of minutes between the local time zone and universal time (UTC). Command Parameters "GetTimeZoneOffset" timezoneOffset Value returned Number of minutes between -1: Not supported. the local time zone and UTC. It can be either the 0: Supported. name of a variable or a string value that contains the name of a variable.
Example The following example sets the status variable to the total amount of heap memory: status = fscommand2("GetTotalPlayerMemory"); See also GetFreePlayerMemory GetVolumeLevel Availability Flash Lite 1.1. Description Returns the current volume level of the device as a numeric value. Command Parameters "GetVolumeLevel" None. Value returned -1: Not supported. Other numeric values: The current volume level, ranging from 0 to the value returned by fscommand2("GetMaxVolumeLevel").
Quit Availability Flash Lite 1.1. Description Causes the Flash Lite player to stop playback and exit. This command is supported only when Flash Lite is running in stand-alone mode. It is not supported when the player is running in the context of another application (for example, as a plug-in to a browser). Command Parameters Value returned "Quit" None. -1: Not supported.
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 0: Failure. Name of the input text field. It can be either the name of a variable or a string 1: Success. value that contains the name of a variable.
The following table shows what effect each mode has, and what modes are substituted: Mode specified Sets the FEP to one of these mutually exclusive modes If not supported on current device, opens the FEP in this mode Numeric Numbers only (0 to 9) Alphanumeric Alpha Alphabetic characters only (A to Z, a to z) Alphanumeric Alphanumeric Alphanumeric characters only (0 to 9, A to Z, a to z) Latin Latin Latin characters only (alphanumeric and punctuation) NoRestriction NonLatin Non-Latin characte
SetSoftKeys Availability Flash Lite 1.1. Description Remaps the Left and Right soft keys of the device, provided that they can be accessed and remapped. After this command is executed, pressing the left key generates a PageUp keypress event, and pressing the right key generates a PageDown keypress event. ActionScript associated with the PageUp and PageDown keypress events is executed when the respective key is pressed. This command is supported only when Flash Lite is running in stand-alone mode.
StartVibrate Availability Flash Lite 1.1. Description Starts the phone’s vibration feature. If a vibration is already occurring, Flash Lite stops that vibration before starting the new one. Vibrations also stop when playback of the Flash application is stopped or paused, and when Flash Lite player quits. Command Parameters Value returned "StartVibrate" time_on Amount of time, in milliseconds (to a maximum of 5 seconds), that the vibration is on.
Example The following example calls StopVibrate and saves the result (not supported or vibration stopped) in the status variable: status = fscommand2("StopVibrate"); See also StartVibrate Unescape Availability Flash Lite 1.1. Description Decodes an arbitrary string that was encoded to be safe for network transfer into its normal, unencoded form. All characters that are in hexadecimal format, that is, a percent character (%) followed by two hexadecimal digits, are converted into their decoded form.
Index Symbols ! (logical NOT) operator 92 " " (string delimiter) operator 102 $version variable 122 % (modulo) operator 93 %= (modulo assignment) operator 94 && (logical AND) operator 90 || (logical OR) operator 92 * (multiply) operator 95 *= (multiplication assignment) operator 94 + (numeric add) operator 96 ++ (increment) operator 89 += (addition assignment) operator 81 , (comma) operator 84 -= (subtraction assignment) operator 108 .
C call 11 _cap4WayKeyAS variable 121 _capCompoundSound variable 114 _capEmail variable 115 _capLoadData variable 115 _capMFi variable 117 _capMMS variable 117 _capSMAF variable 119 _capSMS variable 119 _capStreamSound variable 120 case statement 65 chr() function 12 comma operator 84 comments block 83 one-line 85 concatenation 80 conditional operator 86 conditions 72 continue statement 66 _currentframe property 49 D division 87 division assignment operator 88 do..
gotoAndPlay() function 19 gotoAndStop() function 19 greater than operator 98 greater than or equal to operator 98 gt (string greater than) operator 103 H _height property 52 _highquality property 52 I if statement 72 ifFrameLoaded() function 20 increment operator 89 inequality operator 99 int() function 21 L le (string less than or equal to) operator 106 length() function 22 less than operator 100 less than or equal to operator 100 _level property 53 loadMovie() function 22 loadMovieNum() function 24 loa
P play() function 34 prevFrame() function 35 prevScene() function 36 properties _alpha 49 _currentframe 49 _focusrect 50 _framesloaded 51 _height 52 _highquality 52 _level 53 _name 54 _rotation 55 _scroll 56 _target 56 _visible 57 _width 58 _x 58 _xscale 59 _y 60 _yscale 61 forward slash 48 maxscroll 54 scroll 56 if 72 logical NOT 92 switch 73 while 74 stop() function 39 stopAllSounds() functions 40 string delimiter operator 102 string equal operator 103 string greater than operator 103 string greater than
variables, messaging _capMMS 117 _capSMS 119 variables, sound _capCompoundSound 114 _capMFi 116 _capMIDI 117 _capSMAF 119 _capStreamSound 120 _visible property 57 W while loop 68 while statement 74 _width property 58 X _x property 58 _xscale property 59 Y _y property 60 _yscale property 61 Index 161
Index