-
jerky bitmap animation and setInterval
Hi all
I'm trying to script a mc (bitmap) with this script:
function animate()
{
updateAfterEvent();
if (_ymouse < 375 && _ymouse > 200){
vMove = 600 - _xmouse;
image_mc._x += vMove / 22;
}
}
myInterval = setInterval(animate, 2);
All works well, however the motion of the mc is very jerky (jumpy). Granted the mc is a big (4800 x 600) and is made from 10 png bitmaps. Ialso tried the equivalent 'onEnterframe' script, same jumpy results.
Can anyone please advise?
thanks martin
-
You're trying to animate a very large movieclip every 2 ms, which is 500 fps. You're also calling updateAfterEvent, which is forcing a render call 500 times a second. So it's no surprise that's choking. Remove the updateAfterEvent, there's no reason to draw it faster than your normal framerate.
Why is the movieclip that large? Is it scaled so all of it is visible at once? Or is a majority of it off the screen all the time? (I am assuming the images are side-by-side, not overlapping each other.)
Assuming most of it is not showing, and you've already got it divided into 10 images, why not programmatically remove and attach the images as they are needed on the stage? The most you will need then is 2 images rendering at once. That right there will win you major performance gains.
-
Thanks for the advice m.. yes only 3 images on screen at once, I understand your advice and will try to attach each as needed.. checked your site and pretty impressive stuff man :> all the best
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|