0 Replies Latest reply on Jun 7, 2010 7:42 AM by mesanarapscallion

    Flex won't display a child of a container movie clip

    mesanarapscallion Level 1

      I have a Container Movie clip called frameContainer in wich I load new Frames( a symbol from flash), with this function:

       

                   var i:Number=0;
                  frameContainer.x=48;
                  xPos=0;
                  do
                  {
                      frames.push(new Frame());
                      frameContainer.addChild(frames[i]);
                      slideshow.push(false);
                      frames[i].index=i;
                      frames[i].f.width=frameWidth;
                      frames[i].f.height=frameHeight;
                      frames[i].x=xPos;
                      frames[i].y=0;
                      xPos+=frames[i].f.width+10;
                      frames[i].f.addEventListener(MouseEvent.MOUSE_UP,fMouseClickOnFrame,false,0,true);
                      i++;
                  }while(xPos<200)

       

                  frameNumber=i;
                  this.addChild(frameContainer);

       

       

      The previous function works great.And I have a function called addNewFrame() which adds a new Frame at the end:

       

             private function addNewFrame():void
              {
                  frames.push(new Frame());
                  frameContainer.addChild(frames[frameNumber]);
                  frames[frameNumber].f.width=frameWidth;
                  frames[frameNumber].f.height=frameHeight;
                  frames[frameNumber].x=xPos;
                  frames[frameNumber].index=frameNumber;
                  xPos+=frames[frameNumber].width+10;
                  frameNumber++;
                  frames[frameNumber-1].f.addEventListener(MouseEvent.CLICK,fMouseClickOnFrame,false,0,true );
              }

       

      But, for some reason, the new frame can't be seen. When I type just

      addChild(frames[frameNumber]);

      (instead of  frameContainer.addChild(frames[frameNumber]) )

       

      it works great. Also I can access the new frame with the getChildAt method, the only, and biggest problem is that I can't see that new frame when I add it as a child of the frameContainer movie clip.

       

      Can someone please help