In this tutorial, i’ll show you how to get a minimal Flare3D + Oculus Rift VR application:

Oculus VR’s Oculus Rift could be the device virtual reality needs to finally break into the mainstream, instead of just being something for tech-frenzied neophiles. The Oculus Rift is a virtual reality headset that can display stereoscopic 3D and offer head tracking to let you look around inside virtual worlds.

After a successful Kickstarter campaign Oculus VR put together a development kit that’s being slowly shipped out to customers, with sights on a consumer-friendly version in the future. In a few years, everyone might have their own Oculus Rift and use it to play video games and virtually tour other locations.

Creating the project:

First of all, we need to connect the Oculus to the PC, make sure to connect everything before turning it on.
You have to set the resolution to 1280×800 and duplicate the screens. Once everything is connected, turn the Oculus on.

Create a new AIR (AIR SDK 3.8+) project using Flash Develop or Adobe Flash Builder(4.6 or higher) and integrate it with Flare3D and the Oculus Rift library and Native Extension. I’ll show you the steps to do it using Adobe Flash Builder 4.7:

1- First, we need to create a new ActionScript Project:

New ActionScript project in FlashBuilder


2- Then we need to give our project a name and select the proper SDK to use. If you installed your AIR SDK properly, you should see something like this (don’t forget to check the “Desktop (runs in Adobe AIr)” option):

project settings

Open the Project Properties and go to Action Script Build Path in the menu:

project settings - External libraries

From this screen you can add any SWC files your project might need. In this case, we have to add Flare3D’s SWC. To do this, just press Add SWC and browse to the SWC file that came with your Flare3D distribution package.

To incorporate the head tracking, we have to add the Oculus swc and ane libraries to our project. You can download these here.

Now we have to add the Oculus SWC. To do this, press Add SWC again and browse to oculus-ane-master/ane/as3/bin/OculusANE.swc in the package you just downloaded.

Now, go to the tab Native Extensions:

project settings - Adding native extensions (ANEs)

Press Add ANE and navigate to oculus-ane-master\ane\bin\OculusANE.ane in the package you just downloaded.

Then press OK to close the window.


3- Just like when embedding a Flare3D project using HTML, we have to tell your AIR app that we need “direct mode” rendering. There’s also a bunch of other settings we need to configure. All this can be configured from our application XML file. In this particular case, it’s called “Flare3DAndroid-app.xml” but it will depend on the name you chose for your app.
So, let’s open it and add/change for the following lines:


And finally, let’s write some code:

Include this class:, and the FLSL filter to emulate the Oculus: distortion2.flsl

Now, open your main class file and write something like this:


Make sure everything compiles correctly and press F11 to start debugging. You should see something like this:

Flare3D + Oculus Rift demo


Now put on your oculus, and enjoy! :-)


Or.. you can download the complete example project for Flash Builder or for Flash Develop.

EXTRA: Oculus Rift Calibration:

Everybody’s head is a little bit different. One fairly subtle, but extremely important ‘per user’ variable is the IPD (Interpupillary Distance) – which is different for everyone. Get this wrong, and it can cause eye-strain and nausea. 😕

Oculus SDK include an integrated IPD Measurement and Adjustment tool, you can download it here.

Make sure you have your Rift turned on and the resolution set to 1280×800, then go ahead and launch the utility.
It looks like this:


Use the new button to create a new profile. Give your profile a name. Specify your gender and which eye cups you’re using. With your Oculus Rift ready, hit the Measure button to launch into the IPD measurement tool. Follow the on-screen prompts to measure your IPD. The utility will automatically input the value into the box when you finish.


UPDATED: If you want to learn more about Oculus Rift development, you can also  check out this topic in our forum. You’ll find extra information and a new updated example made by Tom Goethals.


Tags: , , , , , , , , , ,

  • Nahuel Bergamo

    This is awesome! Really happy to see the Oculus community getting some love :)


  • Cédric Parisi

    I’ve an ArgumentError : Error #3500, the extension context does not have a method with the name isSupported!

    Someone knows?


  • Pavel Langweil

    Why is the middle part of the texture repeating? Was this tested on Oculus? I’m not getting a very good 3D in mine, even after changing the values inside OculusScene3D…I have problems with the middle artifacts and the general immersion(its a bit “flat”) + I see borders on left/right, its a bit cut off on the sides.

  • Vale

    Hi! Did you check if the Oculus ANE was properly added to the project?

  • jonathancurrent

    You guys will be happy to know that I worked with Oculus to prepare the ANE for the upcoming HD version :) I’ll be updating the repository soon so keep a lookout



  • Daniel Santiago

    I have the same Error #3500, I checked the Oculus ANE in my project and it’s there with the SWC too..I’m using Flash Profesional CS6.. Any suggestions?


  • Daniel Santiago

    Hi everybody!..I’m getting Error #3500 The extension context does not have a method with the name isSupported., I checked the Oculus ANE in my project and it’s there with the SWC too..I’m using Flash professional CS6.. Any suggestions?


  • Pavel Langweil

    Hi there, thanks for your reply above – unfortunately meanwhile I had to migrate to Unity even I was using Flash for years because I didn’t get any answer. Tested it there and the integration / 3D effect was perfect. What I meant besides borders was the middle section, its even on your own screenshot. On the sides, you can see the left/right borders curved – the middle appears to also have curves,but only black lines, its not cutoff. The textures continue and join in the middle. Thats weird. From what I remember I Was noticing this thing in my Oculus and it made me uncomfortable. Anyway its possible that some calibration will negate the effects. It just strikes me that you’ve got that on a screenshot here as well, vs if you look at for example Unity or Unreal Engine Oculus demos, there are simply 2 “holes”, the textures are not joined in the middle.