A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: addChild moves textbox above other images/movie clips

  1. #1
    Junior Member
    Join Date
    Oct 2008
    Posts
    4

    addChild moves textbox above other images/movie clips

    I have a dynamic text box inside a movie clip. The movie clip resides below a bunch of other images and movie clips on the stage, so that if the other movie clips are moved across the screen, they cover up the text box.

    The problem I have is that I added a link dynamically, and now the textbox appears on top of everything else. Is there a way I can make this sit behind everything else again?

    My code:

    public function showContent():void {
    this.gotoAndStop( "content" );

    // hide various screens
    hideClip( this.startmenu );
    hideClip( this.downloadscreens );

    showClip( this.bodytext );
    setClipLanguage( this.bodytext );




    this.bodytext.introCopy.htmlText += "Disc 1 is totally baller. Some other text. Etc, etc, etc. Please review the the <a href='event:Link Clicked'>usage guidelines (PDF) </a> before beginning work.";

    addChild(this.bodytext.introCopy);

    this.bodytext.introCopy.addEventListener(TextEvent .LINK, linkEvent);






    this.bodytext.language.addEventListener( MouseEvent.CLICK, this.selectLanguage );

    }

    function linkEvent(event:TextEvent):void {
    trace("HOORAY! I'm a PIRATE");
    // Link Clicked
    }


    I tried to add this code:

    Stage.setChildIndex(this.bodytext.introCopy, 0);


    but I got an error, Stage is not a variable

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Stage is a class. stage is an instance.

    You've got to call setChildIndex on the parent of the child, so if you added it to anything other than stage (like root), that line is incorrect.

  3. #3
    Junior Member
    Join Date
    Oct 2008
    Posts
    4
    Got it. Its working now.

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