[RESOLVED] Problem with converting frames of a MovieClip to Bitmaps
Hello everyone, I'm trying to convert the frames of a MovieClip (mc) --which are vector graphics-- to Bitmaps in order to improve performance.
The Logic is simple: During the first time play of the mc on every frame I convert the vector display of the mc to BitmapData with their appropriate transformation applied and store these BitmapData instances in an Object with the frame number as the key. I use these BitmapData instances to create Bitmap instances and use them in place of the actual mc during the successive play.
Everything works fine except that there is a random but small position error for the created Bitmap instances so it looks like its vibrating in its place. I have no idea what is causing this.
Any insight into the problem is much appreciated. I have attached the Flash Builder 4 AS project for anyone who wants to look at the code. The swf file can be found in the 'bin-debug' folder when extracted.
That will be too much of a hassle for the graphic designers... besides, I dont see why the Bitmap looks like its vibrating... I mean I do have applied the geometric transformation matrix and placed it at the proper position...
I only glanced at your code so I can't say for sure what's causing it. I would suggest however not using the dimensions of each captured bitmapdata. Instead create each bmd object with exactly the same width and height and drawing the pixels starting at the exact same coordinate. PixelSnapping should be turned off.
[RESOLVED] Problem with converting frames of a MovieClip to Bitmaps
Originally Posted by Smilev
Not the same problem I think. Imo, jAQUAN's suggestion is going to fix it.
U're right about that Smilev, its not the same problem...
I finally found the solution: Even though jAQUAN's suggestion not exactly fix it, the solution I found works on the same grounds: keeping the size and position constant... I could have used jAQUAN's suggestion exactly as he said but,
1) I dont know how big the movieclip was going to be and the size of its frames(dimension-wise) --I dont know the size, and
2) The registration point of each movieclip was not exactly at the top-left corner of the movieclip and its chosen based on a criterion we have set earlier --so I dont know the position
So what I did was I drew a rectangle of alpha=0 and of fixed size and position and put it at the lowest layer of the moviclip but whose size is big enough to accommodate all the animations that happen in the mc but not so big as to increase the dimensions of the BitmapData tremendously. I also made the size values and the position values to integers just to be extra careful... This has solved the problem and I'm happy with it...