How to run Molehill and Away 3D Broomstick with Flash Develop
Here's my method to make and run cool Molehill projects with current FlashDevelop release (3.3.4 ) :
First of all, the information you may need can all be found here
The first thing you need to do is to install the runtime on a web browser.
What I did is installing it on a browser I don't use mush ( Internet Explorer ... yeah... ) so my usual player is not fucked up.
To check that the player is really installed, go here :
http://www.flashplayerversion.com/
You should have something starting with 11.0
At this point, you can run insane Molehill demos on the Web :
Alternativa 8 racing game
Away 3D Broomstick demos
Zombie Tycoon game
It's time to configure Flash Develop :
- Download the right Flex SDK : build 19786
- Unzip the flex SDK on your drive, don't override your usual SDK, you'll regret that !
- Download molehill playerglobal.swc here : playerglobal.swc
- Go into your new Flex SDK directory and more precisely into : YOUR_DIRECTORY\frameworks\libs\player\
- Create a new folder named 10.1
- Paste the playerglobal.swc file into this folder.
- Rename it to playerglobal.swc
Now you can start Flash Develop :
To create a new Molehill ready project :
- Make a new Projet : Project->New Project-> AS3 Project
- Edit the generetad bin/index.html file
- Add the following flashvar to enable GPU acceleration : wmode: "direct"
- Open Project->Properties :
- Set target property to : Flash player 10.1
- Set test movie property to : Run custom command... and leave the command blank
- Switch to Compiler options tab :
- Add this value to Additional Compiler Options : -swf-version=13
- Set Custom Path to Flex SDK value to your fresh downloaded SDK path
- Close the pannel and your project is now ready !
- Press F5 to build the project and everything should be fine !
To test your movie :
- Run the index.html page with the browser where flashplayer 11 is installed.
- You see nothing ? It works !
Now lets add a bit more 3D in this project :
- Get latest Away3D release from SVN repository ( I'm sure you know how to do this... ) :
http://away3d.googlecode.com/svn/trunk
- Open your project properties
- Switch to Classpath tab
- add AWAY_PATH\broomstick\Away3D\src to include the library.
- Close the properties pannel
Here's a basic Main file to test your project :
{
import away3d.containers.View3D;
import away3d.lights.PointLight;
import away3d.materials.ColorMaterial;
import away3d.primitives.Cube;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
[SWF(width="800", height="600", frameRate="60")]
public class Main extends Sprite
{
private var _view : View3D;
private var _light : PointLight ;
private var _cube : Cube;
public function Main()
{
_view = new View3D();
_view.antiAlias = 4 ;
addChild(_view);
_light = new PointLight();
_light.position = _view.camera.position ;
_light.color = 0xffffff;
_view.scene.addChild(_light) ;
buildObjects() ;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, stageResized);
addEventListener(Event.ENTER_FRAME, step);
}
private function buildObjects():void
{
_cube = new Cube() ;
var material : ColorMaterial = new ColorMaterial(0xFF0000) ;
material.lights = [ _light ];
_cube.material = material ;
_view.scene.addChild(_cube) ;
}
private function step(e : Event) : void
{
_cube.rotationY += .3;
_cube.rotationX += .3;
_view.render();
}
private function stageResized(e : Event) : void
{
_view.width = stage.stageWidth;
_view.height = stage.stageHeight;
}
}
}
In your molehill ready browser, you should see a nice red shaded cube.
NOW GO FOR DEMOS WITH BILLIONS OF POLYGONS §§§
Download the whole project
Watch the demo ( need fp11... )