[flexcoders] Why cant I use mouseOver() in Image class, but using mx:Image tag, I can?

2009-02-19 Thread yossi.baram
Hi,
I have a dataGrid, and in one of the columns I call an ItemRenderer 
(ActionScript).
This renderer should create a list of images as follows:
override public function set data(value:Object):void {  
if (value != null)
   {
removeAllChildren();
for (var i:int = 0; i  value.hair.length; i++){
var img:Image = new Image();  
img.source = value.hair[i].image;  
img.id = image -  +i;
img.height = 20;  
img.toolTip=value.hair[i].width;
img.percentWidth=value.hair[i].width; 
img.maintainAspectRatio=false;
addChild(img); 
} 
}
}

All images are displayed side by side in a cell, as I wanted.

The problem is that I need to use img.toolTipCreate to catch an event 
on each of the images and It doesnt let me, why?
If I use mx:Image tag in mxml file, it lets me use this function but 
in my ActionScript it doesnt.

What is the different between this 2?
Thanks for any advice

Jo



Re: [flexcoders] Why cant I use mouseOver() in Image class, but using mx:Image tag, I can?

2009-02-19 Thread Nathaniel Skiba
toolTipCreate is an event, so when using AS, you have to use the
addEventListener function. The following should help:

img.addEventListener(ToolTipEvent.TOOL_TIP_CREATE, myHandlerFunction);

Just remember that you have to import ToolTipEvent, and
myHandlerFunction has to be a function that takes one argument which is
a ToolTipEvent.

~Nate