Peter Riley
Peter Riley

Reputation: 3

Autocompletion in FlashDevelop doesn't work in included files

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

Answers (1)

Drenai
Drenai

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:

  1. Create an Actionscript class that extends an MXML control that you want to use e.g. HBox or UIComponent
  2. Put all of you logic within this Actionscript class.
  3. Then create an MXML class that extends the Actionscript class.

Code completion will work in your new custom MXML class for accessing public/protected variables and functions.

Upvotes: 3

Related Questions