Skip to main content
Participant
June 5, 2010
Question

Change Default Text in component

  • June 5, 2010
  • 1 reply
  • 427 views

All tight the next text layout frame work is very cool; however, there is one thint I have not managed to do--to get rid of the default initial text that comes with the Flash Component.  ie how do I remove the first line of text : "TextLayout Sample Text" ?

I have no trouble adding and a manipulating new text, but I don't know how to get rid of that first line.

Some of the compiled examples do the trick, but none of them compile for me due to the following error ("Type was not a compile time constatne  ImportExportConfiguration)

This topic has been closed for replies.

1 reply

Participant
June 5, 2010

Solved my own problem---thought I'd share it and hopefully save other some frustration


// Instantiate the textLayout_flash class to create a TextLayout  Component.

var myTextComponent:TextLayout = new TextLayout();

// Add the new component to the Stage.
var myTextComponentOnStage:DisplayObject = addChild(myTextComponent);
// Get the Text Flow from the TextLayout Component.
var textFlow:Object = myTextComponent.textFlow;

//how to access first  element

var span0:SpanElement =textFlow.getFirstLeaf()

//change default text to "foo"

span0.text ="foo";