我的应用程序中有一个面板。我的要求是,我还需要一个链接,即“帮助选项”出现在面板的标题中。在左边,我们将有Panel的标题,在右上角,我需要这个链接。这可能吗?
答案 0 :(得分:1)
<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
width="400" height="300" label="Panel's Label">
<mx:Script>
<![CDATA[
private var linkTextField:TextField;
private var _linkHtmlText:String = "";
public function set linkHtmlText(value:String):void
{
_linkHtmlText = value;
if(linkTextField)
linkTextField.htmlText = value;
}
override protected function createChildren():void
{
super.createChildren();
linkTextField = new TextField();
linkTextField.autoSize = TextFieldAutoSize.LEFT;
linkTextField.text = _linkHtmlText;
linkTextField.y = 5;
this.titleBar.addChild(linkTextField);
}
override protected function layoutChrome(unscaledWidth:Number,
unscaledHeight:Number):void
{
super.layoutChrome(unscaledWidth, unscaledHeight);
linkTextField.x = unscaledWidth - linkTextField.width - 10;
}
]]>
</mx:Script>
</mx:Panel>
答案 1 :(得分:0)
import mx.core.IUITextField;
function init():void{
var rightpanel_ui:IUITextField = rightpanel.mx_internal::getStatusTextField();
rightpanel_ui.selectable = true;
rightpanel_ui.htmlText = "<a href='/mylink.php/' target='_new'><u><font color='white'>Help</font></u></a>";
}
<mx:Panel id="rightpanel" width="100%" height="100%" status="Help">