开发者

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
}


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜