Reputation: 3
Why doesn't autocompletion work for function's local variables in included *.as files? For example:
Main.mxml:
<fx:Script>
<![CDATA[
include "code.as"; // or <fx:Script source="code.as"/>, doesn't matter
]]>
</fx:Script>
code.as:
import mx.controls.Button;
var foo:Button = new Button();
foo. <---- autocompletion is working here
function myFunc() {
var bar:Button = new Button();
bar. <----- doesn't work
}
Upvotes: 0
Views: 900
Reputation: 12387
Autocompletion will only work if a code class was imported, or if a class extended an .as class. Has to be a Class. When you use 'include code.as', code.as is not a class, its basically just a collection of variables, imports and functions, so autocomplete cannot access it like a class.
The code-behind pattern is similar to what your doing (seperating logic from the mxml), and allows for atuocompletion. To use it:
Code completion will work in your new custom MXML class for accessing public/protected variables and functions.
Upvotes: 3