I’m going to describe just how I fell into the world of bitmapdata. You probably never noticed the images you look at have this data but it’s data that will effect the appearance of your images as they adjust to different sizes and resolutions in the Flash player. That’s the easiest way I can explain what bitmap data is. If you look it up your going to read a bunch of mumbo jumbo that has to do with data. The long and short of it for purposes of this post is that when it’s missing in dynamic images it makes the images look horrible. When you import an image into Flash you can click the properties and have an option to smooth out the image. Guess what, your telling flash right their to include the bitmap data. If you don’t smooth the image out you could end up with some pretty bad looking images. I’m using Flash CS4 and this rule still applies. That seems easy enough just select the smooth out option in Flash and your images are good to go. But what if you want to use dynamic images? Well this is where my journey begins in smoothing out my dynamic images in Actionscript 2.0. In 3.0 you can use the bitmap data class’s on your movie clip and that will solve your problem.
With 2.0 I found this solution to the problem with smoothing out the dynamic movie clip:
_global.smoothImageLoad = function(imgURL, targetMovie) {
var i=0
do { i++ } while (eval(“_root.smoothImageLoadTemp”+i) != undefined)
tmc = _root.createEmptyMovieClip(“smoothImageLoadTemp”+i, _root.getNextHighestDepth())
tmc.createEmptyMovieClip(“ti”, tmc.getNextHighestDepth())
tmc.tm = targetMovie
with(tmc) {
tmcl = new MovieClipLoader()
tmcl.onLoadComplete = function() {
ti.onEnterFrame = function() {
pixelData = new flash.display.BitmapData(ti._width, ti._height);
pixelData.draw(ti);
tm.attachBitmap(pixelData, 1, true, true);
tm.smoothImageLoadComplete()
removeMovieClip(ti._parent)
}
}
tmcl.loadClip(imgURL, tmc.ti)
}
}
mymc.smoothImageLoadComplete = function() {
trace(“success”)
}
smoothImageLoad(“images/beta.jpg”, mymc)
The top portion is calling for the bitmapdata to be presented again and the last line is referencing the image loaded to your server, along with the instance name of the movie clip holding the image. Now I can already hear people asking me why I don’t just use Actionscript 3.0. In short I’ll just say my client is happy with the site in 2.0. and as you Flash users know mixing 2.0 and 3.0 is going to result in a mess. I do think that the guy’s at Flash are capable of coming up with a better or more simpler solution to this issue, such as an option for the movie clip. I know Adobe looks through the wish lists every year when they go back to developing the next versions of the software, maybe this will eventually be a subject of interest.