Hello,
I am looking for a perfect flex examples that Drog and drop
the image into canvas and move in that particular area of the
canvas....
Can any one plz help me?
I am trying from last one week but I am not getting the solution
with my code ...
Here is the code...
In this code i am doing drag and drop the image from the
tilelist in to the canvas ....
So the Problem is when i drag and drop the image into the
canvas corner so some portion of the image shown and some portion of
the image hide.. So I want to adjust the image according to that area
only during drag and drop and also during move and also the move is
not working perfectly.
public function doDragDrop(event:DragEvent):void
{
imageArr["img"+itemId] = new Image()
if (event.dragInitiator.parent ==
tileDesgin.dropCanvas)
imageArr["img"+itemId] =
event.dragInitiator as Image;
else
{
imageArr["img"+itemId] = new
Image();
imageArr["img"+itemId].source =
(event.dragInitiator as
Image).source;
//Alert.show("Else:->"+event.dragInitiator);
tileDesgin.hScaleSlider.value=100;
tileDesgin.nStepper.value=0;
tileDesgin.hScaleSlider.enabled=true;
tileDesgin.nStepper.enabled=true;
tileDesgin.dropCanvas.addChild(imageArr["img"+itemId]);
}
imageArr["img"+itemId].id = itemId;
//imageArr["img"+labelId].setStyle("color",globalColor);
//imageArr["img"+labelId].setStyle("fontFamily",imageArr
["img"+labelId].text);
imageArr["img"+itemId].addEventListener
(MouseEvent.CLICK,Item_Click);
if(isImageMove){
imageArr["img"+itemId].addEventListener(MouseEvent.MOUSE_DOWN,
doDragIt);
}
imageArr["img"+itemId].x = event.localX
-
(event.dragSource.dataForFormat("localX") as Number);
imageArr["img"+itemId].y = event.localY
-
(event.dragSource.dataForFormat("localY") as Number);
imageArr["img"+itemId].addEventListener(MouseEvent.MOUSE_DOWN,
doDragIt);
itemId++;
}
public function doDragIt(event:MouseEvent):void
{
Application.application.isImage = true;
Application.application.isLable= false;
var dragInitiator:Image = event.currentTarget
as Image;
var dragSource:DragSource = new DragSource();
var dragProxy:Image = new Image();
//Alert.show("Source:->"+dragInitiator.source);
dragProxy.source= dragInitiator.source;
dragProxy.width = dragInitiator.width;
dragProxy.height= dragInitiator.height;
dragSource.addData(event.localX, "localX");
dragSource.addData(event.localY, "localY");
//dragProxy.setActualSize
(event.currentTarget.width,event.currentTarget.height)
DragManager.doDrag(dragInitiator, dragSource,
event, dragProxy,
0,0);
}
<local:TileEx dragEnabled="true" horizontalScrollPolicy="off"
styleName="Tile" id="tilelistgallery"
dataProvider="{tilelistgalleryarray}"
itemRenderer="View.GraphicTileListRender" columnCount="3"
columnWidth="60" rowHeight="60" x="0" y="25" height="75" width="200"
borderThickness="0"/>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---