Archive for January, 2009

Debugging with Adobe Flash CS3

Wednesday, January 21st, 2009

When I started developping a bit seriously in ActionScript, I quite immediatly searched a debugging tool in Adobe Flash Professional, as I use while working in PHP or Java. And fortunately, this feature is available is available.

However, all AS developers I worked with don’t know those debugging capabilities, using extensively trace instead.

Debugging allows you to see, wherever in the execution flow of your code, the state of your objects (object attributes values, local variables, movieClip properties…). It is terribly simple and convenient.

Say you want to know the value of a variable somewhere in the middle of the execution of the function.
Instead of tracing this value (ending up with a code cluttered with “trace” statements, and having to republish each time you put a new trace), you can ask Flash to pause the execution within this function, and to tell you the value of this (and all other) variables.
You just need to

  1. open your AS file in Adobe Flash CS3
  2. set a break point on the line you want to check (right click/toggle breakpoint)
  3. run the movie in debug mode (CTRL+Shit+Enter)

Then the debug window should open. You just have to click the green arrow to get to the line with the breakpoint. You can add new breakpoints as you debug. You can also follow the execution line by line, by clicking the “step over” button.
On the right side of the debug window, you can browse through the variables and properties of the current object.

If you have a main flash embedding other swf, to debug the other swf, you need in the “publish setting” of those to tick “Permit debugging”.

More info here!

Publishing from Flash Develop in AS3

Tuesday, January 20th, 2009

In as2, it was possible to compile and publish your project from FlashDevelop, thanks to the integration of MTASC, an open-source AS2 compiler.The most convenient use of this was that you could check that your code was compiling, without the sometime time-consumming need to publish the animation – by simply pressing F7.

However MTASC does not support AS3.
It is still possible to easily publish your AS3 animation from Flash Developer by
- keeping the corresponding .fla open in Flash CS3
- in FlashDevelop, in the project property (accessed through right click on the project name), in the “output” tab, click the “No output, only run pre/post commands”.
- Then pressing CTRL+Enter while on FlashDevelop will publish whatever file is open in Flash CS3. If there are compile errors, they’ll be shown in the results panel of Flash Develop with a link to the line where is the error.

But you still need to go through the publish process.

It seems it is possible, with the Flex SDK, to compile without using Flash CS3, as explained here. However I did not yet make it work…

Embed automatically italic and bold fonts in TextField

Monday, January 19th, 2009

Flash is not that great at handling html text in TextFields. In particular, when you’ve got dynamic italic and bold text, the italic and bold fonts are not embedded by default – even if you embed your font for your TextField (it embed only the regular version)
So as a result, when loading dynamically italic or bold html text, the text is displayed as regular.

The easy trick is simply to write some dummy bold, italic and bold italic (as per your needs) text in your TextField from the Flash IDE initially. Then the corresponding bold, italic, and bold italic fonts will automatically be embedded!

cross-browser issues

Friday, January 16th, 2009

Testing the last website I am working on over various browser, I had the following issues with the css:

1) IE6: does not understand the input[type=text] syntax. So I had to attribute class or id to the related form fields.

2) IE6: some alignements with absolute positionned elements were not pixel-perfect. An easy trick I found on a forum (forgot the link:(): use the following syntax:
* html div.mydivClass{
myI6-specific css
}
As IE6 is the only browser to have an element at the root of html (hence the “* html” descriptor)

3) IE6: some overflow issues in specific situation (that I did not manage to identify precisely). I kind of fixed it fixing a height to the problematic element

4) IE6: when a padding is given to an image element, the image extends to fill the padding. I just had to replaced with a margin

5) IE6: the png transparent background (cf a previous post)

7) Safari for PC: under certain conditions, the padding-right and -left of <li> tags kept additioning to each other, so that my listing content get narrower and narrower…Set the padding to the parent <ul> tag

symfony plugins

Wednesday, January 14th, 2009

Here a list of the symfony plugins I use at the moment:

search engine: sfLucene
blog:sfSimpleBlog
forum: sfSimpleForum
authentication: sfGuardAuth
captcha: sfCaptcha
modal box (UI improvment): sfModalBox

New Zealand regions and suburbs database

Tuesday, January 13th, 2009

If anybody is after a database of NZ regions, suburbs and zip code: I found it here. Thanks to the author!

More about .htc

Monday, January 12th, 2009

In the last post I referred about a .htc file, that I used to display transparent backgrounds in IE6.

I wanted to know a bit more about it – so I searched a bit on that thing afterwards. Unfortunately I haven’t time to write down a summary – so you’ll find more information here.

But anyway it seem to be IE-specific, and won’t come as a standard – so I’ll probably forget about it…

PNG transparency with IE6

Friday, January 9th, 2009

Well, that’s quite a typical cross-browser compatibility issue, but I did not run into it till today…
To summarize, IE 6 and lower does not support PNG transparency – so if you have PNG images with transparent background, those background will appear grey.

I found the following fix: http://www.twinhelix.com/css/iepngfix/

The setup is quite simple – you just need to add an blank image, a .htc file (that I never heard of – I’ll have to check that out), and a one-line update in your css file.

It seems to work, but I need still to check the css background image (it says it may give problem with repeat background)

adobe Flash CS3 – project

Friday, January 9th, 2009

I saw for a while that it was possible to create flash “projects” from within Flash CS3. As I use mostly Flash Develop as a developement tool, I never really paid attention to that feature and its capabilities.

As the Gaia framework (that I am now trying) uses it, I though it would be the occasion to see what these “projects” were about.

Basically I understand it gives those few main features: (but I looked quickly, I may have missed some)
- It publishes all the flas files of your project at once – and in last the one you define as “main”.
So basically it does what the bat files I described in this post does. Quite handy.
- It can be interfaced with some source control tools – actually, only MS Visual Source Safe (that we are not using)

- It can also be interfaced with a FTP server. But Not really designed to define a deployment folder and send i through easily.
Besides if you create a project in an folder with existing flash files, it doesn’t provides easy way to add them to the project (though you probably can by editing manually the project .flp file, which is a XML file)

So it’s a bit useful thanks to the first feature, and as a project files browser. Hope it gets more useful in CS4!

Flash publish settings

Friday, January 9th, 2009

That’s a while I tell myself I should have a closer look at all the Flash Publish Settings available when opening the Publish “Settings…” dialog bog in CS3. So I’ll check that now – starting with the “Flash” tab

1. To start with, It is possible to save a profile for the Publish Settings. I never really used that…
2. Version: the Flash Player version the animation should be able to run in.

3. Load order: specify in which order (bottom up or top up) the layers of your flash animation get drawn on the scene over the slow connection. I don’t believe I ever saw an animation where I had time to see the layers rendering at different time (I actually though they would all be loaded before rendering?)

4. ActionScript version: If you set ActionScript 3, there are other intesting settings from the “Settings…” button:
4.1. Errors: “Strict mode” won’t let the animation compile if their are warnings. “Warning Mode” display additional warnings. (which won’t prevent compilation)
4.2. Automatically declare stage instance: When you associate a Flash file with a document class, ticking this will save you from having to declare all stage instances as class variable. On the other hand, declaring your class variables may make it easier later on to quickly assess the content of an animation from its class file, plus it gives you access to code hinting (e.g. from Flash Develop). I keep this unticked.
4.3. Optimizer: One wonder why one should not tick this. Maybe it slows done compilation time? Does not seems so though.
4.4. Dialect: ActionScript or ECMAScript. ECMAScript is a vendor-neutral language specification for client-side scripting (like JavaScript) , as far as I can remember.

5. Generate Size Report: Quite handy, generate (in the output window as well as in a txt file) the breakdown of the size of a Swf (with the size of each image/font/media… embedded in the flash animation)

6. Protect from import: Seems to be to protect your swf file to be reversed-engineered to a FLA (you need then to give a password). I am not sure against which reverse-engineering tool this does work though.

7. Omit trace action: as said, prevent the trace to be printed. Some seems to see this feature as a reason not to clean the trace() call all over their code.

8. Permit debugging: ticking this, you can debug your flash animation with the stand-alone version of the Debug Flash Player (available in Flash install directory/Players/Debug/). However it seems to be able to debug only swf file located in the machine where it is running (never tried that yet).

9. Compress movie: self-explanatory

10. Export hidden layers: As it says, if unticked, will not export the hidden layers of your flash animation. Took me a long time to find it out when movieClips were suddenly disappearing from my animation, after a developer unticked this by mistake. I am not sure I really see the point of this setting, as we can set unwanted layers as guides to not publish them anyway.

11. Export SWC: Export components, which seems to be reusable. I’ll need to dig further in this one.

12. Script time limit: I guess this is the time a script is allowed to run before poping up a message that “a script seems to slow down the navigator”

The following seems to be compression settings, that I never had to change so far.