介绍Flash Builder 4工作流程(上)

原文地址:http://www.insideria.com/2010/03/intro-to-flash-builder-4-workf.html 

译者:巴巴鲁(请转载时注明和改编时出处,谢谢)PDF下载

Flash Builder 4 Flex Builder 3的继承者。在ADOBE的这次大胆的举措中,他们最终更名了IDE(Integrated Development Environment集成开发环境),这样做可以强化Flash封装Flex AS3开发的概念。这是一个对于那些只使用AS3Flash开发者门的痛处。这将Flash Builder放置在所有使用ActionScript 3 开发集成环境的最佳定位。Flash Builder引入了许多新的特点,我们更好结合Flash IDE,单元测试,明确项目结构,以及一些可喜的速度提升。随着像Source Mate添加了重构和代码生成插件,Flash Builder是一个做大型Flex开发的人们的首选。

这篇文章将介绍Flash Builder 4的工作流程。我不会深入的讲解Flex  AS3 的项目流程,但会聚焦于IDE本身,怎样去配置它,同时着重介绍一些新的特性。这将会是一个在InsideRIA 上聚焦工作流程系列的开始。让我们开始它。

安装Flash Builder 4

Flash Builder 被构建在开源Eclipse 平台之上。Flash Builder 实际上是一个插件,它自身融入到Eclipse IDE中。正是因为这样,有两种安装方式供您选择:标准版以及插件版。

标准版使用一个自定义的Eclipse 同时被设计为一个完整的套件。不幸的是标准版剥夺了Eclipse Java工具以及ANT 支持。你可以手动安装这些插件或者选择下载Flash Builder插件版本。

standalone_install

Eclipse Plug-in 安装程序来源于一个预绑定版本的Eclipse(该版本包含完整的Java工具)或者允许你添加插件到现存版本的Eclipse。首先这可能对一些刚刚开始的人们很难接受,如果你对Eclipse和如何操作插件感觉到不舒服,你可能插入到标准版本。如果你选择这样做,我建议安装插件到最新的Eclipse。版本需要高于3.4

plugin_install

在文章中我们将要使用标准版。让我们从这里下载并且安装在您的计算机中。在你支付和购买之前,你将会拥有60天的试用期。

fb_welcome_screen

了解工作空间

Flash Builder 正像早前我所提到的,它是基于Eclipse IDE的。Eclipse是一个非常著名的开源 Java IDE,其自身拥有配置和工作流范例。工作空间是一个主目录,用于Flash Builder 存储关键项目数据例如设置和一些你自定义编辑的内容,以及一些运行所需要的关键数据。

每一个工作空间是自己包含开发范围。这保证你备份工作空间已经移动它到不用的计算机时,原有的设置不被改变。当移动工作空间从一台计算机到另一台时,Flash Builder有时将保持绝对路径,这样你不得不重新配置你项目中对资源的引用。当使用版本控制时,这需要非常重要考虑的一点,你可能会检测到一些项目中的具体文件的路径在你本地计算机或者是资料中,而这些路径其它开发者并没有。这将我避免检查在任何.project内容。

这是Flash Builder设置的默认工作空间目录的截图,

default_workspace

Mac/Unix上,我避免在目录名字当中有空格。同时,我通常为及格不同客户和私人项目工作,这样我希望能够将他们分开。为了工作的更为高校,我使用西面的要求来组织我的工作空间:

  1. 我创建文件夹在我的文档目录中,命名为Workspaces
  2. 一旦我使用多个IDEs (FDT, Flash Builder, IntelliJ 甚至 Flash IDE)我为他们每一个创建文件夹。在这种情况下我有一个Flash Builder 文件夹.
  3. 每个我工作的客户和个人项目将要因为我的工作空间而改变。因此为了这篇我创建一个名为FBWorkflowWorkspace。如果我工作在我的F*CSS 库我将要创建一个新的工作空间在my Documents/Workspaces/FlashBuilder 文件中.

这时一个我为这篇文章设置的最终路径:

custom_workspace_path

Full Path: ~/Documents/Workspaces/FlashBuilder/FBWorkflowWorkspace

通过点击File -> Switch Workspace,你可以在任意时刻切换工作空间。这是一个重要的提示,你一次只能打开一个工作空间.

定制设置

Eclipse  Flash Builder 有很多的方式设置以充分涵盖在此介绍但这里是少数关键之一我总是做了修改后的干净安装.

增加更多的内存分配

在你做任何事情之前,你可以添加更多的内存给Flash Builder:

  1. 确保你已经退出了Flash Builder.
  2. 打开.ini文件。在 Mac上该文件在Flash Builder 4.app -> MacOS -> Adobe Flash Builder 4.ini.PC上该文件在C:Program FilesAdobeAdobe Flash Builder 4FlashBuilder.ini.
  3. 找到"-Xmx512m",那是最大内存使用量,并且改变它。我通常使用1024 内存或者更依赖我在工作的项目中的表现.
  4. 重启 Flash Builder.

捷径

MACFlash Builder 设置可以被找到在Eclipse -> Preferences.

这是参数设置菜单:

preferences

首先,让我们进入General然后进入Keys菜单.

keys.jpg


我用已经设置一些快捷键和默认的一些快捷键在Flash Builder上工作。你可以快速跳到快捷方程式通过使用搜索框过滤文本.

Command Description Key
Debug Last Launched I use this to debug my applications. Since I grew accustomed to Flash’s Command + Return to run a Movie, I tend to map this function to that key set up. This allows you to debug the last program you have launched (I will explain Runs and Compiling a little later). This function I map to Command + Return since it is not set up to that by default. Command Return
Run Last Launched *Optional* If you don’t want to use the Debug Player when you compile your Flash app, you can use this as your default build launcher. It will launch your project in a default browser without any debug code and will ignore any breakpoints. You should not map “Debug Last Launched” and “Run Last Launched” to the same key. When using both, I tend to map Run Last Launched to Shift + Command + Return Shift + Command + Return*
Delete Line To Delete an entire line of code simply press Command + D. Command + D
Find and Replace This is a standard Find and Replace in a document. Command + F
Find in File This is a powerful Find and Replace type function that lets you search across multiple files. Shift + Command + F
Line End Jumps to the end of the line. Command + Right Arrow
Line Start Jumps to the beginning of a line. Command + D
Move Lines Up Take a selection of lines and move them up. This is useful when organizing code or changing the order of actions in a given method. Command + Up Arrow
Move Lines Down Take a selection of lines and move them down. Command + Down Arrow
Next Perspective Perspectives represent different types of Editors or areas of functionality in Flex Builder. Imagine going from the ActionScript editor to the debugger to the SVN repository explorer. Each of these is a different type of perspective and have their own collection of relevant windows. I tend to think of this a an application switcher inside of Eclipse. I use this a lot and felt it was better to change the default keys to something easier to call. Shift + Command + Right Arrow.
Previous Perspective See Next Perspective description above. I change the default keys to the following. Shift + Command + Left Arrow.
Organize Imports I had mentioned before that Flex Builder will help you keep track of Imports. Well this is the short cut to do it. Flex Builder will automatically remove any packages that are not needed and reorder used imports based on their priority and source package. Shift + Command + O
Save All When you have multiple documents open and you need to save them all to do a build, use this. Shift + Command + O
To Lower Case Use this to convert a selection to lower-case text. Shift + Command + Y
To Upper Case Use this to convert a selection to upper-case text. Shift + Command + X
Word Completion Probably the most powerful command in Flex Builder. This calls an auto complete menu based on what you have typed in. If you were to type out “Spr” and call the word completion it would pop up a menu with Sprite (and a few other close matches) for you to choose from. Once you make a selection, Flex Builder will also attempt to import the class for you. Your custom classes will also show up in this menu along with the built in classes the Flash Player supports. I can’t live without this! Control + .

配置WEB浏览器

现在让我们察看WEB浏览器菜单。如果你想要在你机器上的不同浏览器中测试,这是非常有用的。现在我使用Chrome beta作为我的默认,但我做所有的调试在FireFox我也觉得是有帮助的使用不同的浏览器,调试器测试时,有时会因为浏览器崩溃或使挂起.

browsers.jpg

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: