Tutorials, extensions, and source files for ActionScript, Flash, and other Adobe products.


FP10 Bug Report: TextField.text does not recognize pasted newlines (Mac)

Posted February 16, 2009 by senocular

This one, reported on Jira: Flash Player 10 removing line breaks when pasting text into text fields [FP-780], is pretty ugly. What's happening is that for the Mac version of Flash Player 10, all pasted text gets its newline characters stripped when the string value is assigned to the TextField.text property accessible through ActionScript. Visually, the text looks OK, but in code, a multiple-line TextField will appear as a single line. I've posted a workaround in the comments, but its probably not something you would want to have in all your text fields.

Flex SDK 3 doesn't like arithmetic in member variable definitions [Updated]

Posted February 10, 2009 by senocular

Update: It was recently pointed out to me that the arithmetic was not what was throwing off Flex, it was the types of values I was using. ActionScript does not discern between integers and floats at the primitive level; everything is a Number. But since 1/20 was being interpreted by the compiler as integers, it was being evaluated as int(1/20) which became 0 in the final code. Changing the 1/20 to a 1.0/20.0 would have also fixed this!

This one took me my morning to figure out: you cannot use arithmetic (such as 1/20) for member variable definition values in Flex 3. You can in Flash CS3; you can in Flash CS4; and you can even with Flex 4. But you just can't in Flex 3. This all started with someone having a problem with my SWFReader class.

Flash's LoaderInfo Reuse in ActionScript 3.0

Posted February 02, 2009 by senocular

Here's an interesting factoid/precaution for you ActionScript developers out there: Did you know that Loader instances use the same LoaderInfo for all loaded content?

Why is this important? Most of the time, it's not. After all, you probably didn't already know this, cared to think about it, or even had any problems because of it. This is because, typically, when you load something in a Loader and then unload it or replace it with something else, you no longer need or interact with the original content you loaded. But what if that content is still used? Then, you might find yourself in for a surprise since Loader.contentLoaderInfo is the same LoaderInfo object each DisplayObject loaded into that Loader uses for it's own loaderInfo despite the originating SWF.

Fireworks CS4 and the Shifty Text Box

Posted January 23, 2009 by senocular

If you've been using Fireworks CS4 with text lately, you may have noticed a little issue where the bounding box of the text will sometimes find itself floating away from the actual, visible text. OK, it doesn't really "float" but sometimes its obvious that they somehow no longer match up. There have been a lot of changes in the text engine in Fireworks and this one is a sad side effect (bug) that snuck into the release. Luckily, there's a fix for this issue on the exchange. Check it out: Re-sync Text Bounding Box.

Equality (==) - Simple, Right?

Posted January 22, 2009 by senocular

I thought so too. But looking at the docs for the equality (==) operator showed something different. There are literally 15 different bullet points outlining the behavior of this thing! Granted, most of them are pretty obvious, but one I can say I think I would have gotten wrong on the test would be for NameSpace objects.

AS3: Determining the viewable side of a display object

Posted December 19, 2008 by senocular

I've just posted a new ActionScript function for AS3: isFrontFacing(). This function lets you determine what side of a movie clip or other display object is visible and currently facing the user. In other words, is the display object flipped, or not? This method works for both 2D and Flash Player 10's 3D transformations on display objects. This can be particularly useful if you want an object to display different graphics when looking at its reversed or back side.

FP10 Bug Report: Garbled audio with higher than 44KHz sampling rate

Posted December 19, 2008 by senocular

Something to keep an eye out for if you use audio files with a sampling higher than 44Khz: songs with higher than 44KHz sampling rate playback incorrectly (FP-862). This is a Flash Player 10 bug that affects older content. More specifically, if you use (AS2) Sound.loadSound() with an audio file that has a sampling rate higher than 44KHz, the playback of that audio will be garbled.

The simple solution: change your audio to use a sampling rate of 44Khz instead. Keep an eye on the bug for any changes in status for the issue.

Did you know? You can log Flash Player bugs!

Posted October 31, 2008 by senocular

If you didn't already know, there is a public Adobe bug base for logging and tracking bugs (and feature requests) for Flash Player. Before I tell you where you can find it, I want to lay down some important guidelines you should follow when logging a bug.

Post-Flash Player Release Depression

Posted October 30, 2008 by senocular

After every Flash Player release (namely new versions of the player, not so much dot-releases) I enter a depression. This depression is brought on by the fact that no matter how confident I am about a certain release, there are always problems with it. The worst cases are when existing content breaks as a result of a new player version. And as much as I'd like to say that isn't the case with Flash Player 10, I can't.

Flash Player Versioning Moving Forward

Posted October 21, 2008 by senocular

As Emmy Huang points out, version numbers for Flash Player 10 have changed. Basically, we're now using all of the 4 identifier values in the Flash Player version string. Before, Flash Player basically used the scheme major,0,build,0. Now, the scheme is major,minor,maintenance,build. This means that for "dot releases" of Flash Player, the minor build can be incremented to give us something like 10.1 and 10.2 etc. (Finally!) Though, granted, there are a lot more numbers to look at now. At least the new format is completely backwards compatible so it you only look at the first and third values, you'll still be able to distinguish between player versions.