Thanks for the compliment - there are a lot of talented people that hang out on the list. It looks like the last hurdle has to deal with adding the offset to your drop point. This should be the localX and localY coordinates captured on mouse down on the furniture graphics. Other than that - looks like a great application!
Rick Winscot From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Gireesh Kumar Sent: Monday, June 02, 2008 9:17 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Flex drag n drop, zoom issue Hi Rick, I have integrated the fix, and its working like charm , Thank you very much. Now I know whom to look for If i have any issue with Flex :-). I have also updated my url with the new code. Now the only issue left is, when I drag and drop item to the plan, it get slightly shifted not getting dropped when I dropped, Guess I need to adjust my x/y point calculations. http://gireeshkumar.ind.in/designDemo/floorDesign2.html Thanks Gireesh On Mon, Jun 2, 2008 at 9:39 AM, Gireesh Kumar <[EMAIL PROTECTED]> wrote: Hi Rick, It worked, I need to make some adjustment to my application to get this integrated. Thanks you very much. Gireesh. On Mon, Jun 2, 2008 at 9:06 AM, Rick Winscot <[EMAIL PROTECTED]> wrote: Right. I don't have the time to fix your application for you - but I do have time to give you a quickie example that will set you in the right direction. This example works as-is if you replace the house_plans.png and couch.png images. The 'take-aways' are listed below the example. <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ private function doZoom():void { myCanvas.scaleX = myCanvas.scaleY = ( myZoomer.value / 100 ); } ]]> </mx:Script> <mx:VSlider x="414" y="151" minimum="10" maximum="100" snapInterval="5" liveDragging="true" id="myZoomer" change="doZoom();" value="100"/> <mx:Canvas x="439" y="151" width="400" height="400" id="myHolder"> <mx:Canvas id="myCanvas" horizontalScrollPolicy="off" verticalScrollPolicy="off"> <mx:Image source="house_plans.png"/> <mx:Image x="62" y="26" source="couch.png"/> </mx:Canvas> </mx:Canvas> </mx:Application> Key Take-aways: #1 - a container in container approach helps eliminate scroll bar scaling issues #2 - a container in container approach helps reduce the number of scalable objects you have to keep track of to one (myCanvas - children should be added here) #3 - position of all objects is maintained without having to after-manage coordinates How you manage the size/ratio of objects after you get this all setup. should probably be done just setting the unscaledWith and unscaledHeight appropriately. Rick Winscot From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Gireesh Kumar Sent: Sunday, June 01, 2008 2:04 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Flex drag n drop, zoom issue Actually it is a canvas, and I am placing the objects on the canvas, I tried setting the plan image as background of canvas also. And if I change only the canvas scaleX and scaleY the placed object is not zooming properly. If you look at the source you will see this. Thanks Gireesh On Sun, Jun 1, 2008 at 11:06 PM, Rick Winscot <[EMAIL PROTECTED]> wrote: It crossed my mind that you might be doing something like this. can I recommend an alternate solution? Use a canvas/container to host your plan _and_ all of your placed objects - then just set the scaleX/scaleY of that canvas/container. If you do it this way - you won't have to worry about object placement or spacing. Rick Winscot From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Gireesh Kumar Sent: Sunday, June 01, 2008 1:06 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Flex drag n drop, zoom issue Hi, Here is the code I use to set the scaleX and Y values private function doZoom(event:Event):void{ if(currentPlanCanvas == null){ return; } doComponentZoom(currentPlanCanvas, (HSlider(event.currentTarget).value)); } private function doComponentZoom(component:UIComponent,val:Number):void{ component.scaleX = val; component.scaleY = val; if(component is Container){ var children:Array = Container(component).getChildren(); for(var i:int = 0; i < children.length; i++){ doComponentZoom(children[i], val); } } } Thanks Gireesh On Sun, Jun 1, 2008 at 10:22 PM, Rick Winscot <[EMAIL PROTECTED]> wrote: I took a quick look at your sample. and it looks like you are doing something strange with your scaleX/scaleY - they aren't being set uniformly. You'll only need a single change so I would think: scaleX = scaleY = zoomer.value -- no? Rick Winscot From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of gireeshgiri Sent: Sunday, June 01, 2008 3:11 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Flex drag n drop, zoom issue Hi, I am having an issue with the application currently I am developing, the issue after dropping object to the canvas and if i try to zoom (in-out) the dropped objects seems to shifts its place. I have placed a demo URL, you can drag and drop objects to the plan, and try zooming the plan. Demo URL http://gireeshkumar.ind.in/designDemo/floorDesign2.html Please help me. Thanks Gireesh. -- Gireesh Kumar G http://gireeshkumar.ind.in/ -- Gireesh Kumar G http://gireeshkumar.ind.in/ -- Gireesh Kumar G http://gireeshkumar.ind.in/ -- Gireesh Kumar G http://gireeshkumar.ind.in/