I introduced the article in front of objectHandlers1.0 usage, read today, under 2.0, I found quite a big change, look at the use of 2.0 bar.
// The default initialization objectHandlers objectHandles=new ObjectHandles(this); // And then register the need to control components objectHandles.registerComponent(img, img);
The above is the default registration form, complete these two sentences, you can see the effect of
handles.push(new HandleDescription(HandleRoles.ROTATE, new Point(100, 50), new Point(20, 0))); objectHandles = new ObjectHandles( this , null, new ClassFactory(CircleHandle)); objectHandles.registerComponent(img1, img1, handles);
These are created by the factory objectHandlers, the drag effect of ♢ point, into the green o, registered components can be rotated through the handler, the default is to rotate, any scale, if, as above, only HandleRoles.ROTATE, the result is that the only In (100,50), (20,0), the two point rotation.
var decoratorManager:DecoratorManager = new DecoratorManager( objectHandles, drawingLayer ); decoratorManager.addDecorator( new AlignmentDecorator() );
Above code is to create a horizontal line and the adsorption effect automatically discounted, as shown above. AlignmentDecorator to its decorative device, there are several other decorative device, WebDecorator, OutlineDecorator, you can try. . .
Image rotation using <image> components, the following text box using <textArea>, I found that when rotated, the text box characters will disappear, to see the effect of two pictures above, I know, I have not find out how the story. . . .
Also objectHandlers2.0 support flex4. . . Will upload later flex4 use objectHandlers2.0 example. .
Attached the code. .