Resolve error when migrating a FlashBuilder project to FDT
I'm migrating a FlashBuilder project (actually a project I'm working on with FlexBuilder eclipse plugin on Linux) to use FDT. I managed to import the project, and make it aware of other projects it depends on.
However I get lots of compile errors for things that seem harmless (and used to compile). At least, for example :
<mx:SomeClass initialize="{this.init()}" ... >
<mx:Script>
<![CDATA[
....
public function init() : void {
// ... whatever
}
public function foo(event : Event) : void {
// .. whatever
}
]]>
</mx:Script>
<mx:SomeOtherComponent click="{this.foo(event)}"/>
... etc ....
So, I get "unresolved function" for all the calls of the form someAttribute="{this.someFunction()}", even though the function is described in the same block file.
Is it that I've been abusing AS3 / FlashBuilder for all this time ?
Also, generic components have problem. Assume I have a class with a deferred 'content' attribute, and I want to instanciate this class and "fill the blank" :
I define a custom component in a CustomComponent.mxml file, with a deferred content
<mx:VBox>
<mx:Script>
<![CDATA[
public var content : IDeferredInstance;
public function buildMe() : void {
this.addChild(content.getInstance() as UIComponent);
}
I extend the custom component in another xml file, putting something as the content (namespace is just the name of the namespace that contains the CustomComponent file)
<namespace:CustomComponent xmln:namespace="..." >
<namespace:content >
<!-- Whatever ... -->
</namespace:content >
</namespace:SomeClassWithDeferredInstance >
Then again, I get an "Can't resolve 'content'" error in the second file (at the line that reads namespace:content).
Things 开发者_如何学编程to mention :
- I'm using FDT 4.0, under Linux, with a (valid) eval key
- I'm using a custom Flex 3.5 SDK (not one shipped with FDT, but not a too strange one either)
Hoping anyone can help ...
Thanks
PH
If it compiles correctly, and without any compiler warnings, then it's a bug in the parser and not in your code. Please file it in JIRA: http://bugs.powerflasher.com/jira/browse/FDT
For me, this bit of code does not have any error flags - I even get quick assists to help me generate code.
Your FDT version might be incorrect as well. You're using 4.0 and that is quite old (about a year). Since then many features have been added and bugs fixed. See the release notes for more.
http://fdt.powerflasher.com/docs/FDT_4_Release_Notes
I suggest upgrading to FDT 4.5.X
<s:ApplicationminWidth="955" minHeight="600" initialize="{this.init();}">
<fx:Script>
<![CDATA[
private function init() : void {}
private function foo(event : MouseEvent) : void {}
]]>
</fx:Script>
<s:Button click="this.foo(event);"/>
</s:Application>
精彩评论