PDA

View Full Version : adding tooltip to image


ljonny18
12-07-2007, 10:03 AM
Hi I am imbedding an image within a component the following way:


[Embed(source='../images/myImage.png')]
public var myImageClass:Class;

public var myImageImg:Bitmap;

myImageImg = new myImageClass ();
myImageImg.x = 10;
myImageImg.y = 10;

addChild(myImageImg);


Which seems to work fine!!! Now I simply add a tool tip to this image and I am not sure how to go about it from this angle.


Could someone please help and point me in the right direction???

Thanks,
Jon.

Jim Freer
12-07-2007, 07:05 PM
Tooltips are implemented in the Flex framework, but Bitmaps are built into the Flash player and thus tooltips are not available. I used an Image component instead of a Bitmap which is a Flex component here:


import mx.controls.Image;

[Embed(source='../images/myImage.png')]
public var myImageClass:Class;

public var myImageImg:Image;

private function onCreationComplete
()
:void
{
myImageImg = new Image();
myImageImg.source = myImageClass;
myImageImg.x = 10;
myImageImg.y = 10;
myImageImg.toolTip = "myImage.png";

addChild( myImageImg );

} // onCreationComplete


Jim Freer
http://freerpad.blogspot.com/