AssetLibrary.getMovieClip with multiple inheritance


I work on a project in which we use a lot of SWF files. So I am using AssetLibrary to load and use movie clips. I create bundles with “openfl process”. But I encounter a problem with multiple inheritance in FLA file. I have configured a file with some movie clips :

  • One clip « ClipOne » which is configured to inherit directly from MovieClip
  • One clip « ClipTwo » which inherits from « ScriptedClip » which inherits from MovieClip

When I log the result of « getMovieClip » I have a little problem :

var test = library.getMovieClip("ClipOne") ;
trace(test) ;
> [object ClipOne]

var test = library.getMovieClip("ClipTwo") ;
trace(test) ;
> [object ScriptedClip]

Which is not really nice since we need to know which class is created. Do you have a solution about this ?

Second thing :
We have multiple swf files with same anim names ex : “AnimAttack”. When we process a swf file, it create a bundle with all classes in it with all class in package “package ;”. But if we have multiple movie clips with same names in different bundles, it can create conflicts.


Is ClipTwo an “Export for ActionScript” class?

Can you tell if the instance is actually an instance of ClipTwo or is it for sure only an instance of ScriptedClip?

Currently you can workaround clips with the same names by using the “prefix” attribute when generating the bundle like “SWF1” which makes it “SWF1ClipTwo”, etc

Yes ClipTwo is an “Export for ActionScript”.

Yes again, the instance is actually an instance of ClipTwo because we can cast it. But in the project, at the point where we need the class name, we did not know which Clip we have requested. So I think that the clips have a good type but they are cast by AssetLibrary into their parent class. Is there a way to avoid that ?

Thanks for the tips with prefix. I’ll have a look at this but I think it will do the trick ! :slight_smile: