Jump to content
GreenSock

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

Textfield problem when added first to the TM

Recommended Posts

Hello,

 

I have a bug in my application which is entirely flash based (not Flex)) that seems to come from TransformManager.

Let me explain:

 

I have a container on which I add a Textfield, a SimpleButton and an Image, in this order (that's important).

 

However when I loop over the list of my container to add those object with addItem(). The image is not there anymore but instead a TextField named "_tmProxy" is there. It has the same x, y, width, and height as my Textfield but has not text on it.

 

If I shuffle the order on which I add the objects, for example, Image, Textfield and SImpleButton this works fine. The problem appears ONLY when Textfield is the first element to be added to the transform manager. Even following Textfields added to the TransformManager do not have this problem.

 

Thanks for your help

PS: I am using

VERSION: 1.914 of TransformManager

VERSION: 1.91 of TransformItem

Link to comment
Share on other sites

There are several bugs in Flex and Flash that needed to be worked around by TransformManager. The _tmProxy is necessary for that purpose (long, boring story). When you add an object that uses a scaleMode of SCALE_WIDTH_AND_HEIGHT, a proxy is added (via addChild()) and its visible property is set to false. You'll never see it, but it's there. Please keep that in mind when writing your code. I wouldn't recommend simply looping through all the children and adding them all using addItem(). Instead, maybe put your objects into an Array before adding anything to TransformManager just so you have a clean list of what you want to be transformable. Or when you're looping through the children, you could simply exclude any that start with "_tmProxy" in their name. There are many ways to work around the proxy, but hopefully this gives you a few ideas that you can use.

 

Does that clear things up for you?

Link to comment
Share on other sites

I saved all items in an array and then added them using addItem

 

but it now throws an error when i click on items Error("Key class has yet been initialized.");

 

I do not understand this one

Link to comment
Share on other sites

It sounds like maybe you're trying to call methods & work with TransformManager (or FlexTransformManager) before the parent has even been added to the stage. Could you PM or e-mail me a sample Flex project that generates that error?

Link to comment
Share on other sites

I checked and everything I add to the TransformManager is added to the stage before, I am 200% sure.

 

However it seems the "innited" parameter stays to false (im not sure what it is doing)

 

in the the function initParent($parent:DisplayObjectContainer) shouldn't "

if(!_initted && _parent == null)

be

if (!_initted || _parent == null)

instead ?

It works much better for me like this

Link to comment
Share on other sites

No, if you look at the flow of things (initStage() is only called from within that condition inside initParent()), I don't think it should be ||. Are you adding the root as a TransformItem or something? Is there literally no parent? Again, it'd be super helpful if I could see a Flex project that I could publish/test and see the issue myself - I bet it'd save you a lot of time/hassle too. I'm sure we can get this figured out.

 

By the way, I'd definitely recommend using the latest version. Looks like you're using a stale one. Just log into your GreenSock account to get it: http://www.greensock.com/account/

Link to comment
Share on other sites

Sorry, this is quite a big project and is a bit hard to do a sample Project.

 

The problem disappeared. It was due to a bit of code that I commented out to debug. Sorry for that, thx for your time.

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.
×