connectedpixel.com

actionscript, web development

Big Data Scrolling Flex Charts

Submitted by joelmay on 27 February, 2008 - 9:59am.

If your TextArea has a lot of text, you get a scroll bar. If your datagrid has too many rows or columns, you get scroll bars. If your Image is too large, you can put it inside a container with scrollbars. Charts, however, do not have scrollbars. Charts with too much data look like this:

Callback filter functions in E4X

Submitted by joelmay on 2 April, 2007 - 7:38am.

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?

After some initial confusion on my part, I now get it. In retrospect, what's below seems obvious -- but that's the way it always is.

Selecting a variable-named node type

Let's work with this xml:

Detecting unwell xml

Submitted by joelmay on 4 January, 2007 - 9:07am.

If an XML file is created manually or edited manually, it is easy to misspell a closing tag, misplace a greater than sign or forget a quote mark – it's easy to create non-well-formed xml. Flash will not be able to read it and your application will fail. Furthermore, it might load some of the data and operate in a mysterious, crippled fashion, and the cause of the problem will not be obvious.

More embedded font strangeness – CSS

Submitted by joelmay on 3 January, 2007 - 5:34pm.

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.

The Unbearable Strangeness of Embedding Fonts

Submitted by joelmay on 21 December, 2006 - 8:28am.

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. Once you start using fonts in a shared library, referring to embedded fonts in a css file, etc. weird problems start popping up. I've had embedded text working in some swfs but not others, static fields displaying garbage and bloated swfs.

Preprocessor ASSERTS in ActionScript

Submitted by joelmay on 20 October, 2006 - 4:28pm.

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.

This behavior has a downside, however. The bug that is ignored now might cascade into a serious problem later -- in the next frame or in some code far away from the source of the problem. And I'm left scratching my head trying to figure out the original source of the problem in my code. The appearance of the problem and the source of the problem may be far apart.

Array.sortOn does not work with MovieClips

Submitted by joelmay on 2 October, 2006 - 1:57pm.

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.

Simple class. "zz" property will be used to sort an array of these objects.

Bandwidth Limit/Monitor tool

Submitted by joelmay on 27 June, 2006 - 7:07am.

I was working on a website that needs to adapt to bandwidth. To really test it, I had to run it over the Internet -- the 'simulate download' feature didn't cut it in this case. And, I don't have a dial-up modem anymore. Furthermore, the adaptive features needs to work over a variety of bandwidths.

I found a cheap, very useful tool: Netlimiter 2. The pro version is only $30. There is also a lite version. With this tool, you can limit and/or monitor the bandwith and bytes downloaded for each application and each ip address.

My Carpal-Tunnel Solution

Submitted by joelmay on 8 June, 2006 - 6:10am.

It was about 10 years ago when carpal-tunnel first hit me. Every time I put my hand on my mouse, I'd get spasms of pain in my various parts of my arm. I tried special ergonomic mice and trackballs, but they didn't help. I tried speech recognition software, but it was a joke. Whether I could continue with my profession was becoming an issue. I even tried moving the mouse with my feet. Nose mousing was next.

Then I discovered the Wacom tablet. For a long time, it was a godsend. The pain almost went away -- but not forever.

Face Morph - Part 1, Morphin' George

Submitted by joelmay on 6 June, 2006 - 4:24pm.

Unlike Grant Skinner's gooify, which is a free-form distortion, the morph presented here is more constrained. It has an editable triangle mesh (which I'm not showing right now).