First, I know this is not a Flex forum, but an AS3 forum is not far off the mark, and I’m desperate, so here goes:
I’ve created a flex file that builds chains of nested MovieClips based on loaded xml variables. The file and source can be found here:
Resizing your browser window will cause them to snap to the center and scale down so they are all visible. Clicking on the background canvas will start them rotating. I use a frame enter event and increment .rotation of the main MovieClip.
It all seems pretty straightforward to me, but as soon as it starts rotating, I get visible artifacting, and then my browser locks up. Debug and Profile views haven’t given me any insight into what could be causing this.
Repeating, for safety’s sake:**
Clicking on the background to start the clips rotating causes my browser to lock up, and will likely do the same for you.
Any help/advice is appreciated.
ps - Why is there no Flex forum?
Hm… IE shows artifacts, FF crushes and shows artifacts. I think it’s just to many clips to redraw, may be try to draw the clips into single bitmap and rotate the bitmap… And, there’s no way to know what’s your code looks like, there may be other problems…
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; InfoPath.2; FDM; OfficeLiveConnector.1.0; MAXTHON 2.0)
Flash Player 10 Beta.
Nothing hangs, but there are those artifacts
Thanks for taking a look.
Yes, right click on the movie and hit view source.
I’ll try caching the chain class MovieClips as bitmaps, that might work.
It works fine here, I suspect you’re just having performance problems. Optimization is a pain. :-/
This is a great candidate for doing using either the drawing API or dumping them to a bitmap. You’re just running into performance issues from the sheer number of movie clips. Is there any good reason to have that many individual clips?
Thanks for all the feedback!
I’m nesting the clips one inside another so that when a user clicks on a link in a chain, that chain zooms in and straightens itself out. When they click it again, it returns to the original size and “re-crookens” itself.
It’s the repositioning and moving around of the individual links is what is keeping me from using the drawing api to just draw out each chain, instead I am drawing each link, and then nesting them one inside another, so when I pass a command up the chain to rotate to zero, or back to their original position, it’s a lot easier. I didn’t include all the functionality in these files because it didn’t pertain the crashing issue, and I was hoping to keep the code as small as possible so people wouldn’t need to sort through a lot of stuff unrelated to the crashing
This example is in Flex 3, I did this same thing in Flash 8 in as2 a while back and didn’t have the same performance problems.
I caching the chains as bitmaps seems to be working for the moment. I had no idea the performance would be hit so hard, in the static example I posted there are less than 200 movie clips, I guess I just expected more!
Well if it worked in AS2, and has performance issues in AS3 there’s definitely something wrong. Everything I’ve seen indicates that AS3 performance should be significantly better. What are the main differences (aside from code target) between the AS2 and AS3 versions?
EDIT: Have you tried Sprites vs. Movieclips? (thread)
Thanks for that link, I should be extending Sprite!