Skip to content

attachSound() Won’t Play in Loaded Movie- Another Flash Bug!

I came across this bug awhile ago. Lets say you had the following code in a SWF: It worked perfectly, the sound with the linkage ID in my library names “asound” played and everything was great. Now try loading that SWF info another SWF, the sound will not play. I searched the net and found this nice little comment here: “For what it is worth, I had the same issue, and found a solution to this. When declaring the “new Sound”, you have to specify a target movie clip. For example: new_sound = new Sound(this)” Ah-Ha! Specifying this in the Sound object’s constructor magically makes it work. This isn’t anywhere in MM’s docs. Thanks MM for wasting 30 more minutes of my time!

Continue Reading

with() Problem/Bug

This is yet another bug I found while doing some Flash-dev, it has to do with the with() statement. If you use with(this){…} it will give you erratic/unpredicted behavior, for instance take this code: You would think that output would look like this: But, instead it comes out as: Seems as though Flash does not allow you to set variables when using this in a with() statement. You can get the .fla i used to make the test cases for this bug here. Thanks Macromedia for wasting another hour of my time! 😛

Continue Reading

Determining When A Movie Clip Is Initialized

This is a common problem in Flash, determining when a MC is fully initialized. This problem only really arises when you are using attachMovie() to dynamically make/attach MC’s to the stage. An example of this problem is if you have a MC with timeline animation that you are going to attach to the stage. The timeline animation has stop() on its first frame and its last frame. You use this code to attach it to the stage: The attached “box” MC wont play (Here’s an example of what I’m explaining). Other common problems like this are trying to grab the height of a dynamic textfield with autoSize = true contained in a MC that you have just attached to the stage and assigned alot of text to the internal textfield…

Continue Reading

Class Variable Weirdness

This is a weird bug/feature I found in Flash a week or two ago. I like to declare my variables in classes like this: Well, I was working on a project a few weeks ago and I had a class that looked something like this: Throughout the SWF I code like this: When I traced dataOb, I got this output: But I only added “info 1” and “info 2” to the dataOb.info array? Why would “info 3” and “info 4” be in their too? It seems as though if you declare a variable as an array in the variable declaration and dont re-initalizie it in the constructor (IE, info = []) then the array will be shared across instances of the class. This effect doesn’t seem to happen with number declaration like the one in the example electric class I posted…

Continue Reading

Bitmaps & Flash

I was working on a flash-based project recently which consisted of alot of bitmaps. I always export my bitmaps from Photoshop as png-24, since I always find they yield the best results and have the best support for transparency. The problem I was having in the project I was working on was that when I imported the image, it work look fine- just as how I outputted it from Photoshop. But when I exported the movie, the bitmap lost some of details and replaced jagged grungy edges with straight ones, this was not what I wanted since the site was a ruff & grungy style. I finally discovered that Flash was exporting the image as a jpg, changing it to exporting as a png fixed the problem giving the me the jagged grungy lines I was looking for.

Continue Reading

Flash Quirk Of The Day!

Flash has so many weird odd bugs it’s sickening. I was working with a simple timeline animation in Flash that looked like this: On the timeline was a shape tween that was acting as a mask for two MC’s. I had some initialization code that I only wanted to fire once contained in one of the MC’s, but for some reason it was called twice because the MC was being instantiated twice. I couldn’t figure out why the MC was being instantiated twice, so eventually I took a shot in the dark and converted the shape in the shape tween to a symbol. It worked and the code only fired once. So in the end my timeline looked like this:

Continue Reading

Delaying a function call

What I’ve always found a major pain in Flash was delaying a function call from being called for a short period of time. The only reasonable way to do it was to call setInterval() and then clearInterval() after the function was called. I had to keep a intermediate variable to keep the interval id that setInterval() returned. This was a major pain and often ended up in cluttering up my project with code like this: I hate having to make intermediate variable & functions to accomplish really simple task. I came across Tom Rethaller’s schedule() method on proto.layer51.com and it was just what i was looking for except it had some scope issues and wouldn’t allow you to schedule the same function to be called on multiple instances of a object…

Continue Reading

Open-Source Flash

Leaps and bounds in progress have been made in the journey towards total open-source flash development. MTASC, Swfmill, Xcode-Actionscript plug-ins, but one thing has been lacking; a resource of information on how to fully integrate all these applications together to create a Flash-IDE-Free development environment. Well, this problem has just been solved by the big players in the Open-Source flash movement by the unveiling of OSFlash.org wiki & mailing list. I’ve added some content to wiki, and many, many other flash developers have added content too. Its already an incredible Open-Source flash resource!

Continue Reading

Embedded Pixel Fonts in Flash on OS X

Recently, while building my new version of my flash web-site I had a problem with a free pixel font i downloaded from Orgdot. Here were the symptoms of my problem: If I embedded the pixel font it would blur when used with a dynamic text field. The same pixel font would not blur if in a static text field. The pixel font would not blur in a dynamic text field that used system (A.K.A. device) fonts. Flash did not give me any errors when embedding the font. The windows version of the same font caused the Flash IDE to hang when it embedded the font (IE when the movie was published) I was following standard pixel font guidelines, sizes in multiples of 8, integer coordinates, 100% _xscale & _yscale…

Continue Reading