Thanks Guys,

 

That works! Used both inputs to build the solution.

 

private function focusImage(event:Event, clicks:Number):void

{

    //Now set the current image window state based on number of

    //clicks

    imageWinState = (clicks == 1)? SMALL_IMAGE: LARGE_IMAGE;

                        

    selectedPhoto = new Object();

    selectedPhoto = event.currentTarget.selectedItem;

                        

    //If we are processing a single click 

    //sleep for a few milli(300) seconds to allow a double click

    //event to be caught before we display popup. 

    if(clicks == 1)

    {

        var popUpTimer:Timer = new Timer(DOUBLE_CLICK_SLEEP, 1);

        popUpTimer.addEventListener("timer", displayImagePopUp);

        popUpTimer.start();

    }

    else

    {

      //Just display the popup we have doubleclick

      displayImagePopUp();

    }

}

 

Cheers,


Greg              

 

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of jmfillman
Sent: Wednesday, February 20, 2008 3:09 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Supporting both double and single click events for
TileList

 

A timer option may be what you decide, but keep in mind that you can 
still control the popup from the application. So, the first click 
will always create the popup, but if you don't prevent use of the 
parent application while the popup is open (the only way to ever get 
a double click without a timer or some delay option), you should be 
able to change the image from a thumbnail to a larger size with a 
double-click. Take a look at this simple code.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
layout="vertical">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
import TestPopUp;
var myPopup:TestPopUp;

private function popUp(click:Number):void{
myPopup = TestPopUp
(PopUpManager.createPopUp(this, TestPopUp, false));
switch(click){
case 1:

myPopup.myImage.source = "images/arrowRight.PNG";
break;
case 2:

myPopup.myImage.source = "images/arrowLeft.PNG";
break;
}
}
]]>
</mx:Script>
<mx:Button label="Click Me" click="popUp(1);" 
doubleClickEnabled="true" doubleClick="popUp(2);"/> 
</mx:Application>

---------------------------------------
TestPopUp.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"; width="400" 
height="300">
<mx:Image x="174" y="118" id="myImage"/>

</mx:Canvas>

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> ,
"Greg" <[EMAIL PROTECTED]> wrote:
>
> Hi All,
> 
> 
> 
> I have a photo gallery on my site (TileList of thumbnails) and I am 
having
> problems with double click events when employing click event. I 
would like
> to support the events as follows:
> 
> 
> 
> - ItemClick, open image popup window with image slightly 
larger
> than thumbnail
> 
> - ItemDoubleClick, open image popup window with large view 
say
> 800x600
> 
> 
> 
> The ItemClick event happens before the double click and it displays 
a popup
> over the selected item. It seems impossible to catch the double 
click the
> way I am trying to implement it using both (itemClick and 
itemDoubleClick
> events). It feels like I need to catch a generic 'change' event, 
inspect how
> many mouse clicks occurred and proceed accordingly. 
> 
> 
> 
> Is this possible? 
> 
> 
> 
> Thanks,
> 
> 
> Greg
>

 

Reply via email to