;

PDA

Click to See Complete Forum and Search --> : addChild moves textbox above other images/movie clips


walker6o9
10-16-2008, 03:29 PM
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

5TonsOfFlax
10-16-2008, 04:25 PM
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.

walker6o9
10-16-2008, 05:25 PM
Got it. Its working now.