Hi Gerald,

Sorry, I have two words on your solution.

Writing the catch block around your exception is not the good
solution, find and fix why exception occurrence, if we don't have the
way then we need to do so !

1)  Adding a eventlistner to the container is bad practise (in your
case)
       it works because you have the workaround now, what if there is
another element in your container which is having label property like
Text, it won't throw you exception and also it will navigate try to
navigate to page which is on text's label.

2)  By Adding the event listener to the container you are able to
listen every click on the container which is not necessary.
     and you are navigate to page with out q value --> 
http://www.google.com/finance?q=

3)  Adding listner to the individual links will make sense as sampath
said !,

I am filing the code here for your further analysis ...
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>
    <mx:Script><![CDATA[
        private function linkHandler(event:MouseEvent):void {
            var url:URLRequest = new URLRequest("http://
finance.google.com/finance?q=" + event.target.label);
            navigateToURL(url);
        }

    ]]></mx:Script>
    <mx:Panel id="p1" title="Click on a stock ticker symbol">
        <mx:LinkButton label="ADBE" click="linkHandler(event)"
width="100%" textAlign="left"/>
        <mx:LinkButton label="GE" click="linkHandler(event)"
width="100%" textAlign="left"/>
        <mx:LinkButton label="IBM" click="linkHandler(event)"
width="100%" textAlign="left"/>
        <mx:LinkButton label="INTC" click="linkHandler(event)"
width="100%" textAlign="left"/>
    </mx:Panel>
</mx:Application>

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Warm Regards,
Imtiyaz Basha M S
"Why do we never have time to do it right, but always have time to do
it over ?"


On Oct 27, 6:40 pm, Gerald Anto Fernando <flex.gerald.a...@gmail.com>
wrote:
> hi sampath i got it.
> one member told wrap the code in try catch.
> now it is working fine
>
> thanks,
> Gerald A
>
>
>
> On Tue, Oct 27, 2009 at 4:08 PM, Sampath Kumar <sampat...@gmail.com> wrote:
> > The Panel does not have any label attribute and hence you are getting the
> > error. An alternate approach would be to add click handler to the link
> > buttons instead of the panel.
>
> > Regards
> > Sampath
>
> > On Tue, Oct 27, 2009 at 3:53 PM, Gerald Anto 
> > <flex.gerald.a...@gmail.com>wrote:
>
> >> see this code
>
> >> <?xml version="1.0"?>
> >> <!-- events/SingleRegisterHandler.mxml -->
> >> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> >> creationComplete="createLinkHandler();">
> >>    <mx:Script><![CDATA[
> >>        private function linkHandler(event:MouseEvent):void {
> >>            var url:URLRequest = new URLRequest("http://
> >> finance.google.com/finance?q=" +
> >>            event.target.label);
> >>            navigateToURL(url);
> >>        }
> >>        private function createLinkHandler():void {
> >>            p1.addEventListener(MouseEvent.CLICK,linkHandler);
> >>        }
> >>    ]]></mx:Script>
> >>    <mx:Panel id="p1" title="Click on a stock ticker symbol">
> >>        <mx:LinkButton label="ADBE"/>
> >>        <mx:LinkButton label="GE"/>
> >>        <mx:LinkButton label="IBM"/>
> >>        <mx:LinkButton label="INTC"/>
> >>    </mx:Panel>
> >> </mx:Application>
>
> >> The above are code in the following page
>
> >>http://livedocs.adobe.com/flex/3/html/help.html?content=events_08.htm...
>
> >> it was working fine but when i click the title of the border,
> >> will through the error like
>
> >> ReferenceError: Error #1069: Property label not found on
> >> mx.core.UITextField and there is no default value.
> >>        at
> >> check/linkHandler()[H:\workspace\flexspace\testing\src\check.mxml:
> >> 6]
> >> what is this error?
>
> >> when i click directly click on it in the corresponding help page
> >> it will not through the error
>
> >> why?
>
> >> Thanks&Regards,
> >> Gerald A
>
> --
> Thanks & Regards,
> A  Gerald
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to flex_india@googlegroups.com
To unsubscribe from this group, send email to 
flex_india+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to