Page 1 of 1

Setting FlashDevelop up to develop Stage3D applications.

#1 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3718
  • View blog
  • Posts: 5,990
  • Joined: 08-June 10

Posted 16 December 2011 - 10:07 PM

Setting FlashDevelop up to develop Stage3D applications.

This tutorial will show you, step-by-step, have you can set FlashDevelop up to develop Stage3D applications. It is meant to provide readers of the Beginning Stage3D part 1 tutorial, by stayscrisp, with a free alternative to the FDT 5 IDE. I won't go into any details about Stage3D in this tutorial, as he already does that. This should just allow you to follow his tutorials using FlashDevelop instead of FDT 5.

First things first.
Before you begin, you will need to install FlashDevelop 4, if you haven't already. You can get the latest version from: http://www.flashdeve...wforum.php?f=11
I used FlashDevelop 4 RC3 while writing this.

The FlashDevelop installer should install the latest Flex SDK for you, but as you may want/need to update your Flex SDK after installing FlashDevelop, I will assume that you need to install the Flex SDK manually.

You can download the Open-Source Flex SDK from: http://opensource.ad...wnload+Flex+4.6.
In order for this to work properly, you need version 4.6 or higher.
Simply extract the contents of the ZIP into a folder of your choosing. You will need to use the path to this folder later.

Setting up a Stage3D project

  • In the Project toolbar choose to Create a new project.

    Attached Image

  • In the New Project dialog, choose "AS3 Project" and fill in the Name and Location as you see fit.

    Attached Image

  • When the project has been created, right click the top-level of the project tree and select Properties.

    Attached Image

  • The first thing you need to do is go to the "SDK" tab and select "Manage" to add your Flex SDK.

    Attached Image

  • In the Language section of the Settings window, highlight "Installed Flex SDKs" and click the "..." button in the right corner.

    Attached Image

  • Click the "Add" button in the window that just opened, and fill in the "Path" value with the path to your new Flex SDK. Then click OK, and Close the Settings window.

    Attached Image

  • Now you can select your Flex SDK from the drop-down.

    Attached Image

  • In the "Output" tab of the Project Properties window, make sure the Flash Player is at version 11.0 or higher.

    Attached Image

  • In the "Compiler Options" tab, choose to edit the "Additional Compiler Options" values.

    Attached Image

  • Add a new line with -swf-version=13 in it.

    Attached Image


And that's it. Now you're ready to develop Stage3D code.

Using the Stage3D project
To make sure everything is in order, paste this code from stayscrisp into your Main.as file, and click the "Test Project" button in the top menu strip.

package 
{
	import flash.events.*;
	import flash.display.*;
	import flash.display3D.*;

	public class Main extends Sprite
	{
		private var context3D:Context3D;
		
		public function Main()
		{
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			
			stage.stage3Ds[0].addEventListener(Event.CONTEXT3D_CREATE, onCreation);
			stage.stage3Ds[0].requestContext3D();
		}
		
		private function onCreation(e:Event):void
		{
			var tempStage:Stage3D = e.target as Stage3D;
			context3D = tempStage.context3D;
			
			context3D.configureBackBuffer(500, 500, 0);
			
			addEventListener(Event.ENTER_FRAME, draw);
		}
		
		private function draw(e:Event):void
		{
			context3D.clear(0,0,0);
			
			context3D.present();
		}
	}
}


Attached Image

You should get a 800x600 Flash Player window with a solid black background.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1