Jump to content
Search Community

TransformManager not transforming correct item

TheCosmonaut test
Moderator Tag

Recommended Posts

I've coded myself into a corner again and could use some help. Take a look at this code:

 

			var myIntro:Intro = new Intro();
		//-- add image
		var myIntroBitmap:ContentDisplay = _myContentLoader.getContent("introImage");
		myIntro.myBitmapHolder.addChild(myIntroBitmap);
		var introManager = new TransformManager({targetObjects:[myIntro.myBitmapHolder]});
		var myIntroXML:XML = new XML(_myXML.intro.imageXML.item.toXMLString());
		introManager.applyItemXML(myIntroXML);

 

Line by line, here's a breakdown of what I'm doing:

1. I create a new instance of my custom class Intro, which is basically a movie clip container.

2. I create a variable myIntroBitmap which is a ContentDisplay

3. I add the ContentDisplay object to a "holder' movie clip inside the Intro.

4. I create a new TransformManager in order to transform the "holder" movie clip

5. I properly format the item XML which I'm receiving from my database

6. I apply the item XML to the transform manager I created

 

The goal is to load an image and then transform it according to the information in the XML. However, this isn't happening -- instead, the bitmap image stays in the upper left corner and a gray box appears which has the proper positioning and dimensions of the transform manager. (see attached) So basically it appears that the transform manager is getting added, and the item XML is getting applied, but neither are manipulating the image itself.

 

Any pointers on what I'm doing wrong? I've tried using the raw content, the main ContentDisplay itself, its parent, and more. I've tried adding the transform manager AFTER I add the Intro to the stage. No matter what I try, I end up with that gray box :(

Link to comment
Share on other sites

Make sure you set the object's name properly - when you applyItemXML(), TransformManager will look for a DisplayObject whose name matches the one recorded in the XML and it will apply all the transformations to that object. If it doesn't find one with a matching name, it will create a gray box like the one you saw which is actually kinda helpful because you can swap your object in there whenever you want, using its transform.matrix. You don't need to do that here - I'm just mentioning it so you understand the gray box thing :) It sounds to me like you just didn't name your object properly. Once you do, things should sync up great.

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.
×
×
  • Create New...