By Tommi West
16 January 2012
16 January 2012
Previous experience working with Flash Professional is recommended. Refer to Avoiding common authoring mistakes to find links to other articles in this series.
This article contains recommendations you can follow to avoid issues that may occur when compiling and publishing your SWF files from Adobe Flash Professional. For example, always check the ActionScript version you are targeting in the Publish Settings dialog box before you publish any SWF files. Also, be aware of any external or linked files and take care to maintain the project structure to avoid broken paths.
The Publish Settings dialog box includes the option to generate associated files as the SWF file is published. You can choose to publish SWC files as well as creating an HTML wrapper, GIF image, JPEG image, PNG image, Windows projector, or a Mac projector.
The HTML Wrapper file is especially handy because it contains the object code needed to display the SWF file in a browser. Unless you are planning to insert the SWF file in an existing HTML page, you'll usually want to create the HTML wrapper file whenever you are publishing a SWF file that will be uploaded online as part of a website.
Of course you can also use Dreamweaver to insert your SWF and FLV files into HTML pages, but if the entire page is comprised of the Flash movie, it makes sense to let Flash generate the HTML page for you.
Choose File > Publish Settings to open the Publish Settings dialog box. In the column on the left side, select the HTML Wrapper option (see Figure 1).
Figure 1. Select the HTML Wrapper option in the Publish Settings.
When you first create a new file in Flash, the New Document dialog box enables you to choose between an ActionScript 3 and an ActionScript 2 file. Take care to select the version of ActionScript that matches the code you'll be adding to your project. Never combine ActionScript 2 and ActionScript 3 in the same FLA file.
Additionally, when you choose File > Publish Settings, there's a menu at the top to choose the ActionScript version used when compiling the SWF file during the publishing process.
If you choose a version of ActionScript that does not match the code, it's likely that the project will break. The two languages behave differently and Flash Player cannot process ActionScript 2 and ActionScript 3 code simultaneously.
If a published project is not behaving as expected, double-check the version of ActionScript in the Publish Settings to verify the correct version is selected.
When you publish SWF files, they are automatically generated in the same folder as the master FLA file, and they use the same file name as the FLA file (with a SWF extension). Since there can only be one FLA file with a specific name in a folder at one time, this usually prevents the possibility of accidentally overwriting an existing SWF file. This is true with the exception of previous iterations of the same FLA file; if you publish a SWF file after already publishing it, the newest version of the file overwrites the older version.
However, be cautious about how you name files and how you move files between folders. For instance, if you have two projects in different folders and the FLA file names are the same, and then later you replace one FLA file with another (different project with the same name), you can inadvertently overwrite Project A's SWF file with Project B's SWF file, if you swap the FLA files and then publish the second project.
It's a best practice to save periodic backups of all your FLA files, so that you can easily revert to an earlier version if necessary.
Never use absolute paths to link a Flash project to external files, such as Runtime Shared Libraries, AS class files, and rich media (digital video and audio files). An absolute path will include the folder structure of your personal computer. Absolute paths will break if other developers open the project using their machines.
Always use relative paths to link to external project assets. Relative links are portable, so you can share projects with team members and not worry that the paths may break.
To learn more, read the section on Absolute paths in the Flash Professional online documentation.
Find out more about publishing SWF files by reading the following sections of the Flash Professional online documentation:
Refer to Avoiding common authoring mistakes to find links to other articles in this series.
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
More Like This
- Writing and running functional tests for Flash with Selenium RC
- Optimizing Flash performance
- Optimizing performance for mobile AIR applications
- Avoiding performance issues in Flash
- Strategies for organizing Flash projects
- Creating preloaders using ActionScript 3
- Avoiding common Timeline errors in Flash
- Optimizing content for Apple iOS devices
- Image rasterization in Flash Professional
- Guide for Apple App Store submissions