Loading SWF assets with defined base classes

I’ve asked about this in the past:

Just wondering if there has been any development on this front since.
It’s awkward having to re-target the asset as a child object of the class (ie, wrapping).
There’s also a problem when a movieclip asset includes instances of other movieclips with base classes, where the movieclip instances require a custom behaviour. These instances have to be dynamically replaced with a wrapped version, but if they exist within a timeline this can’t really be done as far as I can tell.

What would be ideal is if Assets.getMovieClip attempted to load the stated base class reference stated in the SWF (ie, the Haxe version of the class)… or maybe an override that allowed me to pass a class reference.

1 Like

Great news!


It’s almost like I wished it into being.
Brilliant work, Josh, can’t wait to give this a try.


One more thing…
This is a bit off-topic, but I’m currently trying to convert an old AS2 project to openfl.
The biggest problem I have is converting all the instance based actionscript (they disabled this feature with the advent of AS3 and later completely removed it from Flash CC onwards).
I considered some MovieClips like components, eg - a hitbox that on interaction, would give the player an item. The interactive hitbox was 1 instance of a MovieClip named ‘Interact’ that was used repeatedly throughout the project. The unique action was defined in the instance’s actionscript.

Now, I could just transfer all of this logic outside the instance and refer to the instance by name… but this would be terribly messy.
So, I’m converting all these instances with component-like behaviour - to actual components.
Sticking with the interact example - there is now a parameter ‘action’ which I can set to the string ‘give [item_id] [quantity]’, and this is easily interpreted by Interact’s class.

I’m now wondering… is the SWF library capable of seeing a component instance’s parameters in the SWF? Or will I require some JSFL-based pre-processor thingy to export all my component data separately?

I assume that there is some visibility there in AVM bytecode, although I have not tried to parse AVM1 bytecode, it might take a bit of work to understand what is there and what it means :slight_smile: