Jump to content

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

Additional properties on TransformItems

Recommended Posts

I need to add items to a transform manager with additional properties, and then later list all the itms in that transform manager, along with these properties. (Flex 4)


For example, I am adding something that has an image along with an associated name and price. Originally, I was adding an image, so I created a class extending Image:


protected function addNewItem(obj:Object):void {
var stageItem:AddedItem = new AddedItem();
stageItem.source = "images/full/"+obj.img;
stageItem.itemName = obj.name;
stageItem.itemPrice = obj.price;
stageItem.addEventListener(Event.COMPLETE, selectMe);
var centerLine:Number = workspace.width/2;
stageItem.x = centerLine - 100;
stageItem.y = 200;


Which works fine. However, I can't figure out how to list the objects on command. If I loop through the transform items, there is no such property as name:

private function listItems():void {
			for each ( var item:TransformItem in myManager.items ) {
				trace('item = '+item.name);


gives an error, no property of name. I'm guessing this is actually simple, but I'm missing something obvious. To reiterate, I am looking to get the results of listItems and build an XMLList of the properties.

Link to comment
Share on other sites

Sounds like you're just targeting the wrong object. Remember, every TransformItem has a targetObject with which it is associated. So you could do either of these:


function listItems():void {
   for each ( var item:TransformItem in myManager.items ) {
        trace('item = '+item.targetObject.name);



function listItems():void {
   for each ( var item:DisplayObject in myManager.targetObjects) {
        trace('item = '+item.name);

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.