Marc Hughes


Home
Blog
Twitter
LinkedIn
GitHub
about
I am a developer from a bit west of Boston.

Object Handles updated

30 Jul 2007

[ObjectHandles is a library to easily manage user movable and resizeable onscreen objects]

It's been a while, as I've been overly busy lately, but there is now a new ObjectHandles release.
This release fixed one bug with non-visible components, and added a new set of mouse cursors as the default. Since my last build, there's a been a bunch of submissions for new mouse cursors. I thank you all! In the near future I'll create a separate swc with them all embedded so developers can pick and choose. But for now I've embedded one of those new options into the library as the default. You can download the new release at

http://code.google.com/p/flex-object-handles/downloads/list

Now, you can also set your own mouse cursors, outside of the library. To do this, implement the OHMouseCursors interface, instantiate your class, and assign it to the ObjectHandles.mouseCursors property. A sample cursor class follows:

package your.package
{
public class YourMouseCursorClass implements OHMouseCursors
{
[Embed("../../../assets

/cursors/set1/resize- v.png")]
protected var sizeNS:Class;
[Embed("../../../assets/cursors/set2/move.png")]
protected var sizeAll:Class;
[Embed("../../../assets/cursors/set1/resize- l.png")]
protected var sizeNESW:Class;
[Embed("../../../assets/cursors/set1/resize-r.png")]
protected var sizeNWSE:Class;
[Embed("../../../assets/cursors/set1/resize- h.png")]
protected var sizeWE:Class;

protected var map:Object = new Object();

public function getCursor(name:String) : MouseCursorDetails
{
return map[name];
}

public function YourMouseCursorClass () : void
{
// Numbers are offsets to the hot-spot of the cursor (the point of the arrow, the middle of the resize bar, etc.)
map["SizeNS"] = new MouseCursorDetails(sizeNS, -5, -8 );
map["SizeAll"] = new MouseCursorDetails(sizeAll, -11, -13 );
map["SizeNWSE"] = new MouseCursorDetails(sizeNESW, -5, -6 );
map["SizeNESW"] = new MouseCursorDetails(sizeNWSE, -5, -6 );
map["SizeWE"] = new MouseCursorDetails(sizeWE, -9, -6 );
}
}
}

Then in your mxml...

<oh:objecthandles mousecursors="{new YourMouseCursorClass()}" allowrotate="false" x="10" y="90" width="307" height="30" minheight="30" minwidth="100">

If you have many ObjectHandles objects around, you can reuse the same cursor class to reduce memory usage.

The OH website, including a sample, is still at
http://www.rogue-development.com/objectHandles.xml

Enjoy!