There is a Holy Grail in software development, an ideal that many good developers strive to achieve but often fall short of. This ideal is the seperation of content and code into different 'tiers'. This is the model I'm attempting to create using Flash 8 and Actionscript 2.
To do this, I have attempted to make all my resources external to the actual engine. This is equivalent to seperating presentation from business logic and helps to make software reusable. This causes some problems in Flash itself, because its primary commands for duplicating assets (DuplicateMovieClip and AttachMovie) do not work with external assets, only assets that are part of the movie itself. The way around this is to load entities in multiple times if you need to use them more than once, using the MovieClipLoader class and because downloads are cached this should work fine.
However, this is where I hit a bug in Flash. If you are loading assets from inside the cache, sometimes onLoadInit (the event that is fired when an external resource has loaded) doesn't fire at all, making this whole technique useless. Way to go Adobe.
I ran into this problem when working out my collision detection code. I started with asteroids, as these are a lot easier to program than enemy ships and moved onto splitting apart larger asteroids into smaller ones and it was at this point I hit the wall.
It looks like the Holy Grail is going to stay just that way with this project because of this. I will have to include some resources inside the flash file because I have no choice - something I'm not very happy about.
Subscribe to:
Post Comments (Atom)

1 comment:
AS2 was more a Macromedia product than an Adobe one..I would contradict this by saying that Adobe didn't like what AS2 was build upon, thus they re-wrote the entire code structure base and introduced JIT compilation and released it as the much more savvy AS3.
Post a Comment