Read e-book Flash Mobile: Developing Mobile Apps Using ActionScript

Free download. Book file PDF easily for everyone and every device. You can download and read online Flash Mobile: Developing Mobile Apps Using ActionScript file PDF Book only if you are registered here. And also you can download or read online all Book PDF file that related with Flash Mobile: Developing Mobile Apps Using ActionScript book. Happy reading Flash Mobile: Developing Mobile Apps Using ActionScript Bookeveryone. Download file Free Book PDF Flash Mobile: Developing Mobile Apps Using ActionScript at Complete PDF Library. This Book have some digital formats such us :paperbook, ebook, kindle, epub, fb2 and another formats. Here is The CompletePDF Book Library. It's free to register here to get Book file PDF Flash Mobile: Developing Mobile Apps Using ActionScript Pocket Guide.

The new ActionScript is true AS3. Check out the script by opening the Actions panel. Adobe has added some great inline comments to explain how you can use this script. You will see that the code is split into two sections. The first section is a comment that explains how to modify and use the code that is generated. The second is the code itself. Test the movie and you will see a random number appear in the Output panel.

The Code Snippets panel really shows its power for allowing you to learn ActionScript quickly when you add code to movie clips on the stage. Select the rectangle tool and draw a rectangle shape on the stage. Select the new shape and convert it to a movie clip. You will see a warning appear if you have not given your movie clip a name.

Flash can do this automatically; select OK to automatically add the code snippet. Open the Actions panel and you will see that the ActionScript to trigger the event has been added Figure 3. Clicking on the symbol instance a second time stops the sound. Instructions: 1. Hang on—these new Code Snippets look very similar to Behaviors. What is the difference? Behaviors are still there, but they work only for AS2.

QUICK LINKS

The Behaviors of the panel have not been updated for Flash CS5. You will find that the Code Snippets panel is much more versatile than the Behaviors panel. Test your movie. Select your movie clip on the stage and the MP3 track will start to play. You will see that the code is formatted to take advantage of the AS3 event model. For instance, the code is not added to the movie clip itself. The event is created as two parts: a function that explains what is going to happen, and a listener event that triggers the function. Without knowing it, you are using AS3. What you will find very helpful is that you can now go into your ActionScript code and modify it easily.

For instance, you can change the path of the MP3 file to one on your own servers, or to point to a live, streamed MP3 file. This is a big move from AS2. Listeners are more complex to work with, but in the end, give you more flexibility. There are essentially two parts to a Listener: The first is a function that describes what is going to happen when you trigger an event, and the second is the Listener that waits for a specified event to happen, such as mouse clicking on a button. The following steps will add an AS3 event that mimics the same event as the AS2 example earlier.

On the stage create a new movie clip. Create a new layer in the timeline and name it Actions. Select the new layer. Open the Actions panel.

The first step is to create the function. There is only one instruction in the function, the gotoAndStop function that will move the Timeline to frame Add the listener that will look to trigger the function.

006 Flash CS5 5 Tutorial Android App Orientation Change Size Actionscript 3 0 Android App Development

The second part of the Listener, addEventListener, instructs Flash that you are using the Listener object. In parentheses are two parts, which explain that the event is a mouse event and to use the function gotoFunction. At first blush, the new AS3 event model appears to be too complex. After all, AS2 is easier to use. The difference between the two is that the AS3 event model gives you flexibility to write more complex scripts and to extend the functionality of the event model beyond traditional mouse and keyboard interfaces.

To do this you use the core object class controlling events on the screen, called the EventsDispatcher class. Through this you can not only leverage standard events such as mouse clicks and the keyboard, but you can extend the class with your event types. Working with Classes A common design pattern in object-oriented programs separates design, programming, and data elements. Flash CS5 adds this functionality with the inclusion of classes. A class is a packaged document that you can use to explain how UI components, business logic, and data elements will interact.

A class is a separate ActionScript file that is associated with the main Flash file and movie clips. A Class file is only a text file. It is very easy to create entire Flash movies using just Class files and not even add any content into a traditional timeline. These steps will show you how to create a simple Class file for your Flash movies: 1. In the new, blank helloWorld. Expand the Publish setting. You will see a Class field.

To the right-hand side of the Class field is a small pencil icon. Select the icon. A new window will open asking you if you want to create a new class. Create a new class and call it helloClass. A new ActionScript file will open. Notice that the file is now labeled helloClass. The class is a default, blank class with the ActionScript shown in Figure 3. Adding Class References to Movie Clips Separate class references can be added directly to movie clips in your library. Open the Library panel and right-click on a movie clip and select the Properties option.

The Symbol Properties window will open. In the Linkage group select the Export for ActionScript option.

Download e-book Flash Mobile: Developing Mobile Apps using ActionScript (Visualizing the Web)

A class is automatically created for the symbol using the name of the movie clip. You can now modify the Class file for the movie clip in your favorite text editor. Save your Class file. Return to the helloWorld. Classes provide you a way in which you can create public and private class elements. The difference between the two is related to how you use the data. For instance, a public property can be shared throughout your whole Flash movie.

Join Kobo & start eReading today

A private property can only be used within the class in which it is defined. Using Namespaces in Your Projects Namespaces are ways in which you can define the visibility of properties you are creating. The role of this class is to pull in an XML document and step through the formatting of the code. Using namespaces you can instruct Flash where to find a definition of the document type you are using, in this case an RSS formatted document type.

Create a new ActionScript 3. Create the class NamespaceExample.

Download FDT now!

Open the NamespaceExample class. You are going to extract the following: title, creator, date, link, and description. Each of these items will be formatted in accordance to the namespace called RSS. As with all core classes in Flash, you can extend the namespace to use it in conjunction with other objects and data types.

Controlling Data There are several key ways to control data in AS3. They include arrays, shared objects, and XML. An array is the first method you are likely to use in your ActionScript code. The role of an array is to create a list of data types in your code. For example, you may want to list the colors red, green, blue, and orange, as shown in Figure 3. Here you can see the data stored in an array posted to the Output Panel.

For instance, if you have five items in an array and tell the array to pull item 1, it will pull the second item. This is because the first item has the registered value of 0. What you will find is that arrays are great for managing simple lists. Additional properties allow you to remove specific values, to count the number of values you have, and to sort your lists. Using Flash Cookies The Flash Player can store data locally in very much the same way that a cookie can be stored in a web browser.

Flash does not call them cookies, but Shared Objects.

Flexible development toolkit.

You can now effectively target data to this space that can be accessed if this computer comes back to this page at a later date. You can now more easily step through your XML documents. The following will demonstrate how you can import an XML document into your Flash movie as a data type.