My favorites | Sign in
Project Logo
                
Search
for
Updated Apr 08, 2009 by marc.hughes
Labels: Featured
ObjectHandlesUsage  
Here are some projects that use ObjectHandles, feel free to send in more.

Introduction

Here are some projects that use ObjectHandles, feel free to send in more.

Projects

  • A Digital Book - Much of the interface of A Digital Book utilizes Object Handles.

Here's a video of an example using ObjectHandles in some non-standard ways. It's:

  1. Has a moving / resizing event handler to show a custom tooltip
  2. Has custom resize handle images that look like grey horizontal bars
  3. Only allows vertical resizing.
  4. On a MOVED event, the objects have an animation that snaps them to a grid


Comment by jay.machine, Feb 17, 2008

good~

Comment by zhengyub, Jul 15, 2008

thanks,very usefull for me!

Comment by shekhargood, Jul 22, 2008

thanks and it is very use full. and i need one help on this that while adding a text area in the object handle control i am not able to write in that textarea can i access that with objecthandle resize and move.

Comment by gabriela...@hotmail.com, Sep 01, 2008

Hi. Ill be using ObjectHandles? on an educational software (educational object editor). It is going to very usefull, thanx a lot!

Comment by inshua, Oct 04, 2008

great!

Comment by inshua, Oct 04, 2008
Comment by shekhargood, Jul 22, 2008

thanks and it is very use full. and i need one help on this that while adding a text area in the object handle control i am not able to write in that textarea can i access that with objecthandle resize and move.


i meet the same probleam.

Comment by kanukukreja, Oct 13, 2008

<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()" >

<mx:Script>

<![CDATA[
//import mx.controls.Image;
import flash.text.TextField?;

import com.roguedevelopment.objecthandles.; Embed(source='assets/rotate.png')?
Bindable?
public var rotateHandle:Class;
private function init() : void
{
var oh:ObjectHandles? = new ObjectHandles?(); oh.height = 50; oh.width = 50; / var image:Image = new Image();
image.source = "assets/Texture_Slices?.png"; image.percentHeight = 100; image.percentWidth = 100; image.maintainAspectRatio = true;
oh.addChild(image);
var squareSize:uint = 50; var square:Shape = new Shape();
square.graphics.beginFill(0xFF0000, 0.5); square.graphics.drawRect(0, 0, squareSize, squareSize); square.graphics.beginFill(0x00FF00, 0.5); square.graphics.drawRect(200, 0, squareSize, squareSize); square.graphics.beginFill(0x0000FF, 0.5); square.graphics.drawRect(400, 0, squareSize, squareSize); square.graphics.endFill();
oh.addChild(square); /
var tf:TextField? = new TextField?();
tf.text = "Hello Hello";
oh.addChild(tf);
oh.allowRotate = true;
this.addChild(oh); // replace genericExamples with a canvas in your application
}
]]>
</mx:Script>

</mx:Application>

I tried with text, images and shapes, but its working fine only with images for rest its throwing error.

Comment by cshreffler, Nov 12, 2008

I have a need to scale a text control within the component so that the text dynamically scales as the user drags the boundaries of the ObjectHandle? component. Does anyone have an example of how to do this?

Comment by RyanSun81, Dec 22, 2008

to kanukukreja You can try Lable instead of TextField? and it works. The only problem is that it's only resizing the oh container itself, not the text .... :(

Comment by iacob.campia, Jan 23, 2009

i need the exact same thing cshreffler needs. how can i do that with a text ?

Comment by iacob.campia, Jan 23, 2009

i found the way to do that:

<Script>

var originalWidth : int, originalHeight : int;

function init() : void
{
    // save original width and height which match scale 1
    originalWidth = this.hnd.width;
    originalHeight = this.hnd.height;
}

function onResize(event : ObjectHandleEvent) : void 
{
   // rescale width and height based on the new size
   this.label.scaleX = (this.hnd.width * 100 / this.originalWidth) / 100;
   this.label.scaleY = (this.hnd.height * 100 / this.originalHeight) / 100;
}

</Script>

<ObjectHandles id="hnd" objectResizingEvent="onResize(event)" ....
   <Label id="label" text="asdasd" .....
</ObjectHandles>
Comment by ja...@wilkesdesign.com, Feb 22, 2009

Fixed aspect ratio bug fixed

Hi and thanks for this great component.

I've made a quick mod the ObjectHandles?.as file to correct the behaivour of the left hand handles when fixed aspect ratio is sellected.

			if( (wasResized && alwaysMaintainAspectRatio ) ||
				(wasResized && ( isCorner && cornerMaintainAspectRatio) ) )
			{	
				desiredSize.x = aspectRatio * desiredSize.y;
				if (isResizingLeft && isResizingUp)
				{
					desiredPos.x = originalPosition.x + (originalSize.x - desiredSize.x);
					desiredPos.y = originalPosition.y + (originalSize.y - desiredSize.y);
				}
				if (isResizingLeft && isResizingDown)
					desiredPos.x = originalPosition.x + (originalSize.x - desiredSize.x);
						
			}

Hope this help

Cheers James

Comment by pwhite20, May 31, 2009

First of all...Great Component!

I'm trying to use the "alwaysMaintainAspectRatio" attribute, but get different results based upon when it is enabled in the tag. For example:

1) If I initialize the tag with alwaysMaintainAspectRatio="true" and allowRotate="true", only the four corner handles show up and I don't get a rotate handle to rotate my text.

<oh:ObjectHandles 
    id="oh1"
    resizeHandleImage="{resize_handle}" 
    rotateHandleImage="{rotate_handle}" 
    allowRotate="true" 
    alwaysMaintainAspectRatio="true" 
    objectResizingEvent="onResize(event)" > 

    <mx:Text id="txt1" text="Graphical Handles" /> 

</oh:ObjectHandles>

2) Now, if I initiate the tag this time with alwaysMaintainAspectRation="false" and allowRotatate="true", I will now get all eight resizing handles and my rotation handle. I can then perform some sort of action (like a button click) to reset alwaysMaintainAspectRation="true", and all eight of my resizing handles will remain, as well as my rotation handle.

<mx:Button label="Maintain Aspect Ratio" click="oh1.alwaysMaintainAspectRatio=true" x="10" y="100"/>

<oh:ObjectHandles 
    id="oh1"
    resizeHandleImage="{resize_handle}" 
    rotateHandleImage="{rotate_handle}" 
    allowRotate="true" 
    alwaysMaintainAspectRatio="false" 
    objectResizingEvent="onResize(event)" > 

    <mx:Text id="txt1" text="Graphical Handles" /> 

</oh:ObjectHandles>

It seems to display in two different ways depending on how it is initialized. What I would like to do is initialize it with alwaysMaintainAspectRatio="true", but still keep all eight drag handles and the rotation button so the user can taggle the alwaysMaintainAspectRation on and off. Does anybody have any ideas how I might be able to accomplish this?

Comment by ramasamy.elango, Oct 08, 2009

TOP RIGHT handle is not working properly after using rotation, if u have any solution for that please share with me.

Comment by raju.amutha, Oct 22, 2009

hi i want to resize image with equal height and width of original image size... can i do it in object handler.. anyone help me....

Comment by wgumaru, Oct 22, 2009

Hi,

I added a canvas inside OH. Within the Canvas I added TextInput? control and labels...I am able to move and resize the Canvas and all the children control within the canvas moves with the Canvas. How can I move and resize the controls that is within the Canvas...

The canvas always gets the mouse event...

<oh:ObjectHandles?

id="oh1" <mx:Canvas id="screen1">
<oh:ObjectHandles?
<mx:TextInput? id="txt1" text="Child Control"/>
</oh:ObjectHandles?> <oh:ObjectHandles?
<mx:TextInput? id="txt2" text="Child Control"/>
</oh:ObjectHandles?>
</mx:Canvas>
</oh:ObjectHandles?>

Comment by raju.amutha, Oct 23, 2009

i hope this sample help you...try this ...

<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:oh="com.roguedevelopment.objecthandles." creationComplete="init()" xmlns:popupbar="com.roguedevelopment.popupbar." xmlns:sample="com.roguedevelopment.objecthandles.sample.">

<mx:Script>
<![CDATA[
import mx.controls.Image; import com.roguedevelopment.objecthandles.ObjectHandleEvent?; import com.roguedevelopment.objecthandles.ObjectHandlesMouseCursors?;
[Embed(source="resize_handle.png")] protected var resize_handle:Class; [Embed(source="rotate_handle.png")] protected var rotate_handle:Class;
protected function init() : void {
var oh:ObjectHandles? = new ObjectHandles?(); oh.height = 50; oh.width = 50; oh.resizeHandleImage = resize_handle;
var image:Image = new Image(); image.source = "snowflake.png"; oh.addChild(image); oh.allowRotate = false; image.percentHeight = 100; image.percentWidth = 100; image.maintainAspectRatio = false;
genericExamples.addChild(oh);
}
]]>
</mx:Script>

<mx:LinkBar? dataProvider="{exampleStack}" width="100%" backgroundColor="#FFFFFF"/>
<mx:ViewStack? id="exampleStack" width="100%" height="100%" creationPolicy="all" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:Canvas horizontalScrollPolicy="off" verticalScrollPolicy="off">
<oh:ObjectHandles? horizontalScrollPolicy="off" verticalScrollPolicy="off" id="oh11" resizeHandleImage="{resize_handle}" rotateHandleImage="{rotate_handle}" allowRotate="true" x="10" y="20" width="307" height="130" minHeight="30" minWidth="200" >
<mx:Button label="Graphical Handles" width="100%" height="100%" />
</oh:ObjectHandles?>
</mx:Canvas>

<mx:Canvas id="genericExamples" label="Generic" backgroundColor="0xffffff" backgroundAlpha="1" width="100%" height="100%" >
<oh:FixedRatioObjectHandles? mouseCursors="{new ObjectHandlesMouseCursors?()}" cornerMaintainAspectRatio="true" allowRotate="true" alwaysMaintainAspectRatio="false" x="226" y="161" width="125" height="50" minHeight="30" minWidth="130" >
<mx:Image source="image/shofa.jpg" width="100%" height="100%" x="10"/>
</oh:FixedRatioObjectHandles?>
</mx:Canvas>
<mx:Canvas label="Horizontal" width="100%" height="100%" backgroundColor="0xffffff" backgroundAlpha="1" >
<mx:TextArea? editable="false" borderStyle="none" width="300" height="300" text="The top component has a horizontal movement constraint, and the bottom one has a horizontal resizing constraint." /> <oh:ObjectHandles? allowRotate="false" x="10" y="30" width="307" height="30" minHeight="30" minWidth="250" allowHMove="false">
<mx:Button label="Movement Constraint" width="100%" height="100%" />
</oh:ObjectHandles?> <oh:ObjectHandles? allowRotate="false" x="10" y="80" width="307" height="30" minHeight="30" minWidth="250" allowHResize="false">
<mx:Button label="Sizing Constraint" width="100%" height="100%" />
</oh:ObjectHandles?>
</mx:Canvas>
<mx:Canvas label="Vertical" width="100%" height="100%" backgroundColor="0xffffff" backgroundAlpha="1" >
<mx:TextArea? editable="false" borderStyle="none" width="300" height="300" text="The top component has a vertical movement constraint, and the bottom one has a vertical resizing constraint." /> <oh:ObjectHandles? allowRotate="false" x="10" y="30" width="307" height="30" minHeight="30" minWidth="250" allowVMove="false">
<mx:Button label="Movement Constraint" width="100%" height="100%" />
</oh:ObjectHandles?> <oh:ObjectHandles? allowRotate="false" x="10" y="80" width="307" height="30" minHeight="30" minWidth="250" allowVResize="false">
<mx:Button label="Sizing Constraint" width="100%" height="100%" />
</oh:ObjectHandles?>
</mx:Canvas>
<mx:Canvas label="Sizing" width="100%" height="100%" backgroundColor="0xffffff" backgroundAlpha="1">
<mx:TextArea? editable="false" borderStyle="none" width="300" height="300" text="These can be moved, but not resized" /> <oh:ObjectHandles? allowRotate="false" x="10" y="30" width="307" height="30" minHeight="30" minWidth="250" allowHResize="false" allowVResize="false">
<mx:Button label="Move me!" width="100%" height="100%" />
</oh:ObjectHandles?> <oh:ObjectHandles? allowRotate="false" x="10" y="80" width="307" height="30" minHeight="30" minWidth="250" allowHResize="false" allowVResize="false">
<mx:Button label="Move me!" width="100%" height="100%" />
</oh:ObjectHandles?>
</mx:Canvas>
<mx:Canvas label="Anchor" width="100%" height="100%" backgroundColor="0xffffff" backgroundAlpha="1" >
<mx:TextArea? editable="false" borderStyle="none" width="300" height="300" text="An anchor causes the component to always cross a coordinate. There are lines drawn below to show the anchors, but no visual que is neccessary." />

<mx:VRule x="300" height="400" y="65"/> <mx:HRule x="300" width="400" y="65" />

<oh:ObjectHandles? allowRotate="false" x="133" y="229" width="250" height="30" minHeight="30" minWidth="250" xAnchor="300">
<mx:Button label="Horizontal Anchor" width="100%" height="100%" />
</oh:ObjectHandles?>
<oh:ObjectHandles? allowRotate="false" x="417" y="60" width="307" height="30" minHeight="30" minWidth="250" yAnchor="65">
<mx:Button label="Vertical Anchor" width="100%" height="100%" />
</oh:ObjectHandles?>
<oh:ObjectHandles? allowRotate="false" x="130" y="60" width="250" height="60" minHeight="30" minWidth="250" yAnchor="65" xAnchor="300">
<mx:Button label="Both Anchors" width="100%" height="100%" />
</oh:ObjectHandles?>
</mx:Canvas>
<mx:Canvas label="Rotating" width="100%" height="100%" backgroundColor="0xffffff" backgroundAlpha="1" >
<mx:TextArea? editable="false" borderStyle="none" width="300" height="300" text="Rotation and resizing is not 100% yet, but you can see some of it here. Note that text doesn't appear once an object is rotated unless you embed the font, this is a general Flex limitation." /> <oh:ObjectHandles? x="10" y="30" width="307" height="30" minHeight="30" minWidth="250" allowVResize="false" allowRotate="true" >
<mx:Button label="Rotate, no resize" width="100%" height="100%" />
</oh:ObjectHandles?> <oh:ObjectHandles? x="10" y="80" width="307" height="30" minHeight="30" minWidth="250" >
<mx:Button label="Rotate with resize" width="100%" height="100%" />
</oh:ObjectHandles?>
</mx:Canvas>

</mx:ViewStack?> <mx:Script>
<![CDATA[
import com.roguedevelopment.objecthandles.SelectionManager?;
]]>
</mx:Script>

</mx:Application>


Sign in to add a comment
Hosted by Google Code