Featured Post

Page Flip effect in flash V0.1

I’m reading the book Flash Hacks by Sham Bhangal now… although this book is more than 5 years old and written with Flash MX in mind, the techniques are invaluable even today… One hack described in this book is the pageflip effect.  I know this has been around for a looooong time…but...

Read More

Tooltip custom Placement on Flex Listbox rollover

Posted by ravi | Posted in Listbox, flex, tooltip | Posted on 18-06-2009

Tags: , ,

0

The example below shows how to add a tooltip on roll over event of flex ListBox items. I don’t say that this is the perfect way to do this…but i’m happy as long as it serves me…

Get Adobe Flash player

just rollover any of the listbox items and it will show the index of that item. So once you’ve the index, i guess you can do any custom label operations.

Here is the source code for the above example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<![CDATA[
import mx.managers.ToolTipManager;
import mx.controls.ToolTip;
import mx.events.ListEvent;
import mx.events.ToolTipEvent;
import mx.collections.ArrayCollection;
[Bindable]
private var myDP:ArrayCollection = new ArrayCollection([{name:"Ted Patrick", blog:"http://www.onflex.org/"},
{name:"Ryan Stewart", blog:"http://blogs.zdnet.com/Stewart"},{name:"Peter DeHann", blog:"http://blog.flexexamples.com/"},
{name:"Raghu", blog:"http://raghuonflex.wordpress.com/"},{name:"Harish Sivaramakrishnan", blog:"http://flexgeek.wordpress.com/"}
]);

private var tip:ToolTip
private function itemRollOver(event:ListEvent):void
{

tip = ToolTipManager.createToolTip(event.rowIndex+"",event.currentTarget.x+event.currentTarget.width,event.currentTarget.mouseY)as ToolTip;
}
private function itemRollOut(event:ListEvent):void
{
ToolTipManager.destroyToolTip(tip)
}
]]>

itemRollOver="itemRollOver(event)" itemRollOut="itemRollOut(event)"/&gt;

Here is the post which explains a much simpler way to create tooltips but you cannot custom place these tooltips:

http://raghuonflex.wordpress.com/2007/09/19/tooltips-for-combobox-items-or-list-items/

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

Write a comment