Nested MovieClips HTML5

Hello,

I am new to this board so please forgive me if I missed a topic replying to my question.
I am trying to use a swf library in a project and I managed to import successfully and also instantiate an exported MovieClip from that.

Now, that MovieCip has two nested MovieClips that can be easily used as instances of their parent.

Each one of them has also a nested MovieClip and I am trying to use it by its instance name but I get an error in Chrome devtools that the object is undefined.

All movieclips are exported in the swf > as3 > frame1 and I can see them in HaxeDevelop assets > swf

The same thing works great if I choose swf compile.

So, to explain better I have this code:

var snd = new Music();

snd.ms.msmc.gotoAndStop(2);
snd.fx.fxmc.gotoAndStop(2);

which works fine in flash but not in html

If I change to

var snd = new Music();

cast(snd.ms.getChildByName(“msmc”), MovieClip).gotoAndStop(2);
cast(snd.fx.getChildByName(“fxmc”), MovieClip).gotoAndStop(2);

works fine on both platforms.

This means that nesting instances work only for the first level in html5 and then I have to use children array of the MovieClip?

Thanks!

Haxe removed the feature we used to use to implement dynamic access this way

I was considering a couple options:

1.) Generate classes for each MovieClip in the SWF (even if “Export for ActionScript” is not checked) so we can type each child object
2.) Create some kind of DisplayObjectAccess type (or implement through Object?) to allow opt-in dynamic access using some new features available in Haxe 4

I understand that cast + getChildByName is a bit cumbersome :frowning:

EDIT: FWIW you can currently use a temp variable as well:

var msmc:MovieClip = cast snd.ms.getChildByName("msmc");
msmc.gotoAndStop(2);
var fxmc:MovieClip = cast snd.fx.getChildByName("fxmc");
fxmc.gotoAndStop(2);