This is a typical call to it
<common:customPanel screenID="overviewLinks" linkName="{modelAnnuity.annuityOverviewVO.annuityOwnerAnnuitantPnlTitle}" titleStyleName="txtPanelHead" styleName="pnlContent" verticalGap="0" horizontalAlign="right" width="100%" height="100%" id="owners_Title">
My panel code is this
<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="updateText()" styleName="pnlContent" titleStyleName="txtPanelHead">
<mx:Script>
<![CDATA[
import mx.controls.Text;
import mx.containers.Panel;
import mx.controls.Image;
import mx.containers.HBox;
import flash.events.MouseEvent;
import mx.controls.Alert;
import com.sunlife.us.workbench.util.common.linkUrlFunction;
import mx.collections.ArrayCollection;
[Bindable]
public var linkName:String = new String();
[Bindable]
public var returnedArray : ArrayCollection = new ArrayCollection();
[Bindable]
public var linkURL:String = new String();
[Bindable]
public var linkImage:String = new String();
[Bindable]
public var visibleImage:Boolean = false;
[Bindable]
public var identify : String = new String();
[Bindable]
public var screenID : String = new String();
private var myHbox:HBox;
private var myText:Text;
private var myImage:Image;
override protected function createChildren() : void
{
super.createChildren();
linkName = this.linkName;
returnedArray = linkUrlFunction.returnLink(identify,screenID);
linkURL = String(returnedArray.getItemAt(0));
visibleImage = returnedArray.getItemAt(2);
linkImage = this.linkImage;
//create the text object
myText = new Text;
myText.text = this.linkName ;
// Create an HBox in which to layout the icon
myHbox = new HBox( );
myHbox.addChild( myText );
myHbox.styleName="txtPanelHead";
if(visibleImage){
// Init image, its event handlers
myImage = new Image( );
myImage.source = String(returnedArray.getItemAt(1));
myImage.width = 18;
myImage.height = 18;
myImage.buttonMode=true;
myImage.addEventListener(MouseEvent.CLICK, linkHandler);
myHbox.addChild( myImage );
}
// Add the HBox and the icons to the titleBar display
titleBar.addChild( myHbox );
}
override protected function updateDisplayList (unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
// Do this or the HBox won't appear!
myHbox.setActualSize( myHbox.getExplicitOrMeasuredWidth(),
myHbox.getExplicitOrMeasuredHeight() );
}
private function linkHandler(event:MouseEvent):void
{
// Open the link in a new window,
navigateToURL(new URLRequest(this.linkURL), '_link')
trace(this.linkURL);
}
private function updateText():void{
//used for delayed rendering
if(linkURL != ""){
this.visibleImage = true;
}
myText.text =this.linkName;
}
]]>
</mx:Script>
</mx:Panel>
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE