简体   繁体   中英

Displaying string text in flex

relatively new to flex. I am trying to display text from a string on a view. I would like if it wasn't in a list/button/text area but just text. I know how to display text but I'm not sure how you would take text from a string and put it to text on the screen. Thanks for the help!

Flex MXML has Label which would adhere to lifecycle and visual element display list.

Marking the string with the Bindable metadata tag will automatically update the rendered label when the value of the string changes.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark">

    <fx:Script>
        <![CDATA[
            [Bindable]
            protected var text:String = "Hello, World!";
        ]]>
    </fx:Script>

    <s:Label text="{text}" />

</s:Application>

Otherwise, you can still use standard TextField or even TLFTextField controls.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM