Adding links to a Panel container’s status text in Flex

简介:

The following example shows how you can assign an HTML formatted string to a Panel container’s status text field using the getStatusTextField() method in the mx_internal namespace.

Full code after the jump.

 

Since this example uses the mx_internal namespace, you can’t always depend on this behavior to work in future versions of the Flex SDK. Use at your own risk.

<? xml version="1.0" encoding="utf-8" ?>
<!--  http://blog.flexexamples.com/2008/04/17/adding-links-to-a-panel-containers-status-text-in-flex/  -->
< mx:Application  xmlns:mx ="http://www.adobe.com/2006/mxml"
        layout
="vertical"
        verticalAlign
="middle"
        backgroundColor
="white"
        creationComplete
="init();" >

    
< mx:Script >
        
<![CDATA[
            import mx.core.IUITextField;
            import mx.controls.Alert;

            private function init():void {
                var tf:IUITextField = panel.mx_internal::getStatusTextField();
                tf.selectable = true;
                tf.addEventListener(TextEvent.LINK, textField_link);
                tf.htmlText = "status with <a href='event:showAlert'><u>link</u></a>";

            }

            private function textField_link(evt:TextEvent):void {
                Alert.show("Success! A Panel container with a link in the status text.", evt.text);
            }
        
]]>
    
</ mx:Script >

    
< mx:Panel  id ="panel"
            title
="Title"
            status
="status with link"
            width
="320"
            height
="240" >
        
< mx:Text  text ="Click the link in the Panel container's status bar to launch an Alert control."
                width
="100%"  selectable ="false"   />
        
< mx:ControlBar >
            
< mx:Text  htmlText ="&lt;b&gt;Note:&lt;/b&gt; The status text field must have it's selectable property set to true in order to dispatch the link event."
                    width
="100%"  selectable ="false"   />
        
</ mx:ControlBar >
    
</ mx:Panel >

</ mx:Application >





    本文转自 OldHawk  博客园博客,原文链接:http://www.cnblogs.com/taobataoma/archive/2008/04/23/1167844.html,如需转载请自行联系原作者



相关文章
Unknown custom element: <add-employee> - did you register the component correctly? For red cursive c
原因: 1.组件名没写对(导入和注册不对应) 2.components少写了个s 3.组件命名最好是驼峰命名 4.导入时语法错误 5.代码中有两个components,后一个的值把前一个覆盖了 6.组件直接循环套用了
|
11月前
|
前端开发
display:contents
display:contents
52 1
Cannot find source code based button in SE24
When you are logging on to customer system for incident handling, you want to switch to source code to perform some keyword search. However, you could not find button “Source code based builder” in toolbar, with following warning message: ———————————————— 版权声明:本文为CSDN博主「汪子熙」的原创文章,遵循CC 4.0 BY-SA版权协
Cannot find source code based button in SE24