views:

64

answers:

2

Is it possible to ask FlexBuilder to automatically fill out the types of a statement?

For example:

var g = this.graphics;

Will throw a a "no type declaration" warning that Eclipse's magic "fix this line please" won't fix... So is there any other way to fix that, other than manually entering the "g:Graphics" by hand?

+1  A: 

At least up to and including FlexBuilder 3, alas, you'll have to declare the type if you want to comply with the compiler's strict-typing rules, and I don't know of an existing "infer this variable's type" feature in there anywhere, either.

I'm sure that's by design, though -- those who want the benefits of strict typing will get them by declaring explicitly, whereas those who might prefer to change what "g" refers to at runtime can appreciate being able to switch off compiler warnings (Project > Properties > Flex Compiler) and do so.

Wish I had a better answer for ya! Perhaps someone else knows of something and can chime in with a more satisfying solution. :)

If it's just the extra characters that bug you, you might try using the Eclipse/FlexBuilder shortcuts (e.g., Ctrl+Space for type auto-completion) -- there's a great list of them here.

Christian Nunciato
Ah, thanks for the list of shortcuts.
David Wolever
+1  A: 

There's a plug in to write code snippets on the fly for eclipse, maybe you can create something that solves your problem:

More here:

calderas