Category Archives: AddChild

Dynamically adding paragraphs to a Spark RichText control in Flex 4

The following example shows how you can dynamically add paragraphs to a TextFlow in a Spark RichText control by creating a new SpanElement (<span/>) and ParagraphElement (<p/>) object and then adding the spans and paragraphs to the textFlow object using the addChild() method.

Full code after the jump.

Continue reading Dynamically adding paragraphs to a Spark RichText control in Flex 4

Adding an FTETextField object to the display list in Flex 4

The following example shows how you can add an FTETextField object (formerly TLFTextField) by using a Halo/MX container and the rawChildren.addChild() method or by using a SpriteVisualElement object and the addChild() method.

The mx.core.TLFTextField class was renamed to mx.core.FTETextField in 4.0.0.10872.

Full code after the jump.

Continue reading Adding an FTETextField object to the display list in Flex 4

Toggling a Flex container’s visibility using states

In a previous post, “Toggling a Flex container’s visibility”, we looked at toggling a VBox container’s visibility by setting both the visible property and includeInLayout property. While the approach felt a little crude, we can build the same thing using the much more powerful view states. What are view states and how do we use them? Well, if you’re new to states, this should clear everything up: “Adobe – Flex Quick Start Basics: Creating States”.

Now, with that out of the way, lets look at some code and a basic example.

Full code after the jump.

Continue reading Toggling a Flex container’s visibility using states