Royce
unread,Oct 5, 2011, 10:32:54 PM10/5/11Sign in to reply to author
Sign in to forward
Sign in to report message as abuse
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Flex ObjectHandles
I'm using OH2 and having a problem with move constraints and
negatively sized objects (ie. negative width and/or height). Here's my
constraint code:
var moveConstraint:MovementConstraint=new MovementConstraint();
moveConstraint.minX=0;
moveConstraint.minY=0;
moveConstraint.maxX=maskLayer.width;
moveConstraint.maxY=maskLayer.height;
// We must bind the maxX and maxY to the maskLayer dimensions in case
it is resized, we
// need the constraint to be updated.
BindingUtils.bindProperty(moveConstraint,"maxX",maskLayer,"width");
BindingUtils.bindProperty(moveConstraint,"maxY",maskLayer,"height");
objectHandles.addDefaultConstraint(moveConstraint);
objectHandles.addMultiSelectConstraint(moveConstraint);
I want to stop objects from being moved or resized outside their
parent canvas (maskLayer). This code works beautifully for objects
that were created by dragging down/right (ie. have positive width/
height). But if you drag up/left when creating a new object, the
constraint no longer applies and you can move/size the object outside
of maskLayer.
Is there an easy fix/workaround? I'm thinking of not using constraints
at all and doing my own constraints in the PropertyChangeEvent handler
of my display component.