We help IT Professionals succeed at work.

A button & image inside a tileList

activeRoy
activeRoy used Ask the Experts™
on
                    <mx:TileList width="100%" height="100%" id="product_tile" itemRenderer="CustomItemRenderer" 
					columnCount="4" 
					styleName="tile1"
					itemClick="tileList_itemClick(event)">

Open in new window

private function tileList_itemClick(evt:ListEvent):void { 
                img = new Image(); 
                // img.width = 300; 
                // img.height = 300; 
                img.maintainAspectRatio = true; 
                img.addEventListener(Event.COMPLETE, image_complete); 
                img.addEventListener(ResizeEvent.RESIZE, image_resize); 
                img.addEventListener(MouseEvent.MOUSE_OUT, image_click); 
				img.addEventListener(MouseEvent.MOUSE_DOWN, image_start_drag);
				img.addEventListener(MouseEvent.MOUSE_UP, image_stop_drag);				
                img.source = "http://localhost/funktion/templates/index/productimg/big/" + noS(evt.itemRenderer.data.spic);
				//Alert.show(img.source.toString());
                img.setStyle("addedEffect", image_addedEffect); 
                img.setStyle("removedEffect", image_removedEffect); 
                if (evt.itemRenderer.data.spic != "no_photo80x80.gif") {
				PopUpManager.addPopUp(img, this, true); 
		}
				
            

Open in new window

<?xml version="1.0" encoding="utf-8"?> 
<!-- http://blog.flexexamples.com/2008/03/08/creating-a-simple-image-gallery-with-the-flex-tilelist-control/ --> 
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" 
        horizontalAlign="center" 
        verticalAlign="middle" width="150" height="180">  
  

	<mx:Image source="http://localhost/funktion/templates/index/productimg/{data.spic}" />
    <mx:TextArea text="{data.name}" styleName="myFontStyle" wordWrap="true" editable="false" /> 
	<mx:Button label="details"  />


  
</mx:VBox>

Open in new window


The problem is, the tilelist itemClick will cover the button onclick or the image click function. that means,
i only want to click the image to enlarge the image, and click the button show alert box. But now, i click the button (actually clicking the tile item), will also enlarge the image and show the alert box....
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
In the button tag define a click event handler say its btn_clickHandler(event)

private function btn_clickHandler(event:MouseEvent):void{
         //Do whatever you want to do when button is clicked
       
       //Then stop the click event propagation
       event.stopImmediatePropagation();
}


you can do the same with the image.

Author

Commented:
RE:

I fixed my problem by myself........ thanks