Skip to main content
Known Participant
January 11, 2013
Question

Add dynamic text to loader

  • January 11, 2013
  • 1 reply
  • 925 views

Hello,

I'm trying to get dynamic text to parent to a loader. I don't get any errors, but once I add the code(commented out below) the text that is rendered through the renderText function stops showing up. Any ideas?

//input Text

line1Label.text = "Line 1";

inputTextOne.text = "Custom Text: Line 1";

stage.focus = inputTextOne;

inputTextOne.addEventListener(TextEvent.TEXT_INPUT, renderText);

var hasText: Boolean;

function renderText (evt:TextEvent): void

{

inputTextRender01.text = inputTextOne.text;

hasText = true;

    if(hasText == true)

    {

        //.BGContain.addChild(inputTextRender01); //trying to add the text to the loader BGContain....

    }

}

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
January 11, 2013

What are you calling "loader" ?  What kind of object is it?

Known Participant
January 11, 2013

It's a movieClip.

Ned Murphy
Legend
January 11, 2013

I am not sure what you are trying to achieve, but here is what your code will do (with the commented out stuff uncommented)...

Wherever that inputTextRender01 textfield is located with respect to the upper left corner of the stage (or wherever it otherwise sits), when you add Child() it to the BGContain object, it will assume the same relative position within that object.  So it might be moved somewhere out of sight when you make the BGContain object its parent.

One other thing thing, not a problem, just unnecessary coding...

within the function...

    hasText = true;

    if(hasText == true)  // this line is unnecessary since you just made it true, but...

if it was necessary, you would only need to use if(hasText)...  there is no need to test for equality to true ( == true ) because whatever is inside the conditional is evaluated for its true/false status.