Thursday, February 7, 2008

Getting Strict with Compilation

Want better runtime warnings?
Check out the file "EnabledWarnings.xml".

It lives here on a Windows machine:

C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\ActionScript 3.0\

I like to enable the first three under this comment:
"<!-- Coding style preference warnings. Use these warnings if you want to be reminded to always use type declarations, acess/namespace attributes, etc. -->"

I wonder if adding a file called EnabledErrors.xml would work?

Sunday, February 3, 2008

Errors 5003 & 5005

I have to add some proof of concept files to this post. Will try to use skyDrive from MS.

Error Code 5005
Error Code 5003

These numbers mean it time to refactor.

"5003: Unknown error generating bye code."

"5005: Unknown error optimizing byte code"

They both stem from the same problem. Flash not knowing how to handle
an "Out Of Memory" error exception from Java from the (asc_authoring.jar) file. You can see this if you try
to build in Flex.

This happens when there is just too much code for it to handle with the default memory space of 128MB.

If you ever compile a SWF and just get a blank screen it could be because the SWF does not contain any of your code.

To verify this look at your generated size report file from the Flash IDE. The section which says "actionscript code bytes" will be about 16 bytes. The SWF does not know where to jump to execute your code because it has not been inserted into the SWF

This could be fixed by specifying -Xms and -Xmx command line arguments when compiling the SWF with the asc_authoring.jar file.

Unfortunately, you can't do this in the Flash IDE. I have modified the asc_authoring.jar file to see if I can actually save the parameters used in the build, so that we can use the command line with the appropriate memory setting but so far I have been unsuccessful.

Adobe support was no help with this matter. They are pretty clueless of this from my experience with them.

Temporary ways of dealing with this:
  1. Delete ASO files
  2. Comment out all trace statements.
  3. Uncheck “Reduce File Size and increase performance” in AS3 settings
  4. Create a singleton class with static empty classes that get filled in at runtime (Bridge Pattern).

Other sites mentioning these errors:
  1. www.kirupa.com
  2. www.negush.net
  3. www.ultrashock.com
Settled on solution:
Moving over to Flex and using Ant to build will resolve this error if you use the environment variable ANT_OPTS with the correct memory requirements for the build.

Saturday, February 2, 2008

Tools

The developer, in accordance with his aims, uses various tools and knows their characteristics and uses them well. This is the way of the developer.

We all know this. So I share the tools I use for compiling, debugging, finding, testing, etc.

Freeware Windows Based Tools:
Design
FreeMind to map your ideas out.
UMLPad to diagram class, state, etc. models.

Compiling
Flash Develop code editor.
Flex SDK compiler to be used in Flash Develop.
ANT is a java based build tool that uses XML for build scripts.

Debugging
Flash Debug Players to see trace statements with Flash Tracer, FDB, or in the output pane of Flash Develop.
Fiddler to sniff communications if your making HTTP requests.
WireShark sniff all other communications.
Flash Tracer to get traces when a SWF is deployed from inside a html browser.

Version Control
Tortoise SVN to save versions as your code progresses.
WinMerge to compare versions for text, files, and folders.

V0.0

This blog will consist of the adventures I have had developing in Flash CS3 and AS3.