kingyiren / flex-object-handles

Automatically exported from code.google.com/p/flex-object-handles
0 stars 0 forks source link

How can i restruct object handle in canvas ? #31

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.I have to restrict Object handle in canvas container.
2.after applying restiction it should work well on resizing and move etc.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.
Please give any idea or sample of code to restrict object handle in canvas
container.

I was restricted Object Handle. It restricted around the bounds but when i
resize the OH and size exceed the canvas container boundaries it not
working fine. It giving ugly output.
Please provide some tips or code realted it.

Original issue reported on code.google.com by naresh....@gmail.com on 22 Dec 2009 at 4:14

GoogleCodeExporter commented 8 years ago
Hai Naresh ...!!! Try This one
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" 
minWidth="955" minHeight="600" 
xmlns:objecthandles="com.roguedevelopment.objecthandles.*">
    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import mx.events.MoveEvent;
            protected function objecthandles1_moveHandler(event:Event):void
            {    
                can.x
                var canvasW:Number=can.width;
                var canvasH:Number=can.height;
                if(obj.x+obj.width>canvasW)
                {
                    obj.x=canvasW-obj.width;
                }
                if(obj.x<0)
                {
                    obj.x=0;
                }
                if(obj.y+obj.height>canvasH)
                {
                    obj.y=canvasH-obj.height;
                }
                if(obj.y<0)
                {
                    obj.y=0;
                }    
            }

            protected function obj_clickHandler(event:MouseEvent):void
            {
                obj.select()
            }

        ]]>
    </mx:Script>

    <mx:Canvas id="can" x="50" y="50" width="600" height="500" borderStyle="solid" toolTip="{can.x,can.y}" horizontalScrollPolicy="off" verticalScrollPolicy="off">

        <objecthandles:ObjectHandles id="obj" height="100" width="100" move="objecthandles1_moveHandler(event)"  

                                     click="obj_clickHandler(event)"  toolTip="{obj.x,obj.y}" >
            <mx:Image source="Desktopb.jpg" maintainAspectRatio="false" height="100%" width="100%">

            </mx:Image>
        </objecthandles:ObjectHandles>
    </mx:Canvas>
</mx:Application>

Original comment by b.vijayv...@gmail.com on 13 Jul 2011 at 2:26