i got a solution to this problem.

Make few changes in the drawtheline component.

Code :

<?xml version="1.0" encoding="utf-8"?>

<mx:Box 
xmlns:mx="http://www.adobe.com/2006/mxml<http://www.google.com/url?sa=D&q=http://www.adobe.com/2006/mxml&usg=AFQjCNEtcLsIWFCjy8rhxFxIJ8W2RHUpyw>"
width="400"

height="300" creationComplete="createLine()" borderColor="#00FF00"
borderStyle="solid" mouseMove="findTarget(event)">

<mx:Script>

<![CDATA[

*import* mx.core.UIComponent;

*import* mx.controls.Alert;

*private* *function* findTarget(event:MouseEvent):*void*{

*if* (event.target.name == *"uiTest"*)

*this*.toolTip=*"this tooltip is coming only for the line"*;

*else
*

*this*.toolTip = *""*;
}

*private* *function* createLine():*void*{

*var* g:Shape = *new* Shape();

g.graphics.lineStyle(2, 0xFF0000, .75);

g.graphics.moveTo(0,0);

g.graphics.lineTo(400,300);

g.name = *"line"*;

*this*.uiComp.addChild(g);
}

]]>

</mx:Script>

<mx:UIComponent id="uiComp" name="uiTest"/>
</mx:Box>
Noe you can see the tool tip only for the line, not for the component.... :)




Akshar Kaul


On Wed, Jun 2, 2010 at 12:23, Akshar Kaul <[email protected]> wrote:

> i am creating the line using graphics methods. i dont think they support
> event listeners.
>
> Akshar Kaul
>
>
>
> On Tue, Jun 1, 2010 at 19:09, valdhor <[email protected]> wrote:
>
>>
>>
>> If it were me, I would create a custom tooltip; add a mouseover event
>> listener to your line; check the color directly under the mouse pointer and
>> show the tooltip.
>>
>>
>> --- In [email protected] <flexcoders%40yahoogroups.com>,
>> "akshar" <akshar.k...@...> wrote:
>> >
>> > i have a line in my application. i require that a tooltip should come
>> > only on the line. The line is in a custom component. when i add the
>> > tooltip to the component it shows the tooltip for whole of the
>> > component. is there a way to show the tooltip only for the line.
>> > here is a sample which i am trying :-
>> >
>> > main application file:-
>> >
>> > <?xml version="1.0" encoding="utf-8"?>
>> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
>> > layout="absolute" width="100%" height="100%" xmlns:local="*">
>> > <local:drawtheline/>
>> > </mx:Application>
>> >
>> > drawtheline component :-
>> >
>> > <?xml version="1.0" encoding="utf-8"?>
>> > <mx:Box xmlns:mx="http://www.adobe.com/2006/mxml"; width="400"
>> > height="300" creationComplete="createLine()" toolTip="this tooltip
>> > should come only on the line"
>> > borderColor="#00FF00" borderStyle="solid">
>> > <mx:Script>
>> > <![CDATA[
>> > import mx.core.UIComponent;
>> > private function createLine():void
>> > {
>> > var g:Shape = new Shape();
>> > g.graphics.lineStyle(2, 0xFF0000, .75);
>> > g.graphics.moveTo(0,0);
>> > g.graphics.lineTo(400,300);
>> > this.rawChildren.addChild(g);
>> > }
>> > ]]>
>> > </mx:Script>
>> > </mx:Box>
>> >
>>
>>  
>>
>
>

Reply via email to