Hi Friend please try this sample code below:
======================================
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
width="500"
height="500"
creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function init():void
{
var sp:Sprite=new Sprite();
with (sp.graphics)
{
clear();
lineStyle(2, 0xFF0000);
beginFill(0xFFcc00, 100);
drawRect(10, 10, 50, 50);
endFill();
}
ui.addChild(sp);
}
private function onMouseTextDoubleClick(ev:MouseEvent):void
{
Alert.show("helllo");
}
]]>
</mx:Script>
<mx:Canvas width="100%"
height="100%"
doubleClickEnabled="true">
<mx:Canvas width="100%"
height="100%"
doubleClickEnabled="true">
<mx:UIComponent id="ui"
width="200"
height="200"
buttonMode="true"
doubleClickEnabled="true"
doubleClick="{onMouseTextDoubleClick(event)}">
</mx:UIComponent>
</mx:Canvas>
</mx:Canvas>
</mx:Application>
========================================
Your code will not work until there is nothing in the UI component. I tried
it by adding simple sprite to it and it worked. I hope it helps.
Thanks
On Mon, Sep 27, 2010 at 4:06 PM, nithya flex <[email protected]> wrote:
> Thanks for suggestions, But I want it in UI component.
> There few custom component which are built based upon(by extending
> UIComponent), so for this reason am doing this.
>
>
>
>
> On Mon, Sep 27, 2010 at 3:22 PM, Anoop PK <[email protected]> wrote:
>
>> Hi Nithya,
>>
>> Why are you using UIComponent. Instead of that you can use Canvas
>> itself and it will work without any probs.
>> is there any particular reasons to use UIComponent?
>> AFAIK, DoubleClick events are registered for the sub classes of the
>> UIComponent, and hence u need to use some of the sub classes.
>>
>> Happy Coding,
>> Cheers,
>> Anoop PK
>>
>> On Sep 27, 2:36 pm, nithya flex <[email protected]> wrote:
>> > Hi,
>> >
>> > I am trying catch mouse double click event from UIComponent, it seems
>> like I
>> > am missing some thing to make it work. Here is my code, any idea
>> >
>> > <mx:Canvas width="100%" height="100%" doubleClickEnabled="true">
>> >
>> > <mx:Canvas width="100%" height="100%"
>> doubleClickEnabled="true"
>> >
>> >
>> >
>> > <mx:UIComponent width="100%" height="100%"
>> > mouseChildren="true" buttonMode="true" doubleClickEnabled="true"
>> > doubleClick="{onMouseTextDoubleClick(event)}" >
>> >
>> > </mx:UIComponent>
>> >
>> > </mx:Canvas>
>> >
>> > </mx:Canvas>
>> >
>> > <mx:Script>
>> >
>> > <![CDATA[
>> >
>> > *import* mx.controls.Alert;
>> >
>> > *private*
>> *function*onMouseTextDoubleClick(ev:MouseEvent):
>> > *void*{
>> >
>> > Alert.show(*"helllo"*);
>> >
>> > }
>> >
>> > ]]>
>> >
>> > </mx:Script>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Flex India Community" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<flex_india%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/flex_india?hl=en.
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Flex India Community" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<flex_india%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/flex_india?hl=en.
>
--
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en.