简体   繁体   中英

ActionScript 3 code folding/regions

Is there any way to create foldable regions of code in ActionScript 3 (read this as Adobe Flash CS3 built-in editor). I'm looking for something like in MS Visual studio so that I can do:

#region "Event handlers"

... big list with methods here

#end region

Any ideas?

In the Flash IDE, select the code to fold and right click . A menu will appear with the following options: Collapse Between Braces | Collapse Selection | Collapse Outside Selection | Expand Selection | Expand All .

With that said, you should seriously consider a 3rd party ActionScript development environment, such as FlashDevelop , a very well thought out alternative. It's a massive pain developing in the Flash IDE.

http://www.flashdevelop.org/community/viewtopic.php?t=202

In the Flash CS5 IDE, select the code to fold and right click . A menu will appear with the following options: Collapse Between Braces | Collapse Selection | Collapse Outside Selection | Expand Selection | Expand All .

In Flash CS3, there was not really anything like that. CS4 introduced conditional compiling , not really what you are looking for; but it does not get any closer.

Like already suggested, I would suggest using FlashDevelop . It has some folding options, but event more importently it has intellisense and automatic code generations. And it is free.

Flash CS4 has a code folding feature. Just select/highlight a few lines of code and click the - icon on the left.

Flash CS3 calls it "Code Collapse".

On the editor toolbar:

Flash CS3 toolbar in editing mode http://img19.imageshack.us/img19/4558/picture23s.png

The buttons with facing arrows will collapse code between braces or the current selection. The button with arrows going out will expand code.

You can also find the commands in Edit->Code Collapse, which shows the keyboard shortcuts. Or you can right-click on the code you wish to collapse to get a menu of various actions, among them, collapse options.

If you are using FlashDevelop it has a terrific solution. You can create regions to conclude your code like this:

[-]  //{ start region
          your code here...
     //} end region

and expand like methods
[+]  //{ region Public methods

sth. like #region would in CS5 be:

//Controlls
{
      public var IWaffe:MovieClip;
      public var IWaffeD:MovieClip;
      public var ICursor:MovieClip;
      public var IFeuer:MovieClip;
}

and then you can use the collapse brackets button.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM