Jump to content
Search Community

Problem with TextField and Flex 4

mianor test
Moderator Tag

Recommended Posts

Hi,

 

I have a problem using TransformManager and TextField with Flex 4. The text does not appear. The exact same code works fine when I compile using Flex 3.5

 

Here is the code, I also joined the Eclipse project:

<?xml version="1.0" encoding="utf-8"?>
xmlns:mx="http://www.adobe.com/2006/mxml" 
minWidth="955" minHeight="600"
creationComplete="init()">








 

Thanks for your help!

Link to comment
Share on other sites

Hmm, I don't think that code would work in Flex 3.5 either. You never added the TextField to the display list nor did you use FlexTransformManager. When you use FlexTransformManager, it will automatically addChild() for you when you addItem() if you forgot. FlexTransformManager extends Canvas, so it's a native Flex object. But your code is using a raw TransformManager which is great for straight Flash project. Unfortunately, Flex has a bunch of requirements that force you to do things in certain ways, so I think you'd be better off using a FlexTransformManager.

Link to comment
Share on other sites

The code works with Flex 3.5. If you look at the code, I added the TextField to the display list of managerContainer which is a UIComponent.

The problem with FlexTransformManager is actually that it extends a Canvas and not a UIComponent so that we can't directly add TextField. I know I could use TextInput or TextArea instead, but these Flex components are not easy to customize (font, size, color) when you add them dynamically with AS3 code.

Your Flex example is using "static" tags nested into FlexTransformManager. So how would you add new text items dynamically and customize it from the Flex version?

That's why I prefer using the AS3 version of TransformManager with a UIComponent. I tried to modify FlexTransformManager to use UIComponent instead of Canvas, but it still doesn't work

 

The real issue is TextField items are not displayed anymore when using Flex 4 and I have no idea why. I join my code again. Compile it with Flex 3.5 and Flex 4, you will see that the exact same code works with Flex 3.5 and not with Flex 4.

 

Thanks!

Link to comment
Share on other sites

Ah, sorry - I hadn't realized I commented out the addChild() line when testing your project :) This is definitely a problem with Flex and has nothing to do with TransformManager (the problem persists even if you remove all TransformManager code). I'd recommend posing the question to Adobe's Flex team. Unfortunately, I'm not much of a Flex guy. There are TONS of bugs in the Flex framework that I've run into and it gave me a really bad taste in my mouth, so I focused more on straight AS3/Flash stuff. Not saying Flex is evil or anything - I know that many developers absolutely love it.

 

(by the way, I deleted your zip from your post after downloading it because it included all the TransformManager code which basically gives everyone on the web full access to the $299 product for free)

Link to comment
Share on other sites

Oh you are right :o

This is a new feature of Flex 4 :twisted:

 

For those who get the same issue, this code makes it work:

 

<?xml version="1.0" encoding="utf-8"?>
xmlns:mx="http://www.adobe.com/2006/mxml" 
minWidth="955" minHeight="600">










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