dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [RESOLVED] Accessing Parent Movie Clip from Child Movie Clip

  1. #1
    Junior Member
    Join Date
    Jun 2007
    Posts
    24

    [RESOLVED] Accessing Parent Movie Clip from Child Movie Clip

    Hello All,

    I have a Movie clip nested inside another one (Named Parent and Child). I can of course easily access the child clip from the parent clip using dot syntax.

    I am trying to figure out how to access the parent clip from the child clip.

    What I am trying to do is; at the end of the child clip, I want the parent clip to continue on its timeline. I stop the parent clip, let the child clip run, and then I want the parent clip to finish running. It is a simple gotoAndPlay statement, but I just can not figure out how to access the parent clip.

    I am sure this is an easy problem, can somebody please help a noob out?

  2. #2
    Multitouch Aficionado
    Join Date
    Mar 2006
    Posts
    275
    try this.parent.play();

  3. #3
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,361
    the parent is accessible through the parent property.

    the parent property, however, is typed as DisplayObjectContainer so you'll need to cast the parent to MovieClip to access gotoAndPlay.

    code:
    MovieClip(parent).gotoAndPlay(yourFrameHere);


  4. #4
    Junior Member
    Join Date
    Jun 2007
    Posts
    24
    If I understood you correctly, my code would look like this...

    code:

    MovieClip(parent).slide1_root.gotoAndPlay(4);



    with slide1_root being the parent movie clip...

    IT works so far as I no longer get a undefinded property error...but it does not play, did I misunderstand your directions?

  5. #5
    Junior Member
    Join Date
    Jun 2007
    Posts
    24
    Ok, I got it now. I do not need to put the parent name in there since that is what the parent statement is doing. I got it to work now. Thanks for your help... O the life of a noob

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center