A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: parent.madness

Hybrid View

  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    11

    parent.madness

    chimera-studio.com/misery.fla

    Any ideas as to why this won't work??
    It's such a simple concept...


    I have this code on the middle frame of a movieclip in my main timeline.
    When the nav buttons are pressed they play an animation and report their names to a variable called "navigation" that's declared in the first frame of the main timeline.


    I'm using this code:
    parent.gotoAndPlay(parent.navigation);

    Any code that uses "parent." will cause these errors:

    1061: Call to a possibly undefined method gotoAndPlay through a reference with static type flash.displayisplayObjectContainer.

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    That's because DisplayObjectContainer does not define a gotoAndPlay method. MovieClip does, so if you want to use MovieClip methods, you have to tell the compiler that the object is a MovieClip.
    Code:
    var p:MovieClip = MovieClip(parent);
    p.gotoAndPlay(p.navigation);

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