Flash

Tags:

While porting some xpath-heavy AS2 code to AS3, I ran into problems. E4X (new and improved xml support in AS3) seems to make xpath obsolete. However, all the E4X query examples in the docs use hard-coded literals. I can't use literals because I don't know at code-time what the queries are going to be. My AS2 code creates xpath paths dynamically from variables. What is the E4X equivalent?

Read more...

Tags:

I thought I was done with the Flash-embedded-font in my previous blog entry, but there is more. I received an email requesting help with CSS and embedded fonts, and when I looked into it, found some quirks related to the CSS specified font-family and bold/italic text.

Read more...

Tags:

The 'why' and 'how' of embedding fonts is a Flash 101 topic. The main 'why' is that the user can't see fonts that she doesn't have. If your swf uses these fonts, you need to bundle them in the swf (or with the swf). The 'how' also seems very simple: in the properties panel for a given text field, click the 'Embed' button and select the character range you want to embed. Click OK. Done. Move on.

But it's really not that simple.

Read more...

Tags:

Unlike most other computer languages, when ActionScript code fails, it fails silently. If my code sends an undefined argument to a function, there is no crash, no alert message, nothing scary.

Overall, this is a good thing. If my live swf hits a bug, it might work just fine, no one is the wiser and life goes goes on blissfully unaware.

Read more...

Tags:

This problem drove me crazy. I'd thought I'd get it in the google-verse so anyone else who runs into it can benefit from my pain.

Array.sortOn() does not seem to work when the array elements are objects derived from MovieClip. The following code demonstrates.

Read more...

Tags:

Unlike Grant Skinner's gooify, which is a free-form distortion, the morph presented here is more constrained. It has an editable triangle mesh

Read more...

Tags:

The 'Simulate Download' feature in the Flash IDE is very useful. It can help debug race conditions that are a cause of intermittent problems. However, it can also lead you astray.

Problem: AS2 static variables are NOT reinitialized when you hit control-Enter the 2nd time to go into simulate-download mode.

If you'd like to try it, here's a simple test class:

Read more...

A while back, I wrote about rendering Wood and Marble using Perlin noise. But I've found that these code bits are a pain to use. You need to write code just to see them. You can't work with them in the Flash IDE; i.e. they are inconvenient.

Solution: package them in components with live preview. That way you can see them, adjust their color visually, mask them, drop shadow them, etc.

So, here they are.

Read more...

Tags:

Unlike ActionScript, JSFL does not have an include directive. I've started writing some useful jsfl classes, but having no include means a lot of copying and pasting and duplicated code. This is a bad thing.

Read more...

So the other day, I was working on a component that has an inspectable set/get array property. I could not get it work. Although the default value for this array was not zero length and the parameter in the dialog box was not zero length, the set function was being called with a zero-length array at initialization.

This was an invalid situation and broke my app.

Here's a simplified version of the code:

Read more...