Firstly, I know I’ve been very quiet recently, that’s because a lot has happened recently - which I’ll go into in more detail at another time. The upshot of these changes is I’m now working with Flex quite heavily (YAY!), hence the Flex Tip post.
So what do I mean about being careful with your names, well today I had the following:
<testHelper:FunctionalTestHelper id="testHelper" testSteps="{testSteps}" />
Which seems reasonable enough, however the compiler hated it, throwing me a 1202 error of "Access of undefined property testSteps in package testHelper.".
This seemed odd, the testSteps
property definitely was defined, although I triple checked and recompiled, I tried new properties which all did the same thing. The one thing I did find that worked was the following:
<testHelper:FunctionalTestHelper id="testHelper" testSteps="new Array();" />
This makes no sense, the compiler was telling me earlier that testSteps
was not a property now it’s happy, I tried playing around with my binded variable testSteps
and declaring new variables (bindable and non-bindable) all to no avail.
I was at a loss, then I noticed that the id
of the instance I’d created (testHelper
) was the same as the package name that component lived in. Once I changed that everything compiled as expected.
This isn’t the first time I’ve come across strangeness with naming in Flex, I suppose it makes some sense (although I’m not clear on why it only crapped out when using a bindable variable for one of the properties.
All-in-all I lost about 30 minutes to this issue so I thought it would be wise to share this to hopefully save others from the same issue.