Post by docclox on Feb 8, 2011 11:48:41 GMT -5
Something Daisy asked over IRC this morning - is it possible to load an swf file in such a way that the images can be indexed like ordinary movieclips? The answer turns out to be "yes", although not in the way I expected.
What we do at the moment is load the root movieclip from the girls' swf files. Then when we want an image from the collection, we pick out the one we need:
Actually, that's probably why the images won't index = their already indexed within the menace movieclip. If you want to change the z-ordering, you probably need to move that.
Anyway, my approach is create the movieclips on the fly from the class names. It means that the swf libraries can have empty stages, and we don't need to add the loaded clips to the stage, either. Instead, there's a function added to the root clip that generates a new movieclip based on a parameter and returns it.
Here's an example of how it works:
www.mediafire.com/?3ermmgmgdhk66nk
[edit]
... and why I play that in firefox and linux it is fucked up in all sorts of interesting ways. Works just fine in windows/virtualbox/flash cs5. Let me know if it works for you and I'll have a look after I get back from dealing with the crisis du jour...
[edit]
Crisis averted, and the flash seems to play just fine on XP.Let's make sure the download didn't get messed up...
[edit]
Downloaded and it seems fine. Probably Debian trying to play it with Gnash or something...
[edit]
Hmm... so generally it works, and cycles through emma frost pics with each image being shuffled up through the z-order to show the indexing at work. And sometimes all I see is five tiny dots appearing and vanishing on the screen. So while I'm on the right track, it's probably not reliable enough to use for the game.
On the other hand, I found an interesting link on the subject. Explains why my first thoughs on how to do this don't work under as3, and how to do it so it will work.
www.scottgmorgan.com/blog/index.php/2007/11/11/accessing-document-class-of-externally-loaded-swf-with-as3/
I'll have crack at that later.
What we do at the moment is load the root movieclip from the girls' swf files. Then when we want an image from the collection, we pick out the one we need:
mc = menace.menacenude1;
Actually, that's probably why the images won't index = their already indexed within the menace movieclip. If you want to change the z-ordering, you probably need to move that.
Anyway, my approach is create the movieclips on the fly from the class names. It means that the swf libraries can have empty stages, and we don't need to add the loaded clips to the stage, either. Instead, there's a function added to the root clip that generates a new movieclip based on a parameter and returns it.
Here's an example of how it works:
www.mediafire.com/?3ermmgmgdhk66nk
[edit]
... and why I play that in firefox and linux it is fucked up in all sorts of interesting ways. Works just fine in windows/virtualbox/flash cs5. Let me know if it works for you and I'll have a look after I get back from dealing with the crisis du jour...
[edit]
Crisis averted, and the flash seems to play just fine on XP.Let's make sure the download didn't get messed up...
[edit]
Downloaded and it seems fine. Probably Debian trying to play it with Gnash or something...
[edit]
Hmm... so generally it works, and cycles through emma frost pics with each image being shuffled up through the z-order to show the indexing at work. And sometimes all I see is five tiny dots appearing and vanishing on the screen. So while I'm on the right track, it's probably not reliable enough to use for the game.
On the other hand, I found an interesting link on the subject. Explains why my first thoughs on how to do this don't work under as3, and how to do it so it will work.
www.scottgmorgan.com/blog/index.php/2007/11/11/accessing-document-class-of-externally-loaded-swf-with-as3/
I'll have crack at that later.