Export your Blender objects straight to Away3D, Papervision3D and Sandy!

This script enables you to export Blender objects to ActionScript 3.0 objects. This way you no longer have to load external (Collada) files. Supported 3D engines are:


Flash & Flash Developer’s Magazine offers a free PDF version of the issue that contains the “Blender to Flash workflow” that was written by me. You can download it here.

Installation instructions

Download this zip file and extract it to:

  • Windows: /Blender Foundation/Blender/.blender/scripts/ (Blender .2.46: C:\Documents and Settings\<username>\Application Data\Blender Foundation\Blender\.blender\scripts)
  • Mac: /Applications/blender/blender.app/Contents/MacOS/.blender/scripts/

Open Blender. The “Export > ActionScript 3.0″ option should appear in the file menu:

Blender File menu options

How to use the ActionScript exporter

First make sure that the Blender object satisfies the following preconditions:

  • Make sure it is triangulated (edit mode > ctrl + t, not necessary if you’re using Sandy 3.1)
  • Make sure the object is selected

Go to File > Export > ActionScript 3.0 Class. Fill in the necessary details in the exporter dialogue:

Exporter options

Example files

The Blender file is included.

Please report any bugs, issues or requests by commenting on this post. Thanks!

10-08-2008 UPDATE: This script has been updated and is now compatible with the latest Away3D and Papervision3D versions. It also contains a bugfix for the dropdown menu.

05-04-2009 UPDATE: Added support for quads (Sandy only, thanks Makc) and modifiers (short how-to here). Created a zip file instead of rar file.

28-05-2009 UPDATE: A comprehensive tutorial about the Blender to Flash workflow was published in Flash & Flex Developer’s magazine. More info here.

11-06-2009 UPDATE: The script can now also export all the objects in the scene at once. Also fixed a positioning bug.

17-06-2009 UPDATE: Added support for multiple selected objects and fixed an error that occurred when a non-mesh object was selected.

29-07-2009 UPDATE: The Alternativa3D engine is now supported. Again, big thanks to Makc for his help!

23-09-2009 UPDATE: Away3D Lite 1.0 is now supported.

30-09-2009 UPDATE: Tidy up. Externalised the script templates.

28-10-2009 UPDATE: Added support for the haXe Sandy port. Big thanks to Paul Fitzpatrick.

  • Delicious
  • Facebook
  • Digg
  • Reddit
  • StumbleUpon
  • Twitter

250 thoughts on “Export your Blender objects straight to Away3D, Papervision3D and Sandy!

  1. Hi Dennis, great plugin.

    I’m getting the same error as Mathieu:

    File “C:\Program Files\Blender Foundation\Blender\Scripts\AS3Export.py”, line 488, in draw
    logoImage = Inage.Load(Get(‘scriptsdir’)+sys.sep+’AS3Export.png’)
    IOError: couldn’t load image

    and I also tried the Elisabeth trick of putting the image there, but the error still there.

    Blender 2.49b, python 2.6.2, windows xp

    Help? please?

  2. Bruce says:

    I have a poblem…
    Frist sorry for my english.

    I do the export since blender 2.49b, with de actionscript to papervision3d. This generate a file .as, ok?

    How can applay this file? In the examples there are some files .as that the export don’t do it, I have to create? How can I do it?

    Thanks!

  3. Robert says:

    I’m having trouble getting the Away3D example to work (the Away3D Lite example works fine). It looks like it wants Flash 9, but what version of Away3D does it want? I’ve tried 3.3.3 and 3.4.0 and it throws compile errors and doesn’t display anything.

    Thanks!

  4. Cocce says:

    Hi all, i use the plugin to export to pv3d2.0 . I have this problem: when i use the file.as in papervision, the UV-texture (created by YV-smart projection) isnt loaded correctly.
    I add a new BitmapMaterial with doubleside set to true.
    My model is not fully skinned. It’s seem to be a vertex skinned and not totally skinned.

    Any ideas?

    Thanks in advance
    Casazza’s Cocce

  5. fxnull says:

    I exported my blender object to pv3d v.2.0 and try geometry.vertices.length
    operation and got this

    Error Message: TypeError: Error #1009: Access to property or method of a null object Reference not possible.

    pls show me how to solve it.
    thanks.

    ps : your exporter is great!

  6. John says:

    I’m trying to get this export to as3 to work for me. I’m using away3d v 3.5 and blender2.49b , I’ve added mesh to my object and export as as3 no prob, but when I try and use it in flash I get

    My3dObject, building material: textureBitmapClass = null
    My3dObject, building material: normalBitmapClass = null

    and the object does not show up. So then I went into My3dObject.as and uncommented the embed lines and changed that to a couple images I have and tried again… after that attempt I got

    Adding BitmapMaterial.
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at away3d.materials::BitmapMaterial/getUVData()

    Anyone got any ideas?

  7. John says:

    I should have told you great job and thanks for the time you’ve spent helping out others. So thank you. I’m still having this problem. I’m a complete Noobie to both away3d and blender (< 2 days) …. but I went through your flash magazine tutorial (using away3d) and I couldn’t get it to work there either. Weird thing is that I couldn’t get collada to import, but md2 finally worked for me. Is there anyway you could point me to some info on what I need to learn to get your script up and running using away3d 3.5? It seems like it is a much better solution than the md2. Also, can I somehow just export mesh with no material and use the away3d materials runtime?

  8. Unfortunately I can not get this to work. I downloaded the file and extracted it into the most reasonably close folder to the destinated noted. I have blender 2.5 alpha 2. I guess I do not know what else to do. I extracted it to release/.blender/scripts and it doesn’t show up in my list under export. Any help would be great. Also I’ll pose the question if i’m trying to make a flash application that say… I could put a Christmas tree on in 3d (from blender that the user can rotate and zoom in and out of), and let users select different ornaments and place them on the tree all in 3d, would flash work for that? Or am I barking up the wrong tree? An Applet seems like it would not be user friendly. Again any help would be awesome as I’m not very knowledgable about this sort of thing. thank you everybody

  9. I have a bug when I add exported file to flash (cs3). I have a two files: cube.fla and cube.as. In cube fla I have a class (cube) in cube.as I have code from exported blender files. When I push Ctrl+Enter [test movie] I have a bug:
    5000: The class ‘Cube’ must subclass ‘flash.display.MovieClip’ since it is linked to a library symbol of that type.
    Please help me and sorry for my english

  10. Ukko says:

    This script is certainly a great job. The best thing is that exported .as files are about half as big as their analogue files exported as collada .dae.

    But when using multiple files exported with this script there appears a problem. It seems that all the actionscript code as well as all the textures are embedded into the final .swf during compiling. I tried this given example: http://www.rozengain.com/files/blog/blender-export/BlenderExportPapervision20.rar

    Even if you delete all other data except the .swf it will work, that is because everything is ebedded into the movie. Is there any other way to load the data into main movie from external .as files created with this script?

  11. Dave says:

    Hi, thanks for your great exporter. I use it a lot.

    I’m having to flip the normals in blender to get the texture to work correctly in papervision.

    I’m using:
    Papervision3D_2.1.932
    Blender 2.49b (mac)

    Maybe something has changed in the latest version of papervision or blender that would be causing this issue? I didn’t have this problem a year back when I started using the exporter. Any help would be great.

    Thanks again for all your work.

  12. Andrew says:

    Thanks for sharing this, Dennis. Will be really useful in my future projects. THANKS!!!!!!!!!!!!!!!!!!!!!!!!!! xD

  13. BlenderNoob says:

    “Has anyone got this to work in Blender 2.53/2.54? If so, what is the install procedure?”

    I would like to know too. :-/

  14. Aloha,
    Just trying this out. I’m on a Mac running Snow Leopard, I dropped the files in folder suggested, no problem. Restarted Blender and can see the AS3 Export option. However, regardless of what object I select, the AS3 Export option only returns “phython script error: check console”. Any ideas?
    Thanks everyone!

  15. ronald says:

    Hey, I tried this:

    var modelo:TriangleMesh3D;
    modelo=new Toyota_RA1_rav4insid(new ColorMaterial());

    1)The material is a solid color. How do I load it?
    2)I got this error:
    Call to a possibly undefined method Toyota_RA1_rav4insid

    Please, help me to fix it.

  16. Eximius says:

    Maybe someone could port this to blender 2.5x? Because the apis for 2.4x and 2.5x are a bit different and a script for 2.4x cannot be used with 2.5x .

  17. Jaime says:

    Hello everybody,
    Basically i just go the same error as #seeker. Please let me know if someone knows how to fix it.
    Thank you.

  18. David says:

    Hello

    I have created a collada file for use with papervision with blender 2.55 and
    I have the error below Why please

    at org.papervision3d.materials::BitmapMaterial/transformUVRT()
    at org.papervision3d.materials::BitmapMaterial/drawTriangle()
    at org.papervision3d.materials::BitmapFileMaterial/drawTriangle()
    at org.papervision3d.core.render.command::RenderTriangle/render()
    at org.papervision3d.render::BasicRenderEngine/doRender()
    at org.papervision3d.render::BasicRenderEngine/renderScene()
    at org.papervision3d.view::AbstractView/onRenderTick()
    at Main/onRenderTick()

  19. Ron says:

    Is anybody working on an upgrade for Blender 2.55. With the upcoming Flash Molehill API, I can see this exporter becoming an increasingly importent tool.

  20. aeon fluxx says:

    he guys thanx a lot!! i have a mac, and had a few problems, but all the answers are clear and really GREAT!!!! thanx

  21. SETUP UNDER OSX SNOW LEO:
    1. BLENDER NEEDS TO BE IN Applications FOLDER!
    2. cd /Volumes/DATA/3D_RENDERING/BLENDER/SETUP/AS3Export
    drwxr-xr-x@ 13 canoodle staff 442B 23 Feb 08:20:08 2010 AS3Export
    -rwxr-xr-x@ 1 canoodle staff 19K 23 Feb 08:52:08 2010 AS3Export.py

    3. cp -R * /Volumes/OSX/Applications/blender.app/Contents/MacOS/.blender/scripts/

    thanks!

  22. Sarah says:

    To see the hidden .blender folder you have to use a terminal command that will show all files.

    It’s not hard. Just open Terminal and paste this:

    defaults write com.apple.finder AppleShowAllFiles TRUE
    killall Finder

    Then navigate to the Contents/MacOS/ folder by right clicking on Blender app and choosing show contents and you’ll see the .blender folder.

  23. Mr. T says:

    i have the same question – does it work with 2.59 (and where do i have to extract the zip to – there is no .blender-folder?)

  24. I was searching the net and found many article saying how it is possible to export blender files to AS3 so flash can utilize the rendered model or object i down loaded the patch that you made i put it where you said it don’t work
    :(

    i’m using 2.56 it did’nt work so i upgraded to 2.6. i placed the as3 updater in the program files directory as well as the Application Data directory both in add-on folders

    thank you for your time

    p.s can’t wait to use this feature it does sound awesome

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>