Reputation: 2098
I'm trying to integrate some animations made in Flash/Animate in a OpenFL app.
To do so I'm using the OpenFL SWF library. In my project.xml I have this:
<haxelib name="swf" />
<library path="assets/library.swf" prefix="View" generate="true" preload="true" />
So far, so good.
The problem is that I can't control the animation with stop();
(or any other kind of timeline script) in my swf, because the SWF lib doesn't support it just yet.
My current solution involves frame labels.
To put it simply, I just add special values in labels in the main timeline and read them in Haxe.
This works but isn't automated (I have to parse each class in the swf manually) and, to use the classes the way I want, I have to do some composition.
I think that inheritance is a better approach, and to do this I need to make every exported movieclip extend a class that does the label parsing, but than again, I can't use AS3.
Looking the Haxe generated code I see that before compiling the target code (e.g. HTML5), because I set the generate="true"
property, the OpenFL creates the classes that is set to be exported from the swf.
If I change the files to extend some other class than openfl.display.MovieClip
and send this to Haxe compiler instead I get the intended behavior.
The final "wall" is how to automate this without having to change every generated file by hand (which would destroy the sole purpose of automation)?
Upvotes: 2
Views: 135
Reputation: 2098
Excerpt from an answer by Singmagesty (Joshua Granick, OpenFL founder) in this post on OpenFL community forums:
... cleanest solution is to have your own
format.swf.lite.MovieClip
class in a classpath you include after the SWF library. Make the modifications you need there ...
Upvotes: 1