回复评论
在Flash, Flex或者Flashdevelop中安装使用Away3D
如果你正准备开始学习Flash 3D。但不知道如何开始。本教程会帮助你在Flash, Flex和Flashdevelop中设置基本开发环境。
Away3D是个很好的3D引擎,有很好的社区支持,结构清晰不断改进的文档。使用Away3D,你可以选择一种你所喜爱的开发工具,开始进行3D Flash开发。下面介绍的方法,并不单单适用于Away3D。这个方法使用于各种源代码引擎。所以如果你想用Keith Peters的MinimalComps,或者其他开源代码,请看本教程中的讲解。
作者: Jens C Brynildsen (August 08th 2008)
翻译:Sonic (翻译中2008-10-08)
用Away3D的最新版本开始
有两种不同方式得到最新版代码。
方法1:到 http://away3d.com/downloads/ 下载。只需要下载ZIP文件(away3d源代码)并解压。
方法2:安装Subversion(SVN)(Sonic注,一款很常用的版本控制软件),然后从Google 代码库下载。使用SVN是下载最新版代码或退回之前版本的最好方法。如果你使用Flex,你可以从这里学习如何在Flex中设置使用SVN(英文,尚未翻译)。在Windows平台上使用Flash的用户可以看看这篇很棒的SVN教程。这篇“为什么要使用版本控制软件”的文章讲解了更多关于Subversion的信息,以及版本控制软件对程序员的好处。
以下是使用SVN导出Away3D的步骤
- 打开Flex,选择文件-> 新建 -> 其他(File -> New -> Other)
- 选择SVN -> 从SVN导出工程(SVN -> Checkout Projects from SVN)
- 新建文件库位置
- 输入Google代码库的网址(只需要输入URL,Flex会自动加上其他东西) http://code.google.com/p/away3d/source/checkout
- 选择"src"文件夹
- 在下一屏中接受默认设置(General -> Project)
- 给工程起名为"Away3D_src" (或者其他类似的名字)
当你点击“完成”时,Flex会创建一个新的工程,并且开始下载最新版殷勤到这个目录。如果之后你需要更新代码版本,只需要用右键选择工程,然后选择Team -> Update。
Flash
For Flash to find the Away3D files, you have two options.
Option 1: Store the Away3D files with the FLA
Just copy the "away3d" and "nochump" folders into the folder that your FLA file resides in. This will cause Flash to find them automatically. This has also has the benefit of making it easy to share the project. Just compress the entire folder to a ZIP archive and the recipient will have all the required code. The drawback is that if you have a lot of projects, you'll get a lot of duplicate files.
Option 2: Update Actionscript settings
Keeping the Away3D source in just one location and pointing Flash to that folder will save you a lot of duplicate files. It'll also make it easier to update to the latest version by just replacing the folder contents.
- Select File -> Publish Settings.
- Click the "Settings" button (next to Actionscript version)
- In the Classpath box at the bottom, Click the plus to add a path and then click the target icon to locate the file
Keep in mind that if you use a direct path such as "C:\Documents and Settings\UserName\My Documents\Away3D source", the project will only work on your computer. If you use relative paths cleverly ("../Away3D source"), you can easily share the file with others that use a similar setup.
To view any of the pre-made Away3D Tutorial files, copy the class file to the same directory as the FLA. If you want to view the file "Renderers.as", copy this file as well as "Cover.as" (required). Next, type "Renderers" in the input field for "Document class" in the Properties panel and export. To view the source file itself, just click the pencil next to the "Document class" input field.
Flex
First, create a new Actionscript Project to hold your code (File -> New... -> Actionscript Project). In Flex you have the same two options as with Flash, either copy "away3d" and "nochump" folders into your project folder or link to a folder on your filesystem. If you chose the SVN option or want to link to a folder on your system, follow these steps:
- Right click the project you just created and select Properties.
- Select "Actionscript Build Path", click "Add folder..." and browse to the location of the Away3D source code.
- Click OK to close the dialogue and you're ready to go
To view any of the pre-made Tutorial files in Flex, copy the file you want to view (i.e. Renderers.as) as well as Cover.as (required) to your project folder. Right click "Renderers.as" in the Flex Navigator, select "Set as Default Application" and run the file.
Flashdevelop
FlashDevelop is a free Actionscript editor that we highly recommend if you use a Windows based computer.
To set up Flashdevelop for using Away3D, start by creating a new project. Select Project -> New Project. Either copy "away3d" and "nochump" folders into the project folder or link to a folder on your filesystem. To link to a folder elsewhere on your filesystem, follow these steps:
- Select Project - > Properties
- Click the "Classpaths" tab and select Add Classpath...
- Browse the the folder containing the "away3d" and "nochump" folders and click OK
To view any of the pre-made Tutorial files in Flashdevelop, copy the file you want to view (i.e. Renderers.as) as well as Cover.as (required) to your project folder. Right click "Renderers.as" in the Project panel, check "Always compile" and Test Movie.
PS: If something is missing or does not work in this guide, email jensa at this domain and I will update the article.
最新评论
1 周 7 小时之前
1 周 11 小时之前
1 周 23 小时之前
1 周 6 天之前
1 周 6 天之前
2 周 22 小时之前
2 周 1 天之前
2 周 3 天之前
2 周 6 天之前
3 周 4 小时之前