Hi,

Im Miguel, Im working in animation creator tool. Im using SWFMILL to create assets library. The idea is to create new swf with some animation clips into. Then my application access to the animations by the class linkeage. SWFMILL have support to set the class linkeage, but is not working well. The problem is if no one try to use the animations, then the class linkeage is not inclued. I was searching how to fix it. The way I found is to use the the complete class name (example com.images.picture) in SWFMILL as ID, then create a new swf using haxe using the swf created by SWFMILL as librarie. Then I use the last swf created by haxe and I can get the class in my application using getDefinition. This complete process works perfect..... BUT, my new assets instance doesn't catch the mouse events. It problem exits only when the clip have more that 1 frame.

I was reading a lot to find how to fix my problem, but i could not found the solution. If any person could give me some help it will be very helpful.

Best regards Miguel

Here the files of my problem. http://www.miguelmoraleda.com/examples/assetCreation.rar
My process

First i create a swf using swfmill. It contains two images and a movieclip creating animation with the images. This animation have in the id my class linkage.

=================================
library.swfml
=================================
<?xml version="1.0" encoding="iso-8859-1" ?>
<movie version='9' width="320" height="240" framerate="31" as3="1">
   <background color="#ffffff"/>
   <frame>
       <library>
           <clip id="1" import="library/yo.jpg" />
           <clip id="2" import="library/yo2.jpg"/>
           <clip id="com.images.Pic">
               <frame>
                   <place id="1" depth="1"/>
               </frame>
               <frame>
                   <place id="2" depth="1"/>
               </frame>
           </clip>
       </library>
   </frame>
</movie>
==================================

//Create the librarie file
# swfmill.exe simple library.swfml library.swf







Second, using Haxe I create a new swf using the library.swf as library.


====================================
Dummy.hx
====================================
class Dummy {
   static function main() {
}
}
====================================

//Get the final swf.
# haxe -main Dummy -swf9 test.swf -swf-lib library.swf



Final

The application load test.swf and try to create a new instance of com.images.Pic
====================================
Main.as
====================================
package
{
   import flash.display.AVM1Movie;
   import flash.display.DisplayObject;
   import flash.display.MovieClip;
   import flash.events.MouseEvent;
   import flash.net.navigateToURL;
   import flash.display.Loader;
   import flash.display.Sprite;
   import flash.events.Event;
   import flash.net.URLRequest;
public class Main extends Sprite
   {
       protected var _loader:Loader;
public function Main()
       {
           super();
           loadSwf();
       }
private function loadSwf():void
       {
           _loader = new Loader();
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeLoadedHandler);
           _loader.load(new URLRequest("test.swf"));
       }
private function completeLoadedHandler(e:Object):void
       {
var instanceAnimation:Class = _loader.contentLoaderInfo.applicationDomain.getDefinition("com.images.Pic") as Class;
           trace("instanceAnimation: " + instanceAnimation);
var animation:MovieClip = new instanceAnimation(); trace("instanceAnimation is MovieClip: " + (animation is MovieClip));
           addChild(animation);
animation.addEventListener(MouseEvent.CLICK, function(e:MouseEvent) { trace("Dont Work"); } );
       }
   }
}
=======================================

_______________________________________________
swfmill mailing list
[email protected]
http://osflash.org/mailman/listinfo/swfmill_osflash.org

Reply via email to