Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Handycam

Lockscale on only certain items?

Recommended Posts

I have an app where some items can be resized and some cannot: A room with furniture. I want items that define the room, such as the walls and windows, to be resizable but not things like appliances, which have a fixed size.

 

I was hoping to do this with only one transform manager, since I need to save this as XML and wanted to avoid having to deal with 2 XML files (or is that the better way to go?)

 

So my handler which adds objects (AddedItem extends Image) to the TM instance is:

protected function addNewItem(obj:Object):void {
var stageItem:AddedItem = new AddedItem();
stageItem.source = "/wsbp/images/full/"+obj.img;
stageItem.itemName = obj.name;
stageItem.name = obj.name;
stageItem.addEventListener(Event.COMPLETE, selectMe);
stageItem.x = 50;
stageItem.y = 50;		
if (obj.sc =="n") {
	THESE ITEMS WOULD BE LOCKED
}		
ws.myManager.addItem(stageItem);
updateItemCount();
}

 

Of course, my Class doesn't understand lockScale, so I can't just set it in the IF statement.

 

How would you recommend managing this?

Link to comment
Share on other sites

Of course, my Class doesn't understand lockScale, so I can't just set it in the IF statement.

I'm confused - what do you mean your Class doesn't understand lockScale? You should be able to set that value on the associated TransformItem, like this:

 

var item:TransformItem = ws.myManager.addItem(stageItem);
item.lockScale = true;

 

Does that help?

Link to comment
Share on other sites

Yes, the "var item:TransformItem =" part was the key. I didn't think of that.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×