Adobe Dreamweaver Forums



Last 10 THreads :         Restate my problem - YET AGAIN (Last Post : Raymond Basque - Replies : 5 - Views : 6 )           »          How to find number of occurance of each number in biglist of numbers? (Last Post : Dan Bracuk - Replies : 3 - Views : 6 )           »          Suddenly can't see files on remote server (Last Post : Alan - Replies : 1 - Views : 2 )           »          files are one level too deep (Last Post : Alan - Replies : 6 - Views : 7 )           »          Moving custom tag registration between servers. (Last Post : nosredna - Replies : 0 - Views : 1 )           »          How to do this?. (Last Post : Dan Bracuk - Replies : 1 - Views : 2 )           »          Spry Menu Background (Last Post : ich_kann_schnell_laufen - Replies : 0 - Views : 1 )           »          Dreamweaver CS4 makes my fonts go mental? (Last Post : theRizzer - Replies : 3 - Views : 9 )           »          mpg video will play in FF but not in IE (Last Post : Old Shoe - Replies : 0 - Views : 1 )           »          Create A Rotator Banner in DW? (Last Post : BigScaryRobot - Replies : 2 - Views : 3 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags: , , ,



Reply
  #1 (permalink)  
Old 07-31-2008, 07:30 PM
katychapman85
 
Posts: n/a
Diggs:
Default Functions for Controls Inside an 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



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-31-2008, 07:55 PM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: Functions for Controls Inside an ItemRenderer


"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


Reply With Quote
  #3 (permalink)  
Old 08-01-2008, 02:25 AM
Greg Lafrance
 
Posts: n/a
Diggs:
Default Re: Functions for Controls Inside an ItemRenderer

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>

Reply With Quote


Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 08:09 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk