0 Replies Latest reply on Jul 2, 2007 11:31 PM by Toiletfreak

    Problem with goto when calling getChildByName

    Toiletfreak
      hi, I am using new to duplicate a movie clip (blabla). Works fine for .x , .y , etc but when I try gotoAndStop(11), with all the necessary code within that MovieClip, it fails.

      Code is as shown below:

      import flash.display.*

      var posX:int = 0;
      var testing = new Array();
      for (var i:uint=0;i<10;i++) {
      var blabla = new Symbol1();
      blabla.x = posX;
      posX += 10;
      blabla.name = "b" + i;
      testing.push(blabla);
      addChild(blabla);
      }

      trace(getChildByName("b5") is MovieClip)
      //this can work
      getChildByName("b5").x = 300

      /*this cannot work, gives error:
      1061: Call to a possibly undefined method gotoAndPlay through a reference with static type flash.displayisplayObject.
      */

      getChildByName("b5").gotoAndPlay(20);

      Please help!! Thanks!