Hi,

    I want to apply mask for the images.there is one accordion in
which i have my images,one canvas in which i have to drag and drop
the
images.so the requirement is when i drag and drop the images i need
to
apply the mask.i tried alot,but iam not getting the masked image. and
for that images i want to apply colors at run-time.


         for my images i gave it as...


           <mx:image source="imagesource" id="mask_image"
cacheAsBitmap="true"           mouseMove="mouseOverHandler(event)"/>


public function mouseOverHandler(event:MouseEvent):void
            {


                  var img:Image = new Image;
                  img = event.currentTarget as Image;
                   //Alert.show(event.currentTarget.width);
                var dragInitiator:Image = new Image;
                dragInitiator = img;


                var ds:DragSource = new DragSource();
                ds.addData(dragInitiator, "img");


                // The drag manager uses the image as the drag proxy
                // and sets the alpha to 1.0 (opaque),
                // so it appears to be dragged across the canvas.
                var imageProxy:Image = new Image();
                imageProxy.source = img.source;
                imageProxy.height=100;
                imageProxy.width=100;
                DragManager.doDrag(dragInitiator, ds, event,
                    imageProxy, -15, -15, 1.00);
            }


      and now i have doubt, where i have to handle this images means,
what event i need to write...
i am handling this dragged image in "dragdrop"event.


private function dragDropHandler(event:DragEvent):void {


                   if (event.dragSource.hasFormat("img")) {
                  var draggedImage:Image =
                    event.dragSource.dataForFormat('img') as Image;
                  var dropCanvas:Canvas = event.currentTarget as
Canvas;
                  // Since this is a copy, create a new object to
                  // add to the drop target.
                  var str:String = new String;
                        str = draggedImage.source.toString();
                        //Alert.show(str);
                 if(str == "imagesource")
                 {
                    var mask_canvas:Canvas = new Canvas();
                    mask_canvas.cacheAsBitmap = true;
                    mask_canvas.mask = mask_image;
                    dropCanvas.addChild(mask_canvas);
                 }


    }


       i was written above code iam not getting...any one give me the
solution...it's very urgent.


Thanx in advance.......


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to