Notes: Brand New from Publisher. No Remainder Mark.
Product Description Users new to the software as well as veteran users unfamiliar with added features need quick access to key features and fundamental techniques. Adobe Flash CS4 Professional: 100 Essential Techniques provides users with what they need to know to start working in Flash. Each technique is presented in a self-contained unit of one or two pages so users can dive in and start working right away, unencumbered by lengthy descriptions or technical detail. For example, if rea… More >>
Flash’s default code color scheme has a few problems. The white background can strain your eyes and the keywords and identifiers share the same color, so you can’t automatically tell them apart. In this Quick Tip, you’ll learn how to customize these colors to make your code more readable.
In this Quick Tip I’ll show you how to use Config Constants to compile different debug and release versions of your code, so you can easily switch between them.
Step 1: Config Constants Settings
A lot of people don’t know about Flash’s Config Constants because they’re new to CS4 and because they’re buried deep within two sets of tabs and two different windows. Here’s how to find them:
In your Flash file, open the Publish Settings (File > Publish Settings…) and click the Flash tab. Click the Settings button next to the Script: Actionscript 3.0 pulldown.
In this new window click the Config constants tab at the far right.
Step 2: Add the DEBUG Constant
You should see one constant (FLASH_AUTHORING) already in the list. Now we’ll add one of our own.
Click the plus button to add a new constant and give it the name ‘CONFIG::DEBUG’. In the Value field enter ‘true’.
The interface here is pretty poor. If you’re having trouble getting the Value field to gain text focus try double clicking somewhere in that giant empty space to the right of the constant you just created. A little higher… more to the right… there! Remember CS5 is out soon – maybe they’ll have fixed this.
Step 3: Use the Constant in Your Code
Now that we have the DEBUG constant set up in our Flash file we can use it anywhere in our code:
trace("This code will only be compiled if DEBUG is true.");
The code that you place in between the braces will only be compiled into your SWF if the DEBUG constant is set to true.
Step 4: The Debug Publishing Profile
You can go into the Publish Settings and change the value of the DEBUG constant each time you want to switch between compiling a release and a debug version, but that quickly becomes tedious. To save some time you can set up a couple of different publishing profiles.
Go back to the Publish Settings and Click the ‘Rename Profile’ button. For some reason the icon for this is an ‘i’.
Name your profile ‘Debug’.
While you’re in here you might want to set some of the other options that will be handy for a debug build, like Permit debugging. I also find it helpful to change the audio compression settings for faster publishing of debug builds.
Step 5: The Release Publishing Profile
Once you have your Debug profile set up, hit the ‘Duplicate Profile’ button and name the new profile ‘Release’.
Define the settings for your release version. (Turning off Permit debugging, etc.)
Step 6: Change the DEBUG Constant
Go back to the Config constants in your Release profile and change the DEBUG constant’s value to ‘false’.
That’s it! You now have an easy way to switch between debug and release versions of your code.
This can be really handy in situations where you need different code in your program while you’re testing it than you’ll have in the final version. For example, if you’re game gets some of its data from a server or from another SWF that you don’t have access to while testing, you can feed in fake data to the Debug version.
You could also use it to set your game to start on the level you’re trying to test, without having to play through the entire the game.
When you’re done testing, just switch back to the Release profile and republish.
Check this video out at Hi-Res here: www.tutvid.com We will make a nice little photo gallery in Flash in the following tutorial. All you need are a few images and a few thumbnails for them, the rest is just follow along and it works with any images!
Hey there and welcome to "Flash Video Training Source", a resource for anybody interested in learning more about Adobe's great tool. We feature educational videos, which will help you master Adobe Flash and help you get to know all of its features. We at "Flash Video Training Source" believe that video training and video... more
Why don't you follow us on Twitter and get the latest video tutorials twitted to your account. Just click on the floating twitter bar to your right!