Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Adobe Flash

Flash Reference Guide

📄 Contents

  1. Flash Guide 2006
  2. Welcome to the New Flash Reference Guide
  3. Flash Design Guide
  4. Introduction To Flash
  5. Working with the Authoring Tool
  6. Working with Templates
  7. FreeHand for the Power User
  8. Creating Animation with Fireworks
  9. Creating Animation in Flash
  10. Animating Text
  11. Working With Layers and Keyframes
  12. Working With Tweens
  13. Quickly Add Keyframes to Tweens
  14. Using Animation Paths
  15. Using Flash's Onion Skinning Tools
  16. Publishing Your Animation
  17. Preloading for Non-Programmers
  18. Drawing in Flash
  19. Using the Library
  20. Organizing Animations With Storyboards
  21. Working With Masks
  22. Making 2D Look 3D
  23. Working With Text
  24. Working With Input Text Fields
  25. Working With Dynamic Text
  26. Working with Text: Advanced Text Treatment With CSS
  27. Working With Text: Embedding Fonts
  28. Flash Interactive Developer Guide
  29. What is an Interactive Developer?
  30. Creating Flash Projects
  31. Using Form Applications
  32. Working with Form Components
  33. Setting up a Movie for Design and Animation
  34. Setting up a Movie for Programming
  35. Working with Components
  36. ActionScript Fundamentals
  37. Intro to Working With Arrays
  38. Understanding The Three Types of Arrays
  39. Control Data Stored in Arrays
  40. The Eolas Solution
  41. Intro to Flash Player 9
  42. Working with Strings
  43. Creating ActionScript Transitions
  44. Working with Boolean Objects in ActionScript
  45. Optimizing Delivery
  46. Working with Numbers in ActionScript
  47. Working with the Number Class
  48. Flash Professional 9 Preview
  49. Adobe Takes ActionScript Open Source
  50. Flash Rich Media Guide
  51. Pros and Cons of Flash 8 Video
  52. Using SMIL in Flash Video 8
  53. Stream an MP3 Audio File to Your Flash Movie
  54. Flash 8
  55. Introduction to Flash 8
  56. Advanced Text Rendering
  57. Using BitmapData Class in Your ActionScript
  58. The CacheAsBitmap Property
  59. Bitmap Rendering Improvements and Blend Modes
  60. Using The ExternalInterface Class
  61. Using Filters
  62. Downloading and Uploading Files with ActionScript
  63. Runtime Support for GIF and PNG Files
  64. Garbage Collection in Flash 8
  65. Using Enhanced Gradients
  66. Using Scale 9
  67. Stroke Enhancements in Flash 8
  68. Video Support in Flash 8
  69. How to Create a Slideshow
  70. Creating Dynamic Text in Flash
  71. Flash 3-D–Taking Flash to the Third Dimension!
  72. Object Collision Detection with Flash
  73. Create a Quiz With The Flash Quiz Template
  74. Working with Flash
  75. Uses for Flash
  76. Beyond Flash
  77. Flash Reference Guide
  78. Informit Articles and Sample Chapters
  79. Books
  80. Online Resources
  81. Blogs and Discussion
  82. Tools and Downloads
  83. Summary
  84. Flash MX Interface
  85. Welcome to Flash: the Designers' and Developers' Tool
  86. Using the Stage
  87. Panels, Panels Everywhere
  88. Using the Tools Pane
  89. Using the Property Inspector
  90. Using the Timeline Panel
  91. Using the Library
  92. Adding Interaction through the Actions Panel
  93. Integrating with Studio MX
  94. Saving and Publishing Flash Movies
  95. Informit Articles and Sample Chapters
  96. Books
  97. Online Resources
  98. Summary
  99. Drawing in Flash
  100. Shape Tools
  101. Applying Color
  102. Informit Articles and Sample Chapters
  103. Tools and Downloads
  104. Summary
  105. Flash Bitmaps
  106. Importing Bitmaps
  107. Exporting Bitmap Images
  108. Converting Bitmap Images to Vector Illustrations
  109. Informit Articles and Sample Chapters
  110. Online Resources
  111. Tools and Downloads
  112. Summary
  113. Flash Text and Text Fields
  114. Text Types
  115. Input Text
  116. Online Resources
  117. Tools and Downloads
  118. Summary
  119. Using the Library
  120. Library Organization
  121. Creating Instances
  122. Informit Articles and Sample Chapters
  123. Books
  124. Online Resources
  125. Summary
  126. Flash Animation
  127. Controlling Time
  128. Keyframe Animation
  129. Tweening
  130. Text Animation with Flash
  131. Informit Articles and Sample Chapters
  132. Books
  133. Online Resources
  134. Summary
  135. Flash Audio
  136. Using Audio in Flash
  137. Importing
  138. Linking to MP3
  139. Publishing Audio
  140. Streaming MP3 from the Flash Communication Server
  141. Informit Articles and Sample Chapters
  142. Online Resources
  143. Summary
  144. Video in Flash
  145. Video
  146. Flash Video
  147. Spark Codec
  148. Exporting Video
  149. Informit Articles and Sample Chapters
  150. Blog and Discussion
  151. Summary
  152. Flash Components
  153. Attaching Components to Movies
  154. Creating a Component
  155. Informit Articles and Sample Chapters
  156. Tools and Downloads
  157. Summary
  158. Exporting and Optimization
  159. Connecting Flash to the Internet
  160. Loading SWF Movies
  161. Sharing Fonts Between Movies
  162. Reusing Your ActionScripts
  163. Using Third-Party Tools
  164. Informit Articles and Sample Chapters
  165. Online Resources
  166. Tools and Downloads
  167. Summary
  168. Introduction to Design in Flash
  169. Introduction to Design
  170. Fundamental Design Concepts
  171. Breaking Up the Screen
  172. Branding
  173. Adding Forms to Movies
  174. Developing with ActionScript
  175. Introduction to Programming within Flash MX 2004
  176. Using ActionScript to Extend the Functionality of Flash
  177. ActionScript Fundamentals
  178. Using the Actions Panel
  179. Using the Reference Panel
  180. Rapidly Adding ActionScript with the Behaviors Panel
  181. Event Handling within ActionScript
  182. Timeline Events
  183. Triggering Events through User Interaction
  184. Flash MX 2004 Pro
  185. Summary
  186. Creating Interactive Movies
  187. Giving Users a Choice
  188. What it All Comes Down to
  189. Summary
  190. Testing your Flash Movies
  191. Naming Conventions
  192. Syntax Checker
  193. Testing your movies
  194. Summary
  195. Debugging
  196. Using the "Debugger"
  197. Reviewing ActionScript Error Codes
  198. Summary
  199. Using ActionScript to Control Your Movies
  200. Setting Up Your Movies for Interaction
  201. Making Movie Clips Behave Like Buttons
  202. Controlling Multiple Movie Clips
  203. Applying Different Types of Events to a Movie Clip
  204. Summary
  205. Using ActionScript to Control Text
  206. How ActionScript Can Control Text
  207. Using Cascading Style Sheets within Flash MX 2004 Dynamic Text Boxes
  208. Applying CSS formatting with ActionScript
  209. Where Do You Go Now?
  210. The Differences Between ActionScript 1 and ActionScript 2
  211. Working with Classes
  212. Which Version of the Flash Player should you use?
  213. What’s Next?
  214. Using Pre-Built Classes In Flash MX 2004
  215. Using a Class in ActionScript
  216. The List of Core Classes
  217. Flash Player-Specific Classes
  218. Summary
  219. Creating Your Own Classes
  220. Creating a Custom Class
  221. Working with External Data in Flash
  222. Why Use XML in Flash?
  223. Integrating Flash and XML
  224. Visual Elements
  225. Adding the ActionScript
  226. Future Shock
  227. Using Components
  228. Begin Using Components
  229. Building an Application with Components
  230. Gluing Components Together with ActionScript
  231. Summary
  232. Informit Articles and Sample Chapters
  233. Books and e-Books
  234. Online Resources
  235. Rich Internet Applications
  236. Introduction to Rich Internet Applications
  237. Why Use Flash for Building Application Solutions?
  238. Building Applications with Flash
  239. Getting Started
  240. Using Flash Variables
  241. Working with Parameters in the Object and Embed HTML Tags
  242. Linking data with Flashvars
  243. Getting Data Into Flash: Loading External SWF and JPG Files
  244. Why You Should Separate Your Files
  245. Loading Movies into Levels and Target Movie Clips
  246. Summary
  247. Loading SWF and JPG Images
  248. Working With XML: What is XML, and How Does it Relate to Flash?
  249. A Brief History of XML
  250. Why Structuring Your Data is Always a Good Thing
  251. How XML Came to Flash
  252. Summary
  253. Working with XML: Good XML vs. Bad XML
  254. Good Places to Start
  255. Writing Good XML
  256. XML Tools
  257. The Next Step - Using XML in your Flash Applications
  258. Working with XML: Loading XML into Flash
  259. Integrating Flash and XML
  260. Visual Elements
  261. ActionScript
  262. Future Shock
  263. Working with XML — Dynamically Building XML with .NET, ColdFusion, Java, and PHP
  264. ColdFusion
  265. .NET
  266. Java
  267. PHP
  268. Summary
  269. Working with XML — Web Services
  270. SOAP Support in Flash MX 2004
  271. Using Components to Bind Web Services into your Applications
  272. Summary
  273. Working with Data — Working with XML
  274. XML In Flash
  275. Writing XML In Flash
  276. Building Trees of Data with XML
  277. Working with Data: Pushing Data back to the Server with Load Vars
  278. Setting up the Database
  279. Writing the VB.NET Code
  280. Creating the Flash Movie
  281. Working with Data: Leveraging Persistent Connections
  282. Using XMLSocket Connections
  283. XMLSocket Server
  284. XMLSocket Security
  285. XMLSocket Class in Flash
  286. Creating a Pong Game with an XMLSocket Server
  287. Summary
  288. Flash Remoting
  289. What is Flash Remoting?
  290. Using Flash Remoting
  291. The Future of Flash Remoting
  292. Flash Remoting Links
  293. Working with Data: Macromedia Flex Presentation Server
  294. What Problem Does Flex Presentation Server Address?
  295. How does Flex work?
  296. Coding and Building Flex Applications
  297. Building Rich Internet Applications: Connecting Flash to a Database
  298. Using FlashVars
  299. Using LoadVars
  300. Loading XML
  301. Consuming a Web Service
  302. Live data connections with XMLSocket Connections
  303. Building Rich Internet Applications: Planning, Planning, Planning
  304. A Simple Plan
  305. Tools You Can Use
  306. Applying a Discipline
  307. Building Rich Internet Applications: Design Counts
  308. Do Not Be Afraid to Ask For Help
  309. What if You Do Not Have a Ben To Call
  310. Building Rich Internet Applications: Beyond the Movie Clip
  311. UI Components
  312. Data Components
  313. Media Components
  314. Manager Components
  315. Screen Components
  316. Building Rich Internet Applications: Using Macromedia Central
  317. What Central is All About
  318. Who is Using Central?
  319. Developing for Macromedia Central
  320. Next Steps You Need to Take
  321. Building Rich Internet Applications: Using Macromedia Flex
  322. Authoring with Flex
  323. Publishing with Flex
  324. Presenting the Solution: Delivering Flash Applications to the Web
  325. Flash's own Publishing Tools
  326. Using Dreamweaver
  327. Writing your Own HTML
  328. Presenting the Solution: Delivering Flash Over Non-PC Devices
  329. Using Macromedia's Flash Lite
  330. Programming for Flash Lite
  331. FlashCast
  332. Informit Articles and Sample Chapters
  333. Books and e-Books
  334. Flash for Designers: Rich Media Production
  335. Graphic Control in Flash
  336. Drawing in Flash
  337. Importing Vector Art
  338. Importing Raster
  339. Scripting Images
  340. Introduction to the Rich Media Production
  341. Using Video, Audio and Images in your Flash Movies
  342. Using SWF Flash Movies
  343. Using JPEG Images
  344. MP3 Sound Files
  345. Flash Video
  346. Using Components to Build Rich Media Solutions
  347. Using the Loader Component
  348. Using the Media Components
  349. Controlling Components with ActionScript
  350. Controlling the Loader Component
  351. Media Components
  352. Using Audio in Flash
  353. Linking to MP3
  354. ActionScript-Controlled Audio
  355. Volume Control
  356. Publishing Audio
  357. Summary
  358. Video in Flash
  359. Working with Video
  360. Controlling Video with Components
  361. Exporting Video
  362. Summary
  363. Choosing Which Version of Flash Communication Server to Use
  364. Server Requirements
  365. Installation
  366. Running Communication Server on Different OS Platforms
  367. Pitfalls to Watch for
  368. Summary
  369. Streaming Video
  370. Live Video
  371. Broadcast Video on Demand
  372. Flash Video Components
  373. The Communication Server MX Server Code for the VideoPlayBack Component
  374. Record Video with VideoRecord Communication Component
  375. Create A Video Conference
  376. Examining the VideoConferencing Component
  377. The Communication Server MX Server Code for the VideoConferencing Component
  378. Summary
  379. Using the Microphone and Camera Core Classes
  380. Microphone
  381. Camera
  382. Constructing Large Applications That Leverage Video and Audio
  383. Configuring the Server
  384. Creating the Movie
  385. Broadcasting
  386. Summary
  387. Informit Articles and Sample Chapters
  388. Books and e-Books
  389. Matthew's Predictions for 2006
  390. Matthew's Favorite Flash Books
  391. Matthew's Favorite Flash Web Resources
  392. Macromedia as Part of Adobe
  393. First Look: Flash Player 8
  394. First, the Facts
  395. What Macromedia Brings to the Table
  396. What Adobe Brings to the Table
  397. What the Two Companies Can Do for Each Other
  398. A Brief History of Flash

Most components are comprised of two distinct elements: graphics and ActionScript (which are kept separate from each other). In this section, you create the graphics needed for the Preloader component.

  1. Create a new movie. Size the movie to 400 pixels x 200 pixels. The size of the movie is not critical to the final component; it merely gives you extra room in which to develop.

  2. On the Stage, draw a rectangle 240 pixels x 10 pixels.

  3. Select the rectangle, press F8, and convert the shape into a Movie Clip; name it bar_graphic.

  4. Create a new Movie Clip in the Library and name it color.

  5. Edit the color Movie Clip. In the center of it, create a blue rectangle 240 pixels x 40 pixels. You need to use the content of the bar_graphic Movie Clip in a second movie. Drag a second instance of the bar_graphic from the Library; select the new instance. In the Property Inspector, name the instance bar_clip. The Clip maintains all the visual elements of the bar_graphic Clip. Edit the Clip and fill its center with the color #6600CC.

  6. Combine the Movie Clips for the final movie. In the Library, create a new Movie Clip and name it bar_clip. Edit the Movie Clip and give it two layers, labeled Alpha and Color. Drag the Color layer beneath the Alpha layer. Select the Color layer. Drag the instance of the color Movie Clip into the center of the Stage. Select the Alpha layer and drag an instance of bar_graphic Movie Clip over the color Movie Clip. With the bar_graphic still selected, select Alpha from the color drop-down menu in the Property Inspector. Change the Alpha level to 70%. The color Movie Clip should now be visible through the bar_graphic Movie Clip.

  7. From the Library, create another Movie Clip and name it preload_clip. Edit the preload_clip. Drag an instance of bar_graphic onto the center of the Stage within the preload_clip movie instance. Name the bar_graphic Movie Clip bar in the Property Inspector.

These few steps are all you need to build all the graphical elements for the component. It is good to get in to the habit of organizing your Library with folders for different parts of your component, which makes it easier to manage the different elements of the component.

Managing Your Library

The elements that allow you to define a component are all contained within the Library. Where you place the folders and how you name the specific movies control the way a component is constructed.

  1. Begin by organizing your Library. Create a new folder and name it Preloader Assets. Drag all the movies that you have created so far into the Preloader Assets folder.

  2. NOTE

    An Assets folder is a standard used with many components. It is used for storing Movie Clips, buttons, and graphics.

  3. Create a second folder and name it FCustomIcons. You will use this folder later in the section to create a custom icon for your component.

  4. NOTE

    The name FCustomIcons has a special meaning with Flash MX. A bitmap file added to this folder with the same name as the component will become the default icon for the component.

  5. In the Library, create a new Movie Clip and name it Preloader. Do not place this Movie Clip in a folder; it becomes the component.

Creating the Component

As a designer, you want to control how the text appears in the Preloader.

  1. From the Library, select the Preloader Movie Clip and open it in Edit mode. Select Frame 1 of the movie. Add the following ActionScript (notice that it is the same Preloader script created earlier in this section):

  2. myformat = new textformat()
    myformat.font = txtfont;
    myformat.color = txtcolor;
    myformat.bold = txtbold;
    myformat.italic = txtitalic;
    myformat.size = txtsize;
    myformat.align = "center"
    preloader._visible=false;
    if (preloader.percentbytes >= 100){	
    _root.play();
    }
    myColor = new Color(preloader.bar.barcolor);
    myColor.setRGB(barcolor);

    This code establishes variable names for a variable called myformat. Notice that myformat is the name of the text box programmatically created in your script. The value of creating a component is that you can manipulate parameters within the component; for example, font type, size, and color. Parameters can be set up in a component to allow you to have this level of control.

  3. Right-click the Preloader Movie Clip in the Library. Select Component Definition, and the Component Definition window opens. In the Parameters section, select the + symbol and add a new parameter.

  4. Name the variable Font Face. This name appears in the Parameter name for this component. Next, link this name to a variable you created in your earlier ActionScript; in this case, the variable is txtfont (for variable, type txtfont). From the drop-down menu in the type field, choose Font Name. This option defaults the Value field to list Fonts. Choose _sans.

  5. Add a second parameter and name it Font Color. Choose the variable to be txtcolor and the type field to be color. The value should be #000000 (this is the hex number for black). You need to add variables that reference Txtbold, Txtitalic, Txtsize, barcolor, and txtstyle. Each of these variables controls visual elements you see on the Stage.

  6. Enter Preloader for ToolTip text and click OK.

  7. The icon for the movie has now changed to show that the Movie Clip is now a component.

  8. At this point, the component is done. Drag an instance of it onto the Stage and observe the parameters you can change in the Property Inspector. You can leave the component as is, but the next section shows you how to take it a few steps further to make the component very useful.

Creating a Custom Icon

When you set up the Library for the component, you added a folder called FCustomIcons. This folder is special in that it tells Flash to look for a match between a graphic file and the component. If the graphic and the name match, the component adopts the graphic image as the default image for the component. Follow these steps to create a custom icon of your own:

  1. Create an icon. You can create icons with the PNG, GIF, or JPEG image formats. The image should be 23 pixels x 20 pixels to fit on the Components panel.

  2. Import an image that will be used as the icon directly into the Library.

  3. Move the image into the FCustomIcons folder. Rename the image to the same name as the component—the names must be identical.

  4. Close the Library.

  5. Reopen the Library. The symbol for the component should now look like the graphic you imported.

The possibilities are limitless as to what you can use as the graphic for your component. Let your imagination go wild!

Placing the Component in the Components Panel

So now you have a component that works, and it has a cool icon. Now you need to be able to use the component each time you run Flash MX. To be able to do so, all you need to do is save the Preloader.fla file to a special place within the configuration folder for your computer.

Each computer's operating system keeps the components in a different place. Check Table 1 for your computer operating system type.

Table 2 Where to Save Components

Operating System

Location

Windows 2000 and XP

C:\Documents and Settings\User\Application Data\Macromedia\Flash MX\Configuration\Components\

Windows 98 and ME

C:\Windows\Application Data\Macromedia\Flash MX\Configuration\Components\

Windows NT

C:\WinNT\Profiles\User\Application Data\Macromedia\Flash MX\Configuration\

MAC OS X

Hard Drive:Users:Library:Application Support:Macromedia:FlashMX:Configuration:Components

Mac OS 9.x (multi-user)

Hard Drive:Users:User:Documents:Macromedia :FlashMX:Configuration:Components:


After you place the file in the correct folder, close Flash MX. When you reopen Flash, go to the Component folder to find your new component. Whenever you open any new file, you have access to the component.

You now need to know how to package the component for distribution over the Internet. To package the component, you have to create a file that is controlled by the Macromedia Extension Manager, which is a cool tool that allows you to add any number of new extensions for any Macromedia product.

NOTE

The Extension Manager is installed as part of the Flash MX installation.

You can create the files needed to distribute the Preloader by first creating an MXI document called Preloader.mxi. This file contains the information that the Extension Manager needs to create a packaged file for distribution over the Internet. You can download this sample file from the web site.

The following tutorial explains how to package your components into a portable format using the Macromedia Extension Manager.

  1. Copy the Preloader.fla file to a new folder.

  2. Open Notepad or any text editor and create a file called Preloader.mxi. Save this file to the same folder that contains your component. This MXI file tells the Extension Manager where to place the Preloader.fla file.

  3. Open the MXI folder and add the following XML script:

  4. The following code allows you to give the component some properties. The first is ID—each component you create must have a unique ID. The Extension Manager does not load the movie if you do not provide a unique ID.

    The second and third lines allow you to give your Preloader a name and a version. You can create a component and keep modifying it over a period of time. Each time you modify a component and package it with the Extension Manager, give the component a version number, which enables you to track which version of the component you are distributing.

    The type definition identifies what kind of component you are creating. The standard is to label them Flash Component.

    The product name identifies which Macromedia product your extension is being created for. The Extension Manager manages all extensions for Flash MX, Dreamweaver MX, Fireworks MX, and UltraDev. Type in Flash for the name and add 6 as the version number. (This refers to Flash MX, which is the sixth major release of Flash.)

    You can also add your own name, which shows up in the Extension Manager.

    TIP

    I always add my Web site address for just a bit of free advertising.

    <macromedia-extension id="md05072002" 
    name="Preloading Component"
    version="1.0"
    type="Flash Component"
    requires-restart = "false">
    <!-- List the required/compatible products -->
    <products>
    <product name="Flash" version="6" primary="true" /> 
    </products> 
    <!-- Describe the author -->
    <author name="Matthew David - http://www.matthewdavid.ws" />
    <!-- Describe the extension -->
    <description>
    <![CDATA[

    The following section of code from the MXI script describes where the Preloader component is installed. You want to install the component in the Components folder for Flash MX. You do not know which system Flash MX is installed or how a user has installed it. To solve this problem, the Extension Manager allows you to add a $ symbol before flash/Components.

    NOTE

    The dollar sign is a special character that tells the Extension Manager to look for the directory in which Flash is installed. This works for all computer systems supporting the Extension Manager.

    ]]>
    </description>
    <!-- Describe where the extension shows in the UI of the product -->
    <ui-access>
    <![CDATA[
    ]]>
    </ui-access>
    <!-- Describe the files that comprise the extension -->
    <files>
    <file source="preloader.fla" destination="$flash/Components" />
    </files>
    </macromedia-extension>

    NOTE

    For more information on how the MXI file format is broken down, visit this web site.

  5. Save the file.

  6. Open the Extension Manager.

  7. Choose File, Package Extension. A window opens that allows you to select the MXI file you have created.

  8. Navigate to the Preloader.mxi file. Click OK. You are asked where Preloader.mxp should be saved. Save it to your desktop.

You have now packaged your Preloader component in a file type that can be sent to any Macromedia Flash MX user. The final file can be sent to any person through e-mail, downloaded off a web site, or submitted to the Macromedia Exchange. Your component is now portable.

TIP

You can download and install dozens of components with the Extension Manager. You can find many at these three sites:

You now have a fully functional Preloader. To see how easy it is to now use this component, reopen a movie. Drag and drop the Preloader component from the Components panel on the movie. Without having to write any ActionScript, you add a Preloader.

Peachpit Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Peachpit and its family of brands. I can unsubscribe at any time.