We help IT Professionals succeed at work.
Get Started

Icon in Panel Title Bar

jdunneuk asked
Last Modified: 2010-04-21
Hi Guys,

 I have made a custom mxml component and its called my panel. The panel is held in a view, however my problem is the first call to the view works fine all the links and everything are correct, however when I do a second call to the same view the old data is in the links, I know i need to invalidate the display some how but I am totally stumpted.

Any suggestions / soultions would be great

thanks in advance


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">
            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;
                public var linkName:String = new String();
                public var returnedArray : ArrayCollection = new ArrayCollection();
                public var linkURL:String = new String();
                public var linkImage:String = new String();
                public var    visibleImage:Boolean = false;
                public var identify : String  = new String();   
                public var    screenID : String  = new String();       
            private var myHbox:HBox;
            private var myText:Text;
            private var myImage:Image;
            override protected function createChildren() : void
                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 );
                    // Init image, its event handlers
                    myImage = new Image( );
                    myImage.source = String(returnedArray.getItemAt(1));
                    myImage.width = 18;
                    myImage.height = 18;
                    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')
            private function updateText():void{
                //used for delayed rendering
                if(linkURL != ""){
                    this.visibleImage = true;
                myText.text =this.linkName;

Open in new window

Watch Question
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

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.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE