SWF Scale-Nine Skin Sizing Issue

February 4th, 2009

I beat my brains out over this one for 3 hours the other day. I was skinning a Flex component with a SWF library asset (a MovieClip) that used nine slice scaling. There was a visual gap between the right and bottom sides of the skinned component and its parent. For a while, I thought that this was due to some padding or something being applied to the parent.

To resolve this issue, I did two things in Flash:

1) I converted my border from lines to fills, by going to Modify > Shape > Convert Lines to Fills
2) I made sure to register the upper-left corner of the shape at 0,0.

Easy, but yet so difficult.

Awesome – Flash IDE video

July 17th, 2008

Don’t know how I missed this, but here it is:


Demoing live video, inverse kinematics, and a new tweening model in the upcoming version of the Flash IDE. Enjoy.

AJAX in ASP .Net – Missing Sys.WebForms.*

June 16th, 2008

So – don’t ask me why, but I’ve been dabbling with AJAX & .Net 2.0. Oh, the shame of it. I just spent two days trying to figure out why my UpdatePanel controls were doing a full refresh of the page instead of only updating the area they encapsulate. It turns out that the required script libraries (.axd files) were not all being rendered into the page. In particular, I was missing Sys.WebForms.PageRequestManager. It took a further two hours to find the following (seemingly irrelevant) blog post:


In a fit of desperation, I tried his suggestion for fixing a completely unrelated problem, and lo, it worketh. Just comment the following out of your web.config:

<xhtmlConformance mode=”Legacy” />


Everything that's new in the Flash Player 10 beta docs

May 21st, 2008

Adobe has released the docs for the Player 10 beta. I went through and made a list that shows you the classes, properties, methods, events, and constants that are new to Flash Player 10.


adobe.utils.package: MMEndCommand()


flash.utils.ByteArray: inflate(), deflate()
flash.ui.ContextMenu: clipboardItems, clipboardMenu, link
flash.system.Capabilities: hasColorCorrection
flash.system.Capabilities: domainMemory, MIN_DOMAIN_MEMORY_LENGTH
flash.net.NetConnection: farID, farNonce, maxPeerConnections, nearID, nearNonce, protocol, unconnectedPeerStreams
flash.net.FileReference: data, load(), save()
flash.media.Sound: extract(), sampleData
flash.media.Microphone: codec, encodeQuality, framesPerPacket
flash.geom.Transform: matrix3D, perspectiveProjection, getRelativeMatrix3D()
flash.display.Stage: enableColorCorrection
flash.display.MovieClip: currentFrameLabel
flash.display.InteractiveObject: clear (event), copy (event), cut (event), paste (event), selectAll (event)
flash.display.Graphics: beginShaderFill()
flash.display.DisplayObject: blendShader, rotationX, rotationY, rotationZ, z, globalToLocal3D(), local3DToGlobal()
flash.display.BlendMode: SHADER
flash.display.BitmapData: histogram

categories: Uncategorized | Comments Off

Here's a New One

April 17th, 2008

This was emitted from a Flex swf I was working on today:

Error: The SystemManager constructor was called when the currentFrame was at 2 Please add this SWF to bug 129782.
at mx.managers::SystemManager()
at _EmbeddingImagesScale9_mx_managers_SystemManager()

Never seen that before. Good times.

categories: Uncategorized | Comments Off

Adobe's Coding Conventions Leave Me Asking "Why??"

April 16th, 2008

I just took a quick first pass through Adobe’s newly-published Flex Coding Conventions, and while I agree with much of what is in there, a few items leave me scratching my head. I think it would have been useful for them to offer some sort of rationale behind the recommendations, not just “do this, not that” mandates. By way of a few examples:

Use Array literals rather than new Array().

Isn’t “new Array()” more consistent with the way every other kind of object is instantiated? “[]” is a shorthand syntax – I have found shorthand generally to be something to be avoided, because it requires a deeper familiarity with a language than a generalist programmer would possess. I raise the same objection to the recommendations for using Object literals, RegExp literals, and so forth. Consistency is key.

Don’t use unnecessary parentheses with common operators such as +, -, *, /, &&, ||, <, <=, >, >=, ==, and !=.

I favor explicit groups, not implicit ones. In my opinion, this: var e:Number = (a * b) / (c + d); is better than this: var e:Number = a * b / (c + d); because it removes ambiguity over whether b is divided by (c + d) or a * b is divided by (c + d).

If the various branches of an if/else statement involve single statements, don’t make them into blocks.

This just makes your code less readable, and introduces an inconsistency in the way the syntax is written. Why have a special case for branches that contain a single statement? This feels more like the personal preference of an experienced developer than a bona fide “best practice” for teams. Indeed, the recommendation for “while” statements is exactly the opposite.

Use int for integers, even if they can’t be negative. Use uint only for RGB colors, bit masks, and other non-numeric values.

Why???? What’s the point in having a uint if you’re only going to use it for things other than unsigned integers?

These are just a few that jumped out at me, because they seemed arbitrary exceptions to the norm. “Best practices” should promote a coding standard that favors minimal variation in syntax over quick coding time, easy understanding over minor performance gains, etc. Overall, I think they’re on the right track – but if they’re going to create all kinds of exceptions to their own rules, they should provide more explanation.

One more – this is just whack:

var a:Array /* of String */ = [];

The language does not support typed arrays. If you need a typed array, extend ArrayCollection and add your own type-checking. Cluttering up your code with comments like this doesn’t offer any compile-time type-checking, and is much less readable than var a:MovieClipArray = new MovieClipArray();

wmode="opaque" + Firefox + position:fixed = AAAAGGGHH!!!!

March 25th, 2008

I just spent the last 4 hours or so tracking down this bug. I needed to use wmode=”opaque” on my Flex app, due to a dynamic menu overlay issue. However, in Firefox this seemed to mean that none of the buttons in the Flex app would be clickable. Ok, Tom, break the problem down…

I embed the swf in a plain-jane web page, and it works fine (wmode=”opaque”). I add in my style sheets, and it stops working. Turns out that setting position:fixed on the body tag was the cause – changing to position:static was the cure.

May you waste less time than I did.

categories: Firefox, Flex | 3 comments »

A Regular Expression for Stripping HTML Tags

January 18th, 2008

Here’s a regex I wrote yesterday for stripping specific html tags from a string:


Here’s an example in AS3 that removes <p> and <b> tags:

var testString:String = “<p><b>Hello</b> world!</p>”;
var regEx:RegExp = new RegExp(“<[^>]*(p|b)[^<]*>”,”gi”)


Switched from Google Checkout to PayPal for donations

January 18th, 2008

I’ve switched to PayPal from Google Checkout for donations, in order to allow people to donate a custom amount. The fees are higher, but it allows for more flexible configuration – in the end, I think that’s better. What do you think?

What's the right approach for blog monetization?

January 18th, 2008

Lately I’ve been experimenting with this blog a little bit to learn more about how AdSense works, so you’ve no doubt noticed the ads. I personally dislike ads, but they do have the potential to be a money-maker under the right circumstances. The nice thing about them is that the money doesn’t come from the pocket of the viewer, it comes from the people who advertise. For this blog, however, I don’t think they’re a good fit. Here are a few reasons why:

The content of this blog doesn’t lend itself to pulling quality ads. I’ve been seeing ads for “Fix Flash Player Errors” – I sincerely hope no one clicked on that thing. It takes you to a registry scanner of some sort, and strikes me as being a bit nefarious. Also, the ads are only pulling in (at most) a few cents per click. For over 2700 visits, I made a whopping total of 73 cents.

The people who view this blog are not given to clicking on ads. Clearly, whatever my blog is advertising, you’re not interested in. For over 2700 visits, my ads were clicked around 10 times.

In terms of a money-making proposition, I think it’s safe to say ads are not a good fit. I have removed most of the ads on the site. I still want to watch how Google AdSense analyzes my content though, so I’m leaving one small ad in the footer. Instead of the ads, I’m going to try a donation model. I’m going with 3 donation levels: $1.23, $5.33, and $10.63. I started with $1, $5, and $10, and then added a few cents to offset Google Checkout fees. These donations will help me write more useful content, and will allow me to devote more time to finishing up some of those lingering projects that people have expressed interest in.

I really want your feedback on this. Do you think the donations are appropriate? Is the Buy button unobtrusive enough? Are the amounts right? I’m looking forward to your input.