I've been meaning to post about this error for awhile. You can find solutions on the web, but they seem very buried... hence all the key words in my title.
The error appears in Flash 9 when you use a loader more than once and try to add the e.target.content to the DisplayList after each load. If you are running Flash 10, you will not see the error... The biggest lesson I took from this error is to continue to test on older versions of Flash. If you set your publish settings to Flash 9, but have Flash 10 downloaded on your machine.... you still need to test your site on a machine with Flash 9. Pain in the arse, but worth it if it means catching errors before the client.
Anyways, back to the error at hand, you have a class loader that has been initiated and you plan on using it for your photo gallery. The first image loads just fine and in the completeHandler you add the image (e.target.content) to the stage using addChild and casting the content as some sort of display object. The second image loads just fine, but in the completeHandler at the line where you call "addChild" and error #2505 will get thrown saying that "The supplied DisplayObject must be a child of the caller".
Hmmph. It worked once, why would it fail?
It has something to do with Flash 9's Loader keeping a reference of its content even after the content has been added to a new parent. A quick and dirty fix to the problem is to make a new Loader for every item you are loading. That worked for my needs, however you may want to be careful with memory and garbage collection if you are loading an intense number of images.
Omar Faleh suggests either casting the content as a DisplayObject and unloading the loader or making a copy of the BitmapData and using the copy instead of the content.
Ed had his 2505 errors occurring when he called "unload()" after adding the e.target.content to the displayList. He suggests adding the Loader to the stage instead of the content. So you would add just "e.target" INSTEAD OF "e.target.content" to the display list.
In any case, there are plenty of work-a-rounds. The important thing is to be aware of the issue and make sure you continue to test your sites on older versions of Flash... even if your personal computer runs on 10.
Monday, June 29, 2009
Friday, June 26, 2009
Artifacts in Flash on Mac (FF3, AS3, Javascript, swfAddress)
In the past week or so, the Basement pushed Creative Alliance's new website live. It was a fun little project. I really enjoyed messing around with the orbiting particles... they made fun a fun and playful environment.
One thing I did not enjoy, however, was a little bug. It is somewhat hard to explain, but I will give it a shot then follow it up with a video.
Basically, when you click on things, random sized boxes/rectangles appear on the screen. The client called them artifacts. Since I couldn't recreate them on my end, I requested more information from the client... computer specs, screen shot, etc.
The main spec difference they sent back was that they were using a Mac. And instead of sending a screenshot, they did one better and sent the following video: http://ickydime.com/basement/artifacts.mov
Sure enough, when testing on our Mac I could get them to appear. (So much for that small hope that the client's computer was possessed). Sooo, ummm, crap, that the ef are those boxes?
I started taking everything out of the site to see if it was something I was doing. I removed the particles, I removed the content box, I removed the background glow... no nada. Artifacts would still appear. grrrr Finally I disabled swfAddress. Ding Ding Ding. No artifacts. That gave me enough to research online and figure out what was going on.
Turns out, it wasn't swfAddress's fault. In fact, its any javascript call that uses ExternalInterface. For some reason when you call ExternalInterface, little boxes like to appear on your screen and they will do their best to drive you batty.
Luckily, the latest version of SWFAddress takes care of this issue. I'm not going to pretend like I know why or how... but I will tell you that version 2.3 does remove the issue. I think it was specifically taken care of in version 2.2, but I did not test it out.
So if you stumble across this post due to crazy boxes appearing on your Flash site on a Mac. Upgrade your SWFAddress and that should do the trick. If you are making your own ExternalInterface calls, then you may want to look into using a URLRequest and pass the code using navigateToURL(request, "_self");. I haven't personally tried that one, but when doing a little research for this blog post, I stumbled across BigSpaceShip's post which seems to cover the topic quite well... and now I have to wonder why I didn't see this post when I was struggling???? haha. Oh well.
One thing I did not enjoy, however, was a little bug. It is somewhat hard to explain, but I will give it a shot then follow it up with a video.
Basically, when you click on things, random sized boxes/rectangles appear on the screen. The client called them artifacts. Since I couldn't recreate them on my end, I requested more information from the client... computer specs, screen shot, etc.
The main spec difference they sent back was that they were using a Mac. And instead of sending a screenshot, they did one better and sent the following video: http://ickydime.com/basement/artifacts.mov
Sure enough, when testing on our Mac I could get them to appear. (So much for that small hope that the client's computer was possessed). Sooo, ummm, crap, that the ef are those boxes?
I started taking everything out of the site to see if it was something I was doing. I removed the particles, I removed the content box, I removed the background glow... no nada. Artifacts would still appear. grrrr Finally I disabled swfAddress. Ding Ding Ding. No artifacts. That gave me enough to research online and figure out what was going on.
Turns out, it wasn't swfAddress's fault. In fact, its any javascript call that uses ExternalInterface. For some reason when you call ExternalInterface, little boxes like to appear on your screen and they will do their best to drive you batty.
Luckily, the latest version of SWFAddress takes care of this issue. I'm not going to pretend like I know why or how... but I will tell you that version 2.3 does remove the issue. I think it was specifically taken care of in version 2.2, but I did not test it out.
So if you stumble across this post due to crazy boxes appearing on your Flash site on a Mac. Upgrade your SWFAddress and that should do the trick. If you are making your own ExternalInterface calls, then you may want to look into using a URLRequest and pass the code using navigateToURL(request, "_self");. I haven't personally tried that one, but when doing a little research for this blog post, I stumbled across BigSpaceShip's post which seems to cover the topic quite well... and now I have to wonder why I didn't see this post when I was struggling???? haha. Oh well.
Thursday, June 18, 2009
MouseWheel Scroll on Mac for Flash AS3 (SWFWheel)
Do Mac mice even have a wheel? They only have 1 button so what do they need a wheel for??? ;)
Apparently Mac mice have wheels and Mac users would like to be able to use them just as their PC counterparts do. Unfortunately for them, the Mac OS gives the browser the focus for onScroll events and somehow Flash is left clueless that anything happened.
There are quite a few third party solutions out there. While researching I came across a great article from Robert Hall on four of those solutions.
From our research it seemed that all four solutions were viable options. However, we ended up going with SWFWheel, which was developed by Takanobu Izukawa.
We chose SWFWheel for three main reasons:
First off, it is part of the SPARK project, which I highly respect due to the quality of the other projects contained in their library.
Secondly, it was announced recently on JActionScripters that SWFWheel was being adopted by the latest Gaia Framework. An endorsement from Gaia goes a long way in my book.
Lastly, the project seemed recent and supported the latest browsers. Most of the other solutions seemed to have been created over a year ago. They could be compatible with the latest browsers, but it was not certain. SWFWheel is the only option that we found that specifically mentions supporting the latest browsers such as IE 8 and Chrome 1.
With that being said, if you choose to add SWFWheel to your project you should start by downloading the source from the project page.
Import org.libspark.ui.SWFWheel into your class and place SWFWheel.initialize(stage); in your constructor.
In you HTML page, ensure that you assign an ID to your embedded Flash file. This ID is used by the javascript to reference the embedded object. Add the the external javascript file: swfwheel.js to your HTML the same way you would add swfaddress.js. Just place the script right below swfobject and you should be good to go.
That is it. Simple importing of the .as file. Simple importing of the .js file. Initialize SWFWheel with your stage and away you go. No black magic. No fairy dust.
So far we have had good luck with it. I commend the developer and the SPARK project for putting together a very clean and easy solution.
Apparently Mac mice have wheels and Mac users would like to be able to use them just as their PC counterparts do. Unfortunately for them, the Mac OS gives the browser the focus for onScroll events and somehow Flash is left clueless that anything happened.
There are quite a few third party solutions out there. While researching I came across a great article from Robert Hall on four of those solutions.
From our research it seemed that all four solutions were viable options. However, we ended up going with SWFWheel, which was developed by Takanobu Izukawa.
We chose SWFWheel for three main reasons:
First off, it is part of the SPARK project, which I highly respect due to the quality of the other projects contained in their library.
Secondly, it was announced recently on JActionScripters that SWFWheel was being adopted by the latest Gaia Framework. An endorsement from Gaia goes a long way in my book.
Lastly, the project seemed recent and supported the latest browsers. Most of the other solutions seemed to have been created over a year ago. They could be compatible with the latest browsers, but it was not certain. SWFWheel is the only option that we found that specifically mentions supporting the latest browsers such as IE 8 and Chrome 1.
With that being said, if you choose to add SWFWheel to your project you should start by downloading the source from the project page.
Import org.libspark.ui.SWFWheel into your class and place SWFWheel.initialize(stage); in your constructor.
In you HTML page, ensure that you assign an ID to your embedded Flash file. This ID is used by the javascript to reference the embedded object. Add the the external javascript file: swfwheel.js to your HTML the same way you would add swfaddress.js. Just place the script right below swfobject and you should be good to go.
That is it. Simple importing of the .as file. Simple importing of the .js file. Initialize SWFWheel with your stage and away you go. No black magic. No fairy dust.
So far we have had good luck with it. I commend the developer and the SPARK project for putting together a very clean and easy solution.
Friday, June 12, 2009
Update from the Basement
First and foremost, The Basement got a Silver at the National Addy Awards for our work with Creative Alliance on the KFC Surf The Crowds game.
Secondly, we were featured on MidwestBusiness.com: Keys to Achieving Online Success: Relevancy, Content, Design Impact. That is one long title. The article has a nice summary of our recent work and achievements. I think the only big project they left out was the Conner Prairie spot.
That's all i got. Thanks for taking the time to see what we've been up to.
Secondly, we were featured on MidwestBusiness.com: Keys to Achieving Online Success: Relevancy, Content, Design Impact. That is one long title. The article has a nice summary of our recent work and achievements. I think the only big project they left out was the Conner Prairie spot.
That's all i got. Thanks for taking the time to see what we've been up to.
Thursday, June 4, 2009
Flash Indianapolis - June Meeting
Presenter:
Brian Phillips is the Creative Director at The Basement Design & Motion as well as an Adjunct Professor at IUPUI. Brian has designed / directed everything from video games to TV spots. You can learn more about Brian and his work by visiting his blog.
Content:
Brian will be demonstrating his design process for a Mr. Clean microsite. He will discuss the idea, inspiration, sketch, process and final design comp. He will share some of his techniques in PhotoShop and 3ds Max. Afterwords, we will open the floor for questions about tools, concepts, and anything else design related.
Sample:
Schedule:
6:00pm: Doors open. Everyone can meet and greet.
6:30pm: Presentation Begins.
7:15pm: Open Floor. Discuss Next Month
7:45pm: McNivens (to quench our thirst)
Location:
Noodles & Company Near IUPUI
903 Indiana Ave
Indianapolis IN
To find out more information and RSVP for the event, please check out Flash Indianapolis's events page.
Brian Phillips is the Creative Director at The Basement Design & Motion as well as an Adjunct Professor at IUPUI. Brian has designed / directed everything from video games to TV spots. You can learn more about Brian and his work by visiting his blog.
Content:
Brian will be demonstrating his design process for a Mr. Clean microsite. He will discuss the idea, inspiration, sketch, process and final design comp. He will share some of his techniques in PhotoShop and 3ds Max. Afterwords, we will open the floor for questions about tools, concepts, and anything else design related.
Sample:
Schedule:
6:00pm: Doors open. Everyone can meet and greet.
6:30pm: Presentation Begins.
7:15pm: Open Floor. Discuss Next Month
7:45pm: McNivens (to quench our thirst)
Location:
Noodles & Company Near IUPUI
903 Indiana Ave
Indianapolis IN
To find out more information and RSVP for the event, please check out Flash Indianapolis's events page.
Tuesday, June 2, 2009
Featured in Flash & Flex Developer's Magazine (ffdmag)
I am very excited to announce that I got published! Check out the latest edition of Flash & Flex Developer's Magazine (3/2009). I submitted an article awhile back and was very pleased to be selected to be in their June edition. I received the magazine last night, and to my surprise, not only was I in the magazine but I was also the featured article!
My article is called "How to Become a Flex/Flex Developer" and is an expanded and more polished version of a blog post I made last year.
Cover:
Cover Close Up:
My Spread:
If you would like to check out the copy, you should be able to find them in your local Barnes and Noble soon. Or you could subscribe to either their print or their electronic issues.
Huge thanks to both Brian Phillips for helping fine tune my points and to my good friend Kate Pierce for editing my article so that I came across as though I knew how to put together a proper sentence.
My article is called "How to Become a Flex/Flex Developer" and is an expanded and more polished version of a blog post I made last year.
Cover:
Cover Close Up:
My Spread:
If you would like to check out the copy, you should be able to find them in your local Barnes and Noble soon. Or you could subscribe to either their print or their electronic issues.
Huge thanks to both Brian Phillips for helping fine tune my points and to my good friend Kate Pierce for editing my article so that I came across as though I knew how to put together a proper sentence.
Subscribe to:
Posts (Atom)