Skip to main content
Participating Frequently
August 14, 2017
Answered

Referencing Parent MovieClip for WebGL Animations

  • August 14, 2017
  • 1 reply
  • 492 views

This is eating me alive!  I've tried possibly a hundred variations, and sifted through dozens of forums looking for answers, but to no avail.

I have a movieclip sitting on a timeline and I'm trying to reference that timeline.  Basically, I'm trying to go to specific frame on the parent timeline, but I'm trying to call that action from the child movieclip. 

In AS3, there's a few ways to do this, but nothing works when exported as WebGL.  Something like

MovieClip(this.parent).stop(2);

does not work when exported as WebGL.

Any solutions to this?  Is this a bug? 

This topic has been closed for replies.
Correct answer UDESCO

The main timeline can be referenced in Webgl as follows:

     var stage = player.getStage();

Any child movieclip can be referenced as follows:

     var stage = player.getStage();

     var child = stage.getChildAt( index );      or,      stage.getChildByName( instance-name );

           or simply,

     this.getChildAt( index );

Parent of a child can be referenced as:

     var parent = this.getParent();

and, control its timeline as:

     parent.gotoAndStop(2);

1 reply

UDESCO
UDESCOCorrect answer
Participating Frequently
August 16, 2017

The main timeline can be referenced in Webgl as follows:

     var stage = player.getStage();

Any child movieclip can be referenced as follows:

     var stage = player.getStage();

     var child = stage.getChildAt( index );      or,      stage.getChildByName( instance-name );

           or simply,

     this.getChildAt( index );

Parent of a child can be referenced as:

     var parent = this.getParent();

and, control its timeline as:

     parent.gotoAndStop(2);

Participating Frequently
August 16, 2017

Nipun you are amazing!  Thank you so much.  I have spent so much time tearing my hair out over this.  Your answer was exactly what I needed.  Thank you, Nipun!!