Imports are organized after using content assist. To turn off this feature, go to preferences, Flash Builder > Editors > ActionScript Code and turn off "Keep imports organized".
Jason San Jose
Quality Engineer, Flash Builder
The idea behind "Organize imports" is that it should remove used imports only if it detects they aren't needed in your document anymore, either because they are duplicates, don't exist or are in the same package as your current context.
If this feature is removing imports that don't fit within those conditions, please file a bug and include a test file we can use to reproduce it on our side. The bugbase url is here: http://bugs.adobe.com/flex.
Okay, thank you. I understand it now. It seems to work correctly, if the programmer starts with the logic. However, ones that starts by importing classes may find it confusing why code completion changes would cause erasures. Maybe the organized import functions should not be invoked when the code completion changes involve import statements.
Heh, that's an interesting point. I think we're all so accustomed to having the imports added for us automatically (which will happen if you use code hints) that people don't think about adding them manually anymore. Have you tried just letting code hinting add the imporrts for you?
Yes. Thank you. I'm working with it right now. I'm used to writing .as with an generalized editor that has a working vocabulary list as code complete, that I'm trying to get used this .as customized way now.
I'm actually encountering behaviour where FB (build 235740 on OSX 10.5) keeps erasing my 'import flash.display.Sprite' statement, even though the class contains several properties of the Sprite class, and several methods which are looking for arguments of the Sprite class. Could this have something to do with the fact that I've configured FlashBuilder to use Flash CS4's library SWCs in addition to the Flex SDK?
I'll check in the bugbase & see if someone has already noted this behaviour.
nevermind... I doublechecked my project settings, added the FP10 playerglobal.swc to my library path & things work fine now.
False alarm. No bug submitted.
In my case, the imports that are erased are the ones related with classes with a "$" as a part of their names - for example: Locale$Language e Locale$Country. Every time I use the autocomplete function and it generates a new import automatically (of any other class), these kind of imports disappear.