Extending haxe classes in Animate


#1

First off, yes I read Extending Haxe class in Flash/Animate (SWF lib) but it seems like he started that thread already knowing how to do what I’m looking for. I opted not to post in that thread because I’m not sure what the necro-posting preference of the forum is.

I’m trying to get a library asset with the linkage type “MovieClipPlusSwf” to extend my project class “MovieClipPlus”. so that if I create an instance of “MovieClipPlusSwf”, it has the behavior of “MovieClipPlus”.

To contrast with the question linked above, he seemingly already did this. but wanted every MovieClip to extends a class, whereas I want specific linkages to have specific base classes

I tried editing the _generated class, but it’s overriden on the next build.
I tried having the Animate assets extend MovieClipPlus.as - I file I created - which shared the same namespace as my haxe class (toplevel).

My end goal is to make a haxe version an existing flash API, which allowed you to use it by either putting premade assets in the desired location on your game’s timeline or by instantiating them in code (already handled).


#2

No idea on your question but maybe this is important: What would your target be? HTML5? native?

If you want to use HTML5 let me tell you that when I put 20 animated clips on screen performance goes down the drain. Maybe it is just me. To be sure, try putting all the animations on screen at the same time and then check your framerate. If you fail there, there is no point in migrating everything :man_shrugging:


#3

I made a plugin for Animate that lets you bind code, functions, variables and components to elements on the stage / timeline. Fully automatic and clean separated code / gui :slight_smile:


#4

My API is meant to be multi-platform but will primarily be used for web games. so html5 is high priority. That said, MovieClipPlus was just a random name chosen for my swf unit test. the final classes are just UI, and they won’t animate. Furthermore I recall having decent html performance on some heavy swfs in my last (abandoned) project, but I primarily tested in flash and neko.

That looks awesome! Got a link?


#5

no response… I don’t even really need all that fancy stuff, I just want a swf library asset to extend a haxe class


#6

Sorry, yeah! Well i havent released the plugin yet, it also requres my custom Haxe framework to use.
As extending classes from swf goes; a haxe class that extending from a MovieClip etc in a SWF library - that should be very straight forward. Or do you mean that you want to create a custom MovieClip type base ? I guess that will be more difficult.


#7

I’m asking for the latter. I want movieclips with a specific linkage id to extend a specific haxe class.

For example in The thread I posted above, nemostein posted the image below, where he specified a base class in the movieclip properties, I tried doing this but nothing seemed to work.
ff546d7d5ea9c79894ee08f8954f84376ac10ba8


#8

The Linkage Field in Animate is for Actionscript files, you can’t extend Haxe classes directly from there. Animate does not have any support for Haxe. But i guess it could be done using a custom Animate extension written in c++…


#9

Put it in the baseClassName field. That should work


#10

How are you loading them in openfl? As bundles after openfl process ?


#11

Try with empty linkage class. And specify the haxe class as base class, that’s how we load ours.


#12

Thanks, that worked!


All I did was have the linkage class match the desired haxe class.