Alternativa3D 8 的开始



In this tutorial we will show you information about setting software for work with Alternativa3D 8.

在这个教程,我们将展示怎么在你的软件中使用 Alternativa3D 8。


In order to work with Alternativa3D you should get any software:


  • Flex SDK (version 4.5 – link). 下载它,并放到一个方便的位置。
  • Flash – player (version 11 – link).
  • Alternativa3D 8 engine 可以从这里下载AlternativaPlatform. 下载它并放到一个方便的位置。
  • Development environment 开发环境

In this tutorial we look at the most popular development environments:


You should choose the most convenient IDE for you (Comparison of IDE).



Flash Develop 4

  1. Download Flex SDK. Goto folder %SDK_PATH%\frameworks\libs\player\ (where %SDK_PATH% – SDK folder). If there is no folder 11.0, then create it and copy the file playerglobal.swc into it (It is necessary for all IDEs)..
    下载Flex SDK。去这个文件夹%SDK_PATH%\frameworks\libs\player\ (%SDK_PATH% – SDK的文件夹)。如果里面没有11.0的文件夹,那么久创建这个文件夹,并复制 playerglobal.swc文件到这里(这是必需的对于IDE)
  2. Launch the Flash Develop. We see the start window:
    打开Flash Develop。我们看到这样的开始界面:
  3. For connecting the Adobe Flex SDK use menu items: “Tools→Program settings→AS3Context→Flex SDK location”. Specify the path to downloaded SDKs:
    到这里”Tools→Program settings→AS3Context→Flex SDK location”来加入Flex SDK。指定SDK的路径:
  4. Create a new ActionScript project: menu items Project→New project:
  5. Specify the type of project and path to it:
    FD03 8.JPG
  6. Open file {project_folder}\bin\index.html and add the string:

    wmode: "direct"
  7. Specify the additional parameters:
  8. Project→Properties→Compiler Options→Additional Compiler Options.FD06 8.JPG

    Add here the string:

    -swf-version=13 -target-player=11.0 -static-link-runtime-shared-libraries=true
  9. Project→Properties→Output→Test Movie set to Open documentand type here the string:
  10. We had created the project. Connect Alternativa3D engine. Copy to {project_folder}\lib\ the file Alternativa3D.swc. Next, go to Flash Develop. Click on Alternativa3D.swc by right mouse button and “Add to library”:
    我们已经创建这个项目。链接Alternativa3D 引擎。把文件Alternativa3D.swc复制到{project_folder}\lib\。下一步,回到Flash Develop。鼠标右键加入到库。
  11. OK! You had configured the Flash Develop 4. To check it out you should to compile the simple example. Rename the main file of the project: to And copy here next code and compile it.
    好!你已经配置好Flash Develop 4。编译一个简单的例子看是否成功。重新命名这个项目的主文件 改为。并复制下面的代码,并编译它。

    <pre>package {
    import alternativa.engine3d.controllers.SimpleObjectController;
    import alternativa.engine3d.core.Camera3D;
    import alternativa.engine3d.core.Object3D;
    import alternativa.engine3d.core.Resource;
    import alternativa.engine3d.core.View;
    import alternativa.engine3d.materials.FillMaterial;
    import alternativa.engine3d.primitives.Box;
    import flash.display.Sprite;
    import flash.display.Stage3D;
    public class HelloBox extends Sprite {
        private var stage3D:Stage3D;
        private var camera:Camera3D;
        private var rootContainer:Object3D;
        private var controller:SimpleObjectController;
        private var box:Box;
        public function HelloBox() {
            camera = new Camera3D(0.01, 10000000000);
            camera.x = -50;
            camera.y = -300;
            camera.z = 100;
            controller = new SimpleObjectController(stage, camera, 200);
            camera.view = new View(800, 600, false, 0xFFFFFF, 0, 4);
            rootContainer = new Object3D();
            box = new Box();
            box.setMaterialToAllSurfaces(new FillMaterial(0x0));
            stage3D = stage.stage3Ds[0];
            stage3D.addEventListener(Event.CONTEXT3D_CREATE, init);
        private function init(event:Event):void {
            for each (var resource:Resource in rootContainer.getResources(true)) {
            addEventListener(Event.ENTER_FRAME, enterFrameHandler)
        private function enterFrameHandler(event:Event):void {

    If you see the black box then all right.

    FD07 8.JPG

    Adobe Flash Builder 4

    1. Execute the point 1 from first chapter
    2. Launch Adobe Flash Builder 4. We see the start window:
      打开Adobe Flash Builder 4。我们可以看到这个开始窗口:
    3. Create a new ActionScript project (menu items: File→New→ActionScript Project)
    4. In the resulting window, specify the basic parameters of the project (name, path to the working directory, version of SDK). The name of our project: "HelloBox"
    5. For normal operation, we need to have at least SDK version 4.5. If you haven't done so, click on the link "Configure Flex SDKs...". Please go to Installed Flex SDKs at Preferences window and add the path to the SDK.
      为了正常地运行,我们需要至少4.5版本的SDK。如果你没有这样做,点击链接“安装Flex SDKs...”。在选择窗口中选择安装 Flex SDKs,并加入SDK的路径。
    6. Specifying additional parameters of the project. Clicking on the "Add SWC" we get to the window to add a third party library. We use this to specify the path to Alternativa3D 8
      指明项目的附加参数。点击“add SWC”加入第三方的库,指明Alternativa3D 8的路径
    7. We see an empty project ActionScript 3.0
      我们看到一个空的ActionScript 3.0的项目
    8. Now we need to specify additional properties of compilation. Call the context menu of the project and select "Properties". Specify the properties of the compiler:

      1. Specify the version of the player who will play the swf-movie 11.0.0
      2. Advanced Compiler Options


        13 is the SWF version that corresponds to the player, so you need to tell the runtime what version of the APIs you want to use.

    9. Specify the properties of HTML-environment (file index.template.html). To enable hardware acceleration must be set:

      params.wmode = "direct".
    10. OK! You had configured the Adobe Flash Builder 4. To check it out you should to compile the code from first chapter. If you see the black box then all right.
      好!你已经配置好Adobe Flash Builder 4。看看你是否可以编译第一张的代码。如果你看到那个黑盒子,那么一切正常。

    [edit] Intellij IDEA(本人没用过这个工具,这部分就不翻译了,需要的话可以留言)

    1. Execute the point 1 from first chapter
    2. Launch Intellij IDEA. We see the start window. Create a new ActionScript project (menu items: File→New project)
    3. Next, select the item Create project from scratch and click Next

    At this window we can specify information about project: project name, path to project and other parameters:

    1. Create source directory
    2. Specify the path to Flex SDK:



      Delete library {SDK_PATH}\frameworks\libs\player\10.2\playerglobal.swc. Add library {SDK_PATH}\frameworks\libs\player\11.0\playerglobal.swc

    3. Additional parameters:
      IDEA10 8.JPGIDEA11 8.JPG

      Clicking Create you will get an empty AS3 project

    4. Mark src folder as Source root. Call the context menu of src folder and select Mark Directory AsSource root
    5. Create the new AS3 class. Call the context menu of src folder and select NewActionScript Class. Specify the name of new class: HelloBox
    6. Now connect Alternativa3D 8 engine. Select the menu item FileProject Structure. After that you can see the project settings window. And here there are some points: Project, Modules, Libraries etc. We will need three of them:
      • At Project you must choose your Flex SDK
      • At Libraries you must specify the path to Alternativa3D 8 engine: add the new ActionScript/Flex library. After that click "Add SWC Files", specify the directory, where you extract Alternativa3D.swc
      • At Modules you can get the tab Flex Compiler Settings and specify Additional compiler oprions:
        -static-link-runtime-shared-libraries=true -swf-version=13
    7. To check it out you should to compile the code from first chapter. Click menu items RunRun. After that:
      IDEA12 8.JPGIDEA13 8.JPG

      Click "Run" and you will see our black box.


0 条评论。


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>