When you develop applications inside the Flash IDE you can see all the trace output inside Trace panel of IDE. However, there are lots of cases when you need to test your applications in browser and not as a standalone application. This makes impossible reading trace output and makes debugging your applications hard.
Solution
To see trace output outside the Flash IDE you need external application. In this article we will use applications called Vizzy.
Sometimes when you develop your flash project there's a need to make a final test before you upload swf to the website. The most convenient way for that is to launch your application locally inside a web browser rather then pressing Test Movie in Flash IDE to make sure everything works as expected. You open your project in a browser window and it loads but does not work.
Solution
To analyze possible failure reason you need a trace tool that will show you debug content of flash player. When application works by running in Flash IDE and does not work in a browser then most probably this is a security sandbox violation.
I want to use an itemRenderer for multiple columns that changes background colour of a cell depending on the data. The default renderer for a DataGrid cell does not have BackgroundColor. In the update DisplayList function, to draw your own background, you have to create a custom itemRenderer to do the task.
Solution
For example, two columns of X and Y values are created in a DataGrid: if any of the values exceeds 100, the cell background will be red. I will use the same itemRenderer for both columns since the two columns behave the same.
What if you have a bunch of code that is only used for debugging your application and it is making your compiled swf a little heavy. You don't really want this code in your production environment and you would like a way to compile different versions of your swf based on some kind of conditional to define your swfs environment.
Solution
The MXMLC has a built in way to handle conditional compiling! It is done by defining constants for the compiler and then referencing these in your code. It has a couple of odd things you have to take into account but it works quite well.
When you develop applications inside the Flash IDE you can see all the trace output inside Trace panel of IDE. However, there are lots of cases when you need to test your applications in browser and not as a standalone application. This makes impossible reading trace output and makes debugging your applications hard.
Solution
To see trace output outside the Flash IDE you need external application. In this article we will use applications called Vizzy.
Sometimes when you develop your flash project there's a need to make a final test before you upload swf to the website. The most convenient way for that is to launch your application locally inside a web browser rather then pressing Test Movie in Flash IDE to make sure everything works as expected. You open your project in a browser window and it loads but does not work.
Solution
To analyze possible failure reason you need a trace tool that will show you debug content of flash player. When application works by running in Flash IDE and does not work in a browser then most probably this is a security sandbox violation.
What if you are creating an application that compile size matters and you want to use JSON strings to get data into your application. JSON stands for JavaScript object notation, it is a more condense data format then XML and is able to define different types of data not just Strings. You can use the Adobe Core Lib classes to parse this information but these classes add a little extra weight to your application and in some apps this isn't ok but there is another way.
Solution
Because JSON is just a subset of JavaScript objects ExternalInterface can just send these objects as Strings to JavaScript within your browser and the JavaScript interpreter will send an ActionScript Object back to you with the correct types. I have also noticed that this information is parsed faster and more reliably then the standard version but remember that this is only helps you with decoding. If you would like to create a JSON string from an Object you will have to use something else.
You have a bunch of nav buttons and you want the one that was just clicked to go to an "Active" state so users can see where they are, while the others reset to their default state.
Solution
Add your buttons to an array and assign each of them the same event handler. In that handler, set all of your buttons to their default state - then set e.currentTarget to its active state. Handle your navigation logic with a switch statement in the handler.
You want to create your own Button and use it in project written in Flex Builder. You designed the Button in Flash Professional, created a pretty skin, and added label with your favorite font. But how can you easily use this button and communicate with it using the clear and strict Button class, instead of the dynamic MovieClip class?
Solution
Design your button in Flash Professional. Create class Button in your project. Set linkage to your button to Button class. Then you must embed SWF file using [Embed] metatag with param mimeType="application/octet-stream". Then, load embedded asset using Loader.loadBytes() method. Then just wait 1 frame – and you can use all possibilities of your Button.
This site is produced in partnership with
O'Reilly.