![]() |
![]() |
||||||
|
|||||||
| Tags: controls, functions, inside, itemrenderer |
![]() |
|
|||
|
I have a TileList control with an ItemRenderer. Inside the ItemRenderer I have
a Canvas Control, I want the Canvas Control to call a function when the mouse moves over it. <mx:TileList x="2" y="237" direction="horizontal" dataProvider="{MakeUpColours.lastResult.Colour}" backgroundColor="#FFFFFF" width="288" height="167.04999" themeColor="#FFFFFF"> <mx:itemRenderer> <mx:Component> <mx:Canvas width="35" height="35"> <mx:Canvas width="30" height="30" x="5" y="5" mouseMove="mouseMoveHandler(event);"> <mx:Image source="http://localhost/Flex/Personalised%20Palet tes-debug/{data.@PictureSrc}"/ > <mx:Label text="{data.@ColourNo}"/> </mx:Canvas> </mx:Canvas> </mx:Component> </mx:itemRenderer> </mx:TileList> However I get the error: Call to a possibly undefined method mouseMoveHandler. How can I call functions on controls inside itemRenderers? Thanks Katy |
| Sponsored Links |
|
|||
|
"katychapman85" <webforumsuser@macromedia.com> wrote in message news:g6svf7$ebl$1@forums.macromedia.com... >I have a TileList control with an ItemRenderer. Inside the ItemRenderer I >have > a Canvas Control, I want the Canvas Control to call a function when the > mouse > moves over it. > > <mx:TileList > x="2" y="237" > direction="horizontal" > dataProvider="{MakeUpColours.lastResult.Colour}" > backgroundColor="#FFFFFF" > width="288" height="167.04999" > themeColor="#FFFFFF"> > > <mx:itemRenderer> > <mx:Component> > <mx:Canvas width="35" height="35"> put a script tag here and define your mouse handler in it. > <mx:Canvas width="30" height="30" x="5" y="5" > mouseMove="mouseMoveHandler(event);"> > <mx:Image > source="http://localhost/Flex/Personalised%20Palet tes-debug/{data.@PictureSrc}"/ >> > <mx:Label text="{data.@ColourNo}"/> > </mx:Canvas> > </mx:Canvas> > </mx:Component> > </mx:itemRenderer> > </mx:TileList> HTH; Amy |
|
|||
|
This works:
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:XML id="xml"> <root> <item name="Test1"/> <item name="Test2"/> <item name="Test3"/> <item name="Test4"/> <item name="Test5"/> <item name="Test6"/> </root> </mx:XML> <mx:TileList dataProvider="{xml.item}" width="100%" height="100%"> <mx:itemRenderer> <mx:Component> <mx:Canvas width="200" height="200"> <mx:Canvas mouseMove="mouseMoveHandler(event);" width="200" height="200"> <mx:Script> <![CDATA[ private function mouseMoveHandler(e:MouseEvent):void{ lbl.text += "G"; } ]]> </mx:Script> <mx:Label id="lbl" text="{data.@name}"/> </mx:Canvas> </mx:Canvas> </mx:Component> </mx:itemRenderer> </mx:TileList> </mx:Application> |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise