MACROMEDIA FLASH 8-LEARNING FLASH LITE 1.X ACTIONSCRIPT Manual

Summary of FLASH 8-LEARNING FLASH LITE 1.X ACTIONSCRIPT

  • Page 1

    Learning flash lite 1.X actionscript.

  • 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 chapter 1: about flash lite 1.X actionscript . . . . . . . . . . . . . . . . . . 5 flash lite 1.X actionscript overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 differences between flash lite 1.0 and flash lite 1.1 actionscript . . . 6 flash 4 actionscript not support...

  • Page 4

    4 contents.

  • Page 5

    5 1 chapter 1 about flash lite 1.X actionscript you use actionscript to add programming logic and interactivity to your macromedia flash lite applications. The version of actionscript in flash lite 1.0 and 1.1—referred to collectively as flash lite 1.X actionscript—is a hybrid of flash 4 actionscrip...

  • Page 6

    6 about flash lite 1.X actionscript fscommand2() function like the fscommand() function, you use fscommand2() to communicate with the host environment or system—in this case, the mobile phone or device. The fscommand2() function provides enhancements to fscommand() , including the ability to pass an...

  • Page 7

    Features not available in flash lite 1.X actionscript 7 ■ the _soundbuftime property. ■ the _url property. ■ the string() conversion function. Features not available in flash lite 1.X actionscript because flash lite player is based on an older version of flash player, it does not support all the pro...

  • Page 8

    8 about flash lite 1.X actionscript.

  • Page 9

    9 2 chapter 2 flash 4 actionscript primer flash lite 1.X actionscript is based on the version of actionscript that was first available in flash player 4. Consequently, several programming features available in later versions of flash player (for desktop systems) are not available to flash lite 1.X a...

  • Page 10

    10 flash 4 actionscript primer the setproperty() function lets you set a property of a movie clip instance, as shown in the following example: setproperty(cartoonarea, _x, 100); the following example is equivalent to the previous example but uses dot syntax: cartoonarea._x = 100; you can also get or...

  • Page 11

    Emulating arrays 11 using variables to specify a variable on a timeline, use slash syntax (/) combined with dots (..) and colons (:). You can also use the dot notation. The following code refers to the car variable on the main timeline: /:car _root.Car the following example shows the car variable in...

  • Page 12

    12 flash 4 actionscript primer in addition to letting you reference existing variables, you can also use the eval() function on the left side of a variable assignment to create variables at runtime. For example, suppose you want to maintain a list of high scores as a user plays a game. Each time the...

  • Page 13

    Using the call() function to create functions 13 using the call() function to create functions you can’t define or call custom functions in flash lite as you can in flash player 5 and later. However, you can use the call() actionscript function to execute code that resides on an arbitrary frame in t...

  • Page 14

    14 flash 4 actionscript primer you can also call code that resides on another timeline, such as a movie clip’s timeline. To execute the code, specify the movie clip instance name followed by a colon, and then the frame number or label. For example, the following actionscript calls the code that resi...

  • Page 15

    Using the call() function to create functions 15 4. Click the add new layer button the timeline window twice to insert two new layers. Name the top layer actions, the second layer function1, and the third layer function2. 5. Insert a keyframe on frame 2 of the function1 layer, and another keyframe o...

  • Page 16

    16 flash 4 actionscript primer 11. Set your document’s view to include the work area around the stage by selecting view > work area. Because the call clip doesn’t need to be visible to the user, you can place it in the work area. 12. Open the library panel (window > library) and drag the call clip s...

  • Page 17

    Using the eval() function 17 using the eval() function the eval() function lets you dynamically reference variables and movie clip instances at runtime. The eval() function takes a string expression as a parameter and returns either the value of the variable represented by that expression or a refer...

  • Page 18

    18 flash 4 actionscript primer.

  • Page 19

    19 3 chapter 3 common scripting tasks this chapter discusses common flash lite scripting tasks for working with the user’s device. These include, for example, getting device capability information, initiating phone calls and text messages, and determining network status. This chapter contains the fo...

  • Page 20

    20 common scripting tasks typically, you use capability variables to determine if a device supports a specific feature before attempting to use that feature. For example, suppose that you wanted to develop an application that downloads data from a web server using the loadvariables() function. Befor...

  • Page 21

    Initiating a text or multimedia message 21 the following code attempts to initiate call to 555-1212: geturl("tel:555-1212"); flash lite only processes one geturl() action per frame or per event handler. Certain handsets restrict the geturl() action to keypress events only, in which case the geturl()...

  • Page 22

    22 common scripting tasks initiating an e-mail message you can use flash lite to initiate an e-mail message. To initiate an e-mail message, you use the geturl() command and pass it the mailto: protocol, followed by the recipient’s e-mail address. You can optionally specify the message subject and bo...

  • Page 23

    Loading external data 23 this example assumes that the data file and the swf are both located in the same folder, either on your computer (when you test in the emulator) or on the device’s memory card (when you test on an actual device). To test the application on the device, you must do one of the ...

  • Page 24

    24 common scripting tasks 5. Select the first (top-most) text field, and in the property inspector, type item_1 in the var text box. This variable name corresponds to the name of the first variable defined in the data.Txt file you created previously ( item_1=hello ). 6. In the same manner as describ...

  • Page 25

    25 index a arrays, emulating with strings 11 c call() function, using 13 concatenate strings 12 e e-mail message, starting 22 eval() function, using 17 f flash lite 1.X actionscript differences between 1.0 and 1.1 6 features not available in 7 overview 5 unsupported flash 4 actionscript 6 function c...

  • Page 26

    26 index v variables dot syntax and slash syntax 11 referencing 11 referencing dynamically 17 w web page, opening 20