I think that I need to create a new panel for each image, let say if I have 3 images in one cell and the event is fired, now I get one panel for all with the same data and its not good for me, i need 3 panels with different data, How do I do it?? Can it be done?
Thanks again Jo --- In flexcoders@yahoogroups.com, "yossi.baram" <yossi.ba...@...> wrote: > > Hi Nate, > Thanks, it works > But I have one problem, > How can I show seperate details for each of the images? > rememver I have one cell that includes several images side by side > drawn from the loop bellow, and each one need to popup different data > on a tooltip. > > > private var tooltipData:String; > 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; > tooltipData = "image - " +i; > img.percentWidth=value.hair[i].width; > img.maintainAspectRatio=false; > img.addEventListener(ToolTipEvent.TOOL_TIP_CREATE, > tooltipDetailCreate); > addChild(img); > } > } > } > > private function tooltipDetailCreate(event:ToolTipEvent):void { > var tt:PanelToolTip = new PanelToolTip(); > tt.width = 190; > tt.height = 100; > tt.bodyText = tooltipData; > event.toolTip = tt; > } > > > and my PanelToolTip: > > <?xml version="1.0" encoding="utf-8"?> > <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" > implements="mx.core.IToolTip" > width="200" alpha=".8" borderThickness="2" > backgroundColor="white" > dropShadowEnabled="true" borderColor="black" borderStyle="solid" > shadowDistance="10" shadowDirection="right"> > <mx:Script> > <![CDATA[ > [Bindable] > public var bodyText:String = ""; > > > public var _text:String; > > public function get text():String { > return _text; > } > public function set text(value:String):void { > } > ]]> > </mx:Script> > > <mx:Text text="{bodyText}" percentWidth="100"/> > > </mx:Panel> > > The result I'm getting now is that I see a tooltip for each of the > images but with the same data (tooltipData = the last iteration of the > loop). > How can I set a different data for each of the images. > > Thanks a lot for the help :) > > Jo > --- In flexcoders@yahoogroups.com, Nathaniel Skiba <nate.skiba@> > wrote: > > > > 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 > > >