Page 2
If you access a third-party website mentioned in this guide, then you do so at your own risk. Macromedia provides these links only as a convenience, and the inclusion of the link does not imply that Macromedia endorses or accepts any responsibility for the content on those third-party sites.
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 .
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 ActionScript, plus additional commands and properties specific the Flash Lite player, such as the ability to initiate phone calls or text messages, or get time and date information from the device.
fscommand2() function Like the function, you use fscommand() fscommand2() communicate with the host environment or system—in this case, the mobile phone or device. function provides enhancements to , including the ability fscommand2() fscommand() to pass an arbitrary number of arguments and to retrieve immediate return values (rather than having to wait until the next frame, as with fscommand() Differences between Flash Lite 1.0 and...
property. _soundBufTime property. _url conversion function. String() 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 programming features available in more recent releases of Flash Player or other programming languages that you might be familiar with.
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 applications. If you’re unfamiliar with Flash 4 ActionScript syntax and features or if you’ve forgotten some of the details from previous Flash development work, this chapter provides a primer on using Flash 4 ActionScript in your Flash Lite applications.
function lets you set a property of a movie clip instance, as shown in the setProperty() 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 set movie clip properties from within a statement.
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 variable on the main timeline: /:car _root.car The following example shows the variable in a movie clip instance that resides on the main timeline:...
In addition to letting you reference existing variables, you can also use the function on eval() the left side of a variable assignment to create variables at runtime. For example, suppose you want to maintain a list of high scores as a user plays a game. Each time the user completes a turn, you add their score to the list: eval("highScore"...
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 ActionScript function to execute code that resides on an call() arbitrary frame in the timeline.
Page 14
A call clip contains a keyframe for each function you want to create. You typically label each keyframe according to its purpose. Macromedia also recommends that you create a new layer for each new keyframe, and that you give each layer the same name as the frame label you assign to the keyframe.
Page 15
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. Insert a keyframe on Frame 2 of the function1 layer, and another keyframe on Frame 3 of the function2 layer, as the following figure shows: Select the keyframe on the Actions layer and open the Actions panel.
Page 16
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. Open the Library panel (Window > Library) and drag the Call Clip symbol to the work area around the Stage.
Using the eval() function function lets you dynamically reference variables and movie clip instances at eval() runtime. The function takes a string expression as a parameter and returns either the eval() value of the variable represented by that expression or a reference to a movie clip. For example, the following code evaluates the value of the ActionScript variable and name...
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 following topics: Determining device and platform capabilities .
This is the getURL() same way you open a web page from a desktop Flash application. For example, the following opens the Macromedia web page: getURL("http:www.macromedia.com"); Flash Lite processes only one action per frame or per event handler.
The following code attempts to initiate call to 555-1212: getURL("tel:555-1212"); Flash Lite only processes one action per frame or per event handler. Certain getURL() handsets restrict the action to keypress events only, in which case the call getURL() getURL() is processed only if it is triggered within a keypress event handler. Even under such circumstances, only one action is processed per keypress event handler.
You can optionally specify the message subject and body in the URL’s query string, as follows: getURL("mailto:mobile-developer@macromedia.com?subject=Flash Lite"); To specify just the message body in the query string, use the following code: getURL("mailto:mobile-developer@macromedia.com?body=More+info+please"); Loading external SWF files function lets you load SWF files from a network or local file.
Page 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 following: Transfer the text file to your device and put it in the same folder as the SWF file.
Page 24
Select the first (top-most) text field, and in the Property inspector, type in the Var item_1 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 In the same manner as described in the previous two steps, give the remaining four text fields the variable names , and item_2...
Need help?
Do you have a question about the FLASH 8-LEARNING FLASH LITE 1.X ACTIONSCRIPT and is the answer not in the manual?
Questions and answers