No- something like this.

 

 

<?xml version="1.0"?>

<!—renderer.mxml -->

 

<mx:VBox xmlns:mx="http://www.macromedia.com/2005/mxml" backgroundAlpha="0" borderThickness="0">

   <mx:Script>

  

        <![CDATA[

        import flash.util.*;

 

            // Override the setter method.

 

            override public function set dataObject(value:Object):Void{        

                if(value != null)

                {// Use super to set the value in the base class.

                    super.dataObject = value;

                   my_icon.visible=true;

            } else{

              my_icon.visible=false;

            }

            }

           

         

            

        ]]>

    </mx:Script>

      <mx:HBox height="16" width="100%" horizontalAlign="left">

          <mx:Image id="my_icon" source="@Embed('icon.png')" visible="false" width="16"></mx:Image>

          <mx:Label htmlText="{dataObject.label}"></mx:Label>

      </mx:HBox>

</mx:VBox>

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of keishichi2001
Sent: Thursday, November 24, 2005 9:11 PM
To: [email protected]
Subject: [flexcoders] Re: Handling dataObject within a CellRenderer

 

Do you mean it's a bug?
Any workaround that i could take?

-- Keishichi


--- In [email protected], "bitchwhocodes" <[EMAIL PROTECTED]> wrote:
>
> In Flex 2.0 you should be able to override the set dataObject and do
> what you need to do there.
>
>
> --- In [email protected], "keishichi2001"
> <[EMAIL PROTECTED]> wrote:
> >
> > Flex 2.0
> >
> > A TileList definition has a CellRenderer with 'listItemRenderer'.
> > This CellRenderer should be able to handle value of dataObject which
> > is passed from the TileList.
> > I think there are two cases to handle dataObject within CellRenderer.
> >
> > (i) Direct access to a property of dataObject.
> >     ie) <mx:Label text="{dataObject.abc}" />
> > (ii) Handle a property of dataObject in AS function.
> >     ie) public function onCreationComplete(event:Object) {
> >           if (dataObject.abc == "brabra") {
> >           .....
> >
> > I have no issue at case (i), but case (ii).
> > I got following error dialog at the time.
> >
> > =======
> > TypeError: Error #1010: undefined has no properties.
> >       at adayCellRenderer/onCreationComplete()
> >       at adayCellRenderer/___Canvas0_creationComplete()
> >       at flash.events::EventDispatcher/dispatchEvent()
> >       at
> >
>
mx.core::UIComponent/mx.core:UIComponent$protected::dispatchCreationCompleteEvent()
> >       at
> >
>
mx.core::UIComponent$/http://www.macromedia.com/2005/flex/mx/internal::dispatchCreationCompleteEvents()
> >       at
> >
>
mx.managers::LayoutManager/LayoutManager$1689$private::doPhasedInstantiation()
> >       at
mx.core::UIComponent/UIComponent$480$private::callLaterDispatcher2()
> >       at
mx.core::UIComponent/UIComponent$480$private::callLaterDispatcher()
> > =======
> >
> > As you see, this function is invoked at creationComplete event of the
> > CellRenderer, so all objects should be accessible at the time.
> > Therefore i totally don't understand why i'm getting this error....
> >
> > Any information will be appreciated.
> >
> > Best Regards,
> > Keishichi
> >
>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to