SWF asset Haxe wrapper


#1

Hi,

I can use SWF asset in my openfl project, like a charm.
But how can (if it’s possible) write wrapper class for access object in my library.

For example, I have a full screne created with Flash CC, with some MovieClip extended Objects ([object People])
All People object have Picture ([object People]) and Name ([object TextField])

And I wanted to write a wrapper class something like this:

class People extends openfl.display.MovieClip{
   public var picture:Picture;//Picture class extends MovieClip
   public var name:Name;//Name class extends TextField
}

#2

I think there is more than one way you might approach a problem like this, how I used to do it in ActionScript is doing something like…

1.) Export a symbol as “People_Display” in the SWF
2.) Make a class like class People extends People_Display
3.) At runtime, remove the instance created from the SWF (which will only be a “display” instance) and replace it with a new instance of your custom People class

For #3 I use this script: