MACROMEDIA FLASH 8-FLASH Reference

Other manuals for FLASH 8-FLASH: Tutorials Manual, Reference

Summary of FLASH 8-FLASH

  • Page 1

    Flash lite 1.X actionscript language reference.

  • Page 2

    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, f...

  • Page 3

    3 contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 sample entry for most actionscript elements . . . . . . . . . . . . . . . . . . . . . . 7 samples folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....

  • Page 4

    4 contents set() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 setproperty() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 stop() . . . . . . . . . . . . . . . . . . . . . . . . . . ...

  • Page 5

    Contents 5 chapter 4: flash lite operators . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 add (string concatenation) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 += (addition assignment). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

  • Page 6

    6 contents.

  • Page 7

    7 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...

  • Page 8

    8 introduction 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 provi...

  • Page 9

    9 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(...

  • Page 10

    10 flash lite global functions 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 value...

  • Page 11

    Call() 11 call() availability flash lite 1.0. Usage call(frame) call(movieclipinstance:frame) operands frame the label or number of a frame in the timeline. Movieclipinstance the instance name of a movie clip. Description function; executes the script in the called frame without moving the playhead ...

  • Page 12

    12 flash lite global functions 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 timelin...

  • Page 13

    Duplicatemovieclip() 13 operands target the target path of the movie clip to duplicate. Newname a unique identifier for the duplicated movie clip. Depth a unique depth level for the duplicated movie clip. The depth level indicates a stacking order for duplicated movie clips. This stacking order is m...

  • Page 14

    14 flash lite global functions 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...

  • Page 15

    Gettimer() 15 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...

  • Page 16

    16 flash lite global functions 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 l...

  • Page 17

    Geturl() 17 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 operat...

  • Page 18

    18 flash lite global functions 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 ...

  • Page 19

    Gotoandstop() 19 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. Frame a number representing the frame number, or a string representing the label of the frame, to which the ...

  • Page 20

    20 flash lite global functions 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...

  • Page 21

    Int() 21 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 . Ifframe...

  • Page 22

    22 flash lite global functions length() availability flash lite 1.0. Usage length(expression) length(variable) operands expression a string. Variable the name of a variable. Description string function; returns the number of characters of the specified string or variable name. Example the following ...

  • Page 23

    Loadmovie() 23 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 representi...

  • Page 24

    24 flash lite global functions loadmovienum() availability flash lite 1.1. Usage loadmovienum(url, level [, method]) operands url 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 fla...

  • Page 25

    Loadvariables() 25 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() ...

  • Page 26

    26 flash lite global functions 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...

  • Page 27

    Mbchr() 27 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 a...

  • Page 28

    28 flash lite global functions 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);// outpu...

  • Page 29

    Mbsubstring() 29 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. Example the following examples convert the characters in the mystring v...

  • Page 30

    30 flash lite global functions 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; extr...

  • Page 31

    Nextscene() 31 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 f...

  • Page 32

    32 flash lite global functions 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 num...

  • Page 33

    On() 33 on() availability flash lite 1.0. Usage on(event) { // statement(s) } operands statement(s) the instructions to execute when event occurs. Event this trigger is called an event. When a user event occurs, the statements following it within curly braces ( {} ) execute. Any of the following val...

  • Page 34

    34 flash lite global functions 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 asc...

  • Page 35

    Prevframe() 35 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, an...

  • Page 36

    36 flash lite global functions 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 p...

  • Page 37

    Removemovieclip() 37 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);/...

  • Page 38

    38 flash lite global functions 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 containe...

  • Page 39

    Stop() 39 setproperty() availability flash lite 1.0. Usage setproperty(target, property, value/expression) operands target the path to the instance name of the movie clip whose property is to be set. Property the property to be set. Value the new literal value of the property. Expression an equation...

  • Page 40

    40 flash lite global functions 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...

  • Page 41

    Substring() 41 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 ...

  • Page 42

    42 flash lite global functions operands string the string from which to extract the new 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 function; extracts part of a string. T...

  • Page 43

    Togglehighquality() 43 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...

  • Page 44

    44 flash lite global functions trace() availability flash lite 1.0. Usage trace(expression) operands expression 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. Descri...

  • Page 45

    Unloadmovienum() 45 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...

  • Page 46

    46 flash lite global functions.

  • Page 47

    47 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 ret...

  • Page 48

    48 flash lite properties / (forward slash) availability flash lite 1.0 usage / /targetpath /:varname description identifier; specifies or returns a reference to the main movie timeline. The functionality provided by this property is similar to that provided by the _root property in flash 5. Example ...

  • Page 49

    _currentframe 49 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 ...

  • Page 50

    50 flash lite properties 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() _f...

  • Page 51

    _framesloaded 51 _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 ...

  • Page 52

    52 flash lite properties _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) { tellta...

  • Page 53

    _level 53 _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 targe...

  • Page 54

    54 flash lite properties 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...

  • Page 55

    _rotation 55 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 availab...

  • Page 56

    56 flash lite properties 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 li...

  • Page 57

    _visible 57 _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: loadmovi...

  • Page 58

    58 flash lite properties 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 ...

  • Page 59

    _xscale 59 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 t...

  • Page 60

    60 flash lite properties 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 t...

  • Page 61

    _yscale 61 _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 a...

  • Page 62

    62 flash lite properties.

  • Page 63

    63 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 li...

  • Page 64

    64 flash lite statements break availability flash lite 1.0. Usage break parameters none. Description statement; appears within a loop ( for , do..While or while ) or within a block of statements associated with a particular case within a switch statement. The break statement instructs flash lite to ...

  • Page 65

    Case 65 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 follow...

  • Page 66

    66 flash lite statements 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. U...

  • Page 67

    Continue 67 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 if (i % 3 == 0) { i++; continue; } trace(i); i++; } in the following do..While loop, continue causes flash lit...

  • Page 68

    68 flash lite statements 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, ...

  • Page 69

    Else 69 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 inst...

  • Page 70

    70 flash lite statements 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 f...

  • Page 71

    For 71 for availability flash lite 1.0. Usage for (init; condition; next) { statement(s); } parameters init an expression to evaluate before beginning the looping sequence, typically an assignment expression. Condition an expression that evaluates to true or false . The condition is evaluated before...

  • Page 72

    72 flash lite statements 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...

  • Page 73

    Switch 73 switch availability flash lite 1.0. Usage switch (expression){ caseclause: [defaultclause:] } parameters expression any numeric expression. Caseclause a case keyword followed by an expression, a colon, and a group of statements to execute if the expression matches the switch expression par...

  • Page 74

    74 flash lite statements 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 paramet...

  • Page 75

    While 75 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 ...

  • Page 76

    76 flash lite statements.

  • Page 77

    77 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 summari...

  • Page 78

    78 flash lite operators –– (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 va...

  • Page 79

    79 == (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 ...

  • Page 80

    80 flash lite operators add (string concatenation) availability flash lite 1.0. Usage string1 add string2 operands string1, string2 strings. Description operator; concatenates (combines) two or more strings. Example the following example combines two string values to produce the string catalog. Cons...

  • Page 81

    And 81 += (addition assignment) availability flash lite 1.0. Usage expression1 += expression2 operands expression1, expression2 numbers or strings. Description operator (arithmetic compound assignment); assigns expression1 the value of expression1 + expression2 . For example, the following two state...

  • Page 82

    82 flash lite operators 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 follow...

  • Page 83

    /* (block comment) 83 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; /* (bloc...

  • Page 84

    84 flash lite operators , (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 . Example the followi...

  • Page 85

    // (comment) 85 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;...

  • Page 86

    86 flash lite operators ?: (conditional) availability flash lite 1.0. Usage expression1 ? Expression2 : expression3 operands expression1 an expression that evaluates to a boolean value, usually a comparison expression, such as x . Expression2 , expression3 values of any type. Description operator; i...

  • Page 87

    / (divide) 87 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 ( expr...

  • Page 88

    88 flash lite operators /= (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 / expr...

  • Page 89

    ++ (increment) 89 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...

  • Page 90

    90 flash lite operators example the following example uses ++ as a post-increment operator to make a while loop run five times: i = 0; while (i++ trace("this is execution " + i); } the following example uses ++ as a pre-increment operator: a = ""; i = 0; while (i a = a add (++i) add ","; } trace(a);...

  • Page 91

    && (logical and) 91 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 ...

  • Page 92

    92 flash lite operators ! (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 . ...

  • Page 93

    % (modulo) 93 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 e...

  • Page 94

    94 flash lite operators 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 nu...

  • Page 95

    * (multiply) 95 operands expression1, expression2 numbers or expressions that evaluate to numbers. Description operator (arithmetic compound assignment); assigns expression1 the value of expression1 * expression2 . For example, the following two expressions are the same: x *= y x = x * y example usa...

  • Page 96

    96 flash lite operators 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. + ...

  • Page 97

    == (numeric equality) 97 == (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 ...

  • Page 98

    98 flash lite operators > (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 expressi...

  • Page 99

    (numeric inequality) 99 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 expressi...

  • Page 100

    100 flash lite operators availability flash lite 1.0. Usage expression1 expression2 operands expression1, expression2 numbers. Description operator (comparison); compares two expressions and determines whether expression1 is less than expression2 ; if so, the operator returns true . If expression1 i...

  • Page 101

    () (parentheses) 101 example the following examples show true and false results for numeric comparisons: trace(5 trace(2 trace (10 see also le (string less than or equal to) () (parentheses) availability flash lite 1.0. Usage (expression1 [, expression2]) (expression1, expression2) expression1, expr...

  • Page 102

    102 flash lite operators 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...

  • Page 103

    Gt (string greater than) 103 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 ex...

  • Page 104

    104 flash lite operators 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...

  • Page 105

    Ne (string inequality) 105 example the following examples show true and false results: animals = "cats"; breeds = 7; trace ("cats" ge "cattle");// output: 0(false) trace (animals ge "cats");// output: 1(true) trace ("persons" ge "people");// output: 1(true) trace (animals ge "cats");// output: 1(tru...

  • Page 106

    106 flash lite operators 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 express...

  • Page 107

    – (subtract) 107 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...

  • Page 108

    108 flash lite operators 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...

  • Page 109

    -= (subtraction assignment) 109 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; otherw...

  • Page 110

    110 flash lite operators.

  • Page 111

    111 5 chapter 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 secti...

  • Page 112

    112 flash lite specific language elements _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 t...

  • Page 113

    113 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 connect...

  • Page 114

    114 flash lite specific language elements capabilities this section describes the platform capabilities and variables that macromedia flash lite 1.1 recognizes. The entries are listed alphabetially, ignoring any leading underscores. _capcompoundsound availability flash lite 1.1. Usage _capcompoundso...

  • Page 115

    Capabilities 115 _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....

  • Page 116

    116 flash lite specific language elements 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...

  • Page 117

    Capabilities 117 _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 undefin...

  • Page 118

    118 flash lite specific language elements 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 (canm...

  • Page 119

    Capabilities 119 _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...

  • Page 120

    120 flash lite specific language elements 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 = _c...

  • Page 121

    Capabilities 121 _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 val...

  • Page 122

    122 flash lite specific language elements $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. ...

  • Page 123

    Fscommand() 123 launch availability flash lite 1.1. Usage status = fscommand("launch", "application-path, arg1, arg2,..., argn") parameters "launch" the command specifier. In flash lite, you use the fscommand() function only to execute the launch command. "application-path, arg1, arg2,..., argn" the...

  • Page 124

    124 flash lite specific language elements 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. Parameter1...Parametern a comma-delimi...

  • Page 125

    Fscommand2() 125 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...

  • Page 126

    126 flash lite specific language elements 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 less- than full screen. This command is supported only when flash lite is running in stand-alone mode. It is not su...

  • Page 127

    Fscommand2() 127 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 (witho...

  • Page 128

    128 flash lite specific language elements getdatemonth availability flash lite 1.1. Description returns the month of the current date as a numeric value (without a leading 0). Example the following example collects the date information and constructs a complete date string: today = fscommand2("getda...

  • Page 129

    Fscommand2() 129 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. Example the following example collects the date information and constructs a complete date string: today = fscommand2("get...

  • Page 130

    130 flash lite specific language elements getdateyear returns a four-digit numeric value that is the year of the current date. Availability flash lite 1.1. Example the following example collects the date information and constructs a complete date string: today = fscommand2("getdateday"); weekday = f...

  • Page 131

    Fscommand2() 131 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 a mitsubishi 506i phone. Dfoma1 a mitsubishi foma1 phone. F506...

  • Page 132

    132 flash lite specific language elements case "p506i": /:mytext += "device: panasonic 506i" add newline; break; case "pfoma1": /:mytext += "device: panasonic foma1" add newline; break; case "sh506i": /:mytext += "device: sharp 506i" add newline; break; case "shfoma1": /:mytext += "device: sharp fom...

  • Page 133

    Fscommand2() 133 getfreeplayermemory returns the amount of heap memory, in kilobytes, currently available to flash lite. Availability flash lite 1.1. Example the following example sets status equal to the amount of free memory: status = fscommand2("getfreeplayermemory"); see also gettotalplayermemor...

  • Page 134

    134 flash lite specific language elements 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 ...

  • Page 135

    Fscommand2() 135 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 = fscommand2("getlanguage", "language"); switch(language) { case "cs": /:mytext += "language is czech...

  • Page 136

    136 flash lite specific language elements case "pl": /:mytext += "language is polish" add newline; break; case "pt": /:mytext += "language is portuguese" add newline; break; case "ru": /:mytext += "language is russian" add newline; break; case "sv": /:mytext += "language is swedish" add newline; bre...

  • Page 137

    Fscommand2() 137 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, ...

  • Page 138

    138 flash lite specific language elements getlocaletime availability flash lite 1.1. Description sets a parameter to a string representing the current time, formatted according to the currently defined locale. Example the following example attempts to get the current local time into the time variabl...

  • Page 139

    Fscommand2() 139 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. Example the f...

  • Page 140

    140 flash lite specific language elements 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. De...

  • Page 141

    Fscommand2() 141 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 : /:m...

  • Page 142

    142 flash lite specific language elements 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. De...

  • Page 143

    Fscommand2() 143 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 +...

  • Page 144

    144 flash lite specific language elements 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). Example the following example assigns the status...

  • Page 145

    Fscommand2() 145 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. Example the fo...

  • Page 146

    146 flash lite specific language elements 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. Example the following example sets the mypower variable to indicate the pow...

  • Page 147

    Fscommand2() 147 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). Example the following example sets the hour variable to the hour portion of the current time of day, or to -1: ho...

  • Page 148

    148 flash lite specific language elements 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 gettimesecon...

  • Page 149

    Fscommand2() 149 gettimezoneoffset availability flash lite 1.1. Description sets a parameter to the number of minutes between the local time zone and universal time (utc). Example the following example either assigns the minutes of offset from utc to the timezoneoffset variable and sets status to 0 ...

  • Page 150

    150 flash lite specific language elements 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 t...

  • Page 151

    Fscommand2() 151 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 ...

  • Page 152

    152 flash lite specific language elements 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 o...

  • Page 153

    Fscommand2() 153 the following table shows what effect each mode has, and what modes are substituted: 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"); se...

  • Page 154

    154 flash lite specific language elements 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...

  • Page 155

    Fscommand2() 155 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 fl...

  • Page 156

    156 flash lite specific language elements 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...

  • Page 157

    (logical or) operator 92 * (multiply) operator 95 *= (multiplication assignment) operator 94 + (numeric ad...

  • Page 158

    158 index 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 comme...

  • Page 159

    Index 159 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 ...

  • Page 160

    160 index 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 4...

  • Page 161

    Index 161 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.

  • Page 162

    162 index.