PDA

View Full Version : Autocomplete broken in FlashDevelop?


rinogo
11-10-2009, 12:46 AM
Hey all!

I've used FD for my AS3 editing for some time, and have grown to love it. Recently, I started using it for Flex, and something weird is happening.

In AS3, I could type something like:
'disp'

at which point 'dispatchEvent' would appear in the auto-complete list, and I could just hit tab (or a non-alphanum char) to accept the suggestion.

However, while I'm coding in an mxml file (inside of <mx:script/> and cdata blocks), when I type 'disp', dispatchEvent is not in the auto-complete list. However, if I type it all out manually, everything compiles fine, so I know it's not an import/scope/namespace/whatever issue.

What gives?

bowljoman
11-10-2009, 05:34 PM
Type 'this.' first, and then it will bring up the options.

wvxvw
11-10-2009, 07:57 PM
FD and MXML arent best friends... There are lots of things that may be improved considering MXML autocompletion. But it's not only FD, it is in general better to write the AS code in AS files, and leave MXML for pure layout... MXML doesn't compile to the best code on Earth, so, the less you use it, the better potentially your project will be...

rinogo
11-10-2009, 08:37 PM
bowljoman: Unfortunately, that doesn't seem to work. :(

wvxvw: What is your preferred method of isolating your AS3 into a separate file? Do you just "include 'file.as'" it? I haven't seen this technique used widely, so I'm hesitant to accept that this is the best I can do. Surely, someone out there has solved this... Is FB (FlexBuilder) better at code hinting in MXML files?

thanks everyone!

box86rowh
11-10-2009, 10:36 PM
I usually do my as files seperate then just use a script tag with the source attribute pointed at the as file

wvxvw
11-11-2009, 06:40 PM
Yes, codehinting for MXML is better in Flex / Flash Builder then in Flashdevelop.
What I do is like so: if I need a huge block of script in MXML file, I would make an AS class file that extends the component I'm working with, write the code I need there and extend it with MXML component. Or, just try to replace MXML completely with AS. As I've said, the code generated from MXML may wish for the best...

rinogo
11-12-2009, 01:45 AM
wxvxw: That sounds like it might work. Is what you do similar to what elyon describes here?:
http://www.flashdevelop.org/community/viewtopic.php?p=15817#p15817

box86rowh: Does that fix the auto-complete problem, though? In my tests, the same problem exists (None of the methods/properties from the component's class are accessible via auto-complete)

rinogo
11-12-2009, 09:56 PM
wxvxw: I was a bit confused while trying to implement your advice, but after some research, I found some literature regarding the "Code Behind" best practice/pattern. I didn't realize that it was an established pattern and everything... Anyway, for others who hit this thread, more documentation on the (very nice) code behind pattern can be found at:

http://blog.vivisectingmedia.com/2008/04/the-flex-code-behind-pattern/
http://www.adobe.com/devnet/flex/quickstart/building_components_using_code_behind/
http://learn.adobe.com/wiki/display/Flex/Code+Behind

Happy flexing!