Skip to main content
Participant
March 29, 2009
Question

textlayout and ActionScript

  • March 29, 2009
  • 3 replies
  • 1247 views
hi,
i have some data that is generated from a database and loaded into flash, my problem is that this data should change when a user chooses product. how can i have the data inside the created textflow using as3? below are some of the code i user

plese help so that i can update or even delete this textflow
span.text = ms[index].pdescription; // is the text loaded for the first time ? i need to be able to change this text
This topic has been closed for replies.

3 replies

Adobe Employee
April 2, 2009
You'll have to downcast the return of getFirstLeaf to a SpanElement.

a_circulo
Participating Frequently
October 22, 2009

that's true, this is a simple way to do that:

(yourTextFlow.getFirstLeaf() as SpanElement).text = "new text";

yourTextFlow.flowComposer.updateAllControllers();

Adobe Employee
April 2, 2009
You'll have to downcast the return of getFirstLeaf to a SpanElement.

Adobe Employee
March 31, 2009
How about remembering the textFlow somewhere and when you want to change the text write this:
textFlow.getFirstLeaf().text = "My New Text"
textFlow.flowComposer.updateAllContainers();

There are a many APIs for manipulating the elements in the TextFlow. Check out the docs.
Participant
April 2, 2009
Thanks,

but textFlow.getFirstLeaf().text = "My New Text" is a read only property !!!

the only way i found is to keep track of the span element and update its text

spant.text="new text"
textFlow.flowComposer.updateAllContainers();

but the problem is when creating more than one textflow element in the same document