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/ 

 

Reply via email to