This content has been marked as final. Show 4 replies
you can use the graphics property of one shape object to "draw" something. you can do that repeatedly and/or you can draw that (or those) something(s) to a bitmapdata object(s).
whether that answers your question or not, i have no idea because i'm not sure what you're trying to accomplish.
sadly that don't help.
I am trying to make a tiled game. The problem is that i have the tile, but I can't figure out a way to draw it many times (simultaneously) on screen without stressing memory (by making a hundreds of clones of the tile object).
I did got some good answers of how to clone the object, however making that become very slow, as you will have many identical objects in memory. I am currently trying to find a way to draw an object, without having to clone its content.
Think of a graphic buffer, where you can draw it anywhere you want and how many times you want by just using the buffer itself as a reference.
AcrionScript 3 frustrate any of my tries to simultaneously reuse the object by forbiding multiple parent containers and prototype manipulation.
Is there any way in ActionScript 3 to redraw a MovieClip object any times you want, without having to copy the entire object????
I want to know how the hell I can reuse an animation (simultaneously) without having to identical-copy all of it in memory!!! I believe it is not much to ask! :(
The answer is there is no way to do it. You are looking for answers that are native to other ways of thinking about and manipulating objects. The way Flash is is the way it is. There is no way to draw something without drawing it. There is no way to copy something without copying it. I don't understand how you would reuse it without copying it. Even with buffers you are copying it again, it is just the system is designed to optimize that process
Generally speaking, Flash is a memory/cpu hog and if you put a lot of graphics on the screen it will require more memory. By using movieclips/sprites you reduce file size and the requirements. That isn't to say there aren't better/less demanding ways to reuse your content. Certainly the BitmapData class and its related methods will be of great service. (I just learned about lock()/unlock() and if you are doing lots of pixel manipulations that can really speed things up.)
Perhaps if you shared the actual use, code, effect, you are trying to achieve we could give pointers on how to optimize it? Folks have made lots of tile games, ray casting games, and other graphic intensive things and they work great.
Ok, thanks for your help. You were more helpful than you think ;)
There is no way to draw something without drawing it. There is no way to copy something without copying it.
Actually, I was thinking something like a texture in a 3d game. Imagine what would happen if, for each single use of a texture, the objects containing the textures itself had to be completely copied?
Note: duplicating its graphical presentation on screen is not (or should not be) the same as duplicating the object itself.
Perhaps if you shared the actual use, code, effect, you are trying to achieve we could give pointers on how to optimize it?
Thanks for the help invitation. But the code is already too big and network based to put here.
But thanks to your post, I noticed I had to change my way of thinking. I figured out few solutions to try.