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

Posted by on Jan 2, 2008 in 3D, ActionScript, Blender, Flash, Flex249 comments

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.



Tags: , , , ,


249 comments

» Comments RSS Feed
  1. Very, very nice.

  2. Do you happen to know if this will work on Blender for OS X? The install location suggested above does not map to the OS X install. Instead I was placing it in the {package-Content}Content/Resources folder and also copied to a folder named scripts there too. But this doesn’t work.

    Thanks,
    Justin

  3. On OS X the .blender folder is within Blender.app. To locate select “Show Package Contents” from the context menu and browse. I found the .blender folder in Contents/MacOS. Hope that helps.

  4. great… next a Modo 301 exporter :-)????

  5. I tried installing on OSX and it didn’t work. Tried the “Show Package Contents” as jwopitz mentioned in a previous post, but there is no .blender folder. There is only a blender Unix Executable File.

  6. Hi guys,
    Have you tried this directory?
    /Applications/blender/blender.app/Contents/MacOS/.blender/scripts/
    Please let me know if this works for you.
    Dennis

  7. For OSX:
    Go to finder-> Go -> go to folder… paste “/Applications/blender/blender.app/Contents/MacOS/.blender/scripts/” into the dialog box and hit Go.. put the python script in there.

    This is so awesome, thanks!

  8. “For OSX:
    Go to finder-> Go -> go to folder… paste”

    I tried this and I’m getting an error “The folder cannot be found”.
    When I navigate to the MacOS folder manually, I’m only seeing a blender exe file,
    there is no .blender folder.

    I’m running Mac OSX Leopard with the latest version of blender.
    Anyone else having this problem?

  9. I’m with Leopard and for me works properly.

  10. Brilliant script. Many thanks.

    Freddy – try brosing your Blender.app/Contents/MacOS directory in a unix terminal window using ls -a so you see files starting with a dot. That should allow you to find it. The Finder Go To Folder trick works too.

  11. Really Dennis.
    It’s Wow!

  12. I’m unable to export any type of as file except Away3D. Using Python 2.5.1, Blender 2.44, Ubuntu 7.10. The drop menu refuses to change. No errors in console.

  13. I solved my own problem, sort of: I just switched the order of the menu in the source to Sandy, which is what I wanted it for. :)

    Seriously though, the drop down menu is broken. Nice job though!

  14. Hoi Dennis,
    Without problems I exported your demo Torus to as3 script.

    Next i was trying to export this very nice tower bridge:

    http://www.turbosquid.com/FullPreview/Index.cfm/ID/328242

    First i imported it in Blender in .3ds format. The results in Blender were good. The bridge contains about 10 different objects. I exported one (the facade) to as3. However, in Sandy I can’t see anything. I checked the generated scaling and positioning. That seems to be OK.

    Here are the sourcefiles: the first one (TowerBridge.as) is a small adaption of your main.as. The second one is the generated export file (Facade.as).
    Any idea of what went wrong?

    //TowerBridge.as
    //=============

    //Facade.as
    //=========

  15. Oeps, I expected a scroll window!!

  16. Hi Harry,
    I removed the lines of code :-) Perhaps you can post links to the files?
    Thanks
    Dennis

  17. This is fantastic, thanks! I don’t understand all the effort being put into collada support, it’s an intermediatory xml format designed as a go between with separate apps. We should be using a native class, not adding an extra step to parse the xml on the clients time.

  18. I found the installation on a Mac a little tricky.

    If you navigate to the /Applications/blender/blender.app/Contents/MacOS/ there is no .blender folder because it is hidden or something. I couldn’t find how to get to this folder, so I had to copy the AS3Export.py file to /Applications/blender/blender.app/Contents/MacOS/.blender/scripts/ using the following script in Terminal (/Applications/Utilities/Terminal):

    cp /Users/USERNAME/Desktop/AS3Export.py /Applications/blender/blender.app/Contents/MacOS/.blender/scripts/

    The script above assumes that Blender is installed in the applications directory in a folder named “blender”. Also, don’t forget to change USERNAME to fit your needs.

    Hope this helps someone out!

  19. Hoi Dennis.
    Op dit moment kan ik geen files naar mijn website oploaden. Zou je me een mailtje kunnen sturen met je email adres. Dan kan ik de bestanden even opsturen.

    Ik ben overigens echt enthousiast over de mogelijkheden van Sandy als ook complexe structuren probleemloos kunnen worden ingepast.

    Groet
    Harry

  20. interesting idea, but i cant seem to get it to work… i downloaded both the great white (papervision 2) and then downloaded your Papervision3D 2.0 Example.

    when i click on the swf file it works fine… but when i tried to complie it in flash cs3, all i get is a blank screen…

    any help on this please

    thanks :)
    malik

  21. Hey Malik,
    Could you post a link to the files that you’re using?
    Thanks!
    Dennis

  22. I did all the right things, including the latest svn, etc. But when I look through the generated code (even the example torus doesn’t compile in Flash CS3) I get an error about TriangleMesh3D.

    The script tries to import it here::

    import org.papervision3d.core.geom.TriangleMesh3D;

    but in any version I have looked at there is no TriangleMesh3d in org/papervision/core/geom.

    I have successfully done other SMALL things with OV 2.0 so it’s working. Just wondering if the 2.0 generator needs updating….

  23. SOLVED!

    This may help some other folks, so here’s my mistake:

    My default path to the Papervision lib in CS3 should be:

    path blah blah blah:trunk:branches:GreatWhite:src

    Mine was something else, which allowed me to compile simple stuff, but not this. Woo woo!

  24. Sounds great but didn’t work for me…

  25. absolutely top stuff! just fantastic! I can stop banging my head against a collada shaped wall now! properly good work!

  26. I get this error when I try to export:
    Traceback :
    File ““, line 45, in ?
    ImportError: No module named bpy

    But then I also get errors when attempting to export Collada files. Blender just does not want to work for me! :)

  27. thank you so much for this script. =)

  28. Thanks for this useful script. I got it working but am confused: is there any way to apply multiple materials to the object? If that’s not possible, do you have any suggestions how to achieve that?

  29. Hi. I cannot get the sample file to run on my Windows XP. I get an error: The definition of base class mesh3D was not found, and just a black square. I am using Flash CS3. I am not a deep deep programmer but muddle thru!

    Any help much appreciated.

  30. Do you even recognize how often this is going to be used? There are so many sites that are dedicated to the work possible with blender, this is gonna scatter the web (you know I’m gonna go crazyinsane). it’s too bad you can’s blender into a swf (or even a moving gif file)

  31. This script is really great, thanks ;-)

  32. Does this export armatures and armature animations too? would be great.

  33. No, unfortunately it doesn’t export armature animations. I hope to implement that in the near future.
    Dennis

  34. Hi,
    I have exported a simple cube frum blender to Sandy3D. I succesfully display it after compilation. However when I try to cover it with a Bitmap metarial the flash player gets stuck. There is no problem in covering with a Colormaterial. I can cover both the sandy3d torus example and also MenuItem1 that I found in this website with a Bitmapmaterial by the way. The only problem is with the objects that I export my own. What can be the problem? The order of vertices? (the ones in the exported .as file that start with v(,,) anf f2(,,) functions)

  35. Hi Erman,
    Did you triangulate your mesh?
    Try:
    edit mode > mesh > faces > convert quads to triangles or ctrl+T
    Let me know if that works for you.
    Dennis

  36. Hi Dennis,

    Yes I did, and I tried it once more right now, but the result is the same. When I cover the whole cube with a bitmap nothing shows. The generate() function contains this:
    v(-1.000000,-1.000000,-1.000000);
    v(1.000000,-1.000000,-1.000000);
    v(-1.000000,-1.000000,1.000000);
    v(-1.000000,1.000000,-1.000000);
    v(1.000000,-1.000000,1.000000);
    v(1.000000,1.000000,1.000000);
    v(-1.000000,1.000000,1.000000);
    v(1.000000,1.000000,-1.000000);

    f2(0,1,2);
    f2(0,3,1);
    f2(2,1,4);
    f2(3,0,2);
    f2(2,5,6);
    f2(4,5,2);
    f2(1,3,7);
    f2(1,5,4);
    f2(3,5,7);
    f2(6,3,2);
    f2(6,5,3);
    f2(7,5,1);

    no other f() functions or so.

    Thanks…

  37. Can you send me the files so I can take a look at it? You can find my e-mail address in the about section. Thanks!

  38. some minor problem, it keep on export away3d…

  39. Sounds quite fancy :)

    But does not work for me. Even exporting a simple cube from Blender results in a blank screen.

    With some files i get the following
    Error Message: TypeError: Error #1009: Access to property or method of a null object Reference not possible.

    But even stranger: With other files i dont any error, just a blank screen.

    Thanks for your help :)

  40. Ahh, sorry, my configuration is:

    Blender 2.45
    Python 2.5.1
    Sandy 3.0.1
    Flash CS3

    Greets Paul

  41. Hi Paul,
    Could you send me the files so I can look at them?
    You can find my e-mail address in the about section.
    thanks!
    Dennis

  42. For macusers, here’ s an another handy way to put into .scripts hidden file in blender.app : Tinkertool -> “Show hidden files” and you’ ll see the no-more-hidden .scripts file !o)

  43. What about LINUX! Is there a recipee for us?
    Can I just put it in the .blender under Linux?

  44. I have an error

    this is using papervision2 from the svn as of 2/28/08

    the problem is with the class InteractiveSceneManager at org.papervision3d.core.utils.InteractiveSceneManager

    the error I get is
    1137: Incorrect number of arguments. Expected no more than 5.
    at line 289 and 290 which are

    dispatchEvent(new InteractiveScene3DEvent(event, DO3D, container, renderHitData.renderable as Triangle3D, x, y));

    any help?

  45. Hello,
    Thanks a lot for this great work. I’ve been having a problem though.
    I always get the following error:
    Error Message: TypeError: Error #1009: Access to property or method of a null object Reference not possible.
    I’ve tried with different 3D shapes (a sphere, a cube…) but I get the same error.
    Any ideas?

  46. I cant get it to work, I just get a blank screen, do I need to add the exported .as as the Document class of a flash file? or how do I add it to a project?

  47. Hi, i have a question: some packages and/or classes that the example require arent in the source of papervision/as3/trunk/src/org like:
    org.papervision3d.core.render.data.RenderSessionData

    Where can i get it?

  48. anyone had luck texturing customized object?? Im trying to texture some lego bricks

  49. yes friend, you it is just a python script that writes an actionscript class…

  50. I haven’t try it yet, but it looks interesting. Thank you very much for expending your valuable time writing this script.

  51. Sorry, but I’m kinda new to this type of stuff. I was wondering if the export would work with Flex as well? If so, could you please give me some info. Thanks in advance.

  52. Hi, I tried to export as .as file but I could see there is one .as file exported (without texture and blender one). May I ask for your help? Thanx.

  53. Hi, thanks for the scripts. That’s excellent tool! I’m just wondering if it’s possible to export somehow texture & uv mapping?

  54. You are a god!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  55. Hi there. I’m running Blender on Mac (OS 10.5.2), and having a pretty specific error come up for me on export. I’ve installed the files fine and the proper options come up for me in Blender. However, in trying to export to either of the Papervision classes, the .as file that I end up with is always looking for away3d assets (import away3d.core.* … etc). Any thoughts?

  56. Nevermind, turns out that each time I set the file path to where to save the exported .as, the export type reverts back to away3d … just didn’t notice b4.

  57. Got everything running, really great work!!!

  58. In blender I export a simple box to paperviso3d v.20. the output
    TheBox.as.
    and than create a test. fla to import TheBox.as. when i compile test.fla there is a n error message :
    1046: Type was not found or was not a compile-time constant: TheBox.

    Pls. help me to solve this.
    I include the code below.

    TheBox.as listing :
    package {

    import org.papervision3d.core.math.NumberUV;
    import org.papervision3d.core.math.Number3D;
    import org.papervision3d.core.geom.renderables.Triangle3D;
    import org.papervision3d.core.geom.renderables.Vertex3D;
    import org.papervision3d.core.geom.TriangleMesh3D;
    import org.papervision3d.core.proto.MaterialObject3D;

    public class TheBox extends TriangleMesh3D {
    private var ve:Array;
    private var fa:Array;

    public function TheBox(material : MaterialObject3D, initObject:Object=null ) {
    super( material, new Array(), new Array(), null, initObject );
    ve = this.geometry.vertices;
    fa = this.geometry.faces;
    v(1.000000,-1.000000,1.000000);
    v(1.000000,-1.000000,-1.000000);
    v(-1.000000,-1.000000,-1.000000);
    v(-1.000000,-1.000000,1.000000);
    v(1.000000,1.000000,0.999999);
    v(0.999999,1.000000,-1.000001);
    v(-1.000000,1.000000,-1.000000);
    v(-1.000000,1.000000,1.000000);

    f2(0,1,2);
    f2(4,7,6);
    f2(0,4,5);
    f2(1,5,6);
    f2(2,6,7);
    f2(4,0,3);

    this.x = 0.031887;
    this.y = -0.000503;
    this.z = 0.033828;

    this.rotationX = 0.000000;
    this.rotationY = 0.000000;
    this.rotationZ = 0.000000;

    this.scaleX = 1.000000;
    this.scaleY = 1.000000;
    this.scaleZ = 1.000000;

    this.geometry.ready = true;
    }
    public function v(x:Number, y:Number, z:Number):void {
    ve.push(new Vertex3D(x, y, z));
    }

    public function f(vertexIndex1:Number, vertexIndex2:Number, vertexIndex3:Number, uv00:Number, uv01:Number, uv10:Number, uv11:Number, uv20:Number, uv21:Number, normalx:Number, normaly:Number, normalz:Number):void {
    var face : Triangle3D = new Triangle3D(this, [ve[vertexIndex1], ve[vertexIndex2], ve[vertexIndex3]], null, [ new NumberUV(uv00, uv01), new NumberUV(uv10, uv11), new NumberUV(uv20, uv21) ] );
    face.faceNormal = new Number3D(normalx,normaly,normalz);
    fa.push(face);
    }

    public function f2(vertexIndex1:Number, vertexIndex2:Number, vertexIndex3:Number):void {
    var face:Triangle3D = new Triangle3D(this, [ve[vertexIndex1], ve[vertexIndex2], ve[vertexIndex3]], null, []);
    fa.push(face);
    }

    }

    }

    test.fla listing
    import TheBox;
    var TheBox:TheBox = new TheBox();
    trace(TheBox);

    1046: Type was not found or was not a compile-time constant: TheBox.

    var TheBox:TheBox = new TheBox();

  59. Really amazing work thanks!

    Thought I’d post this little fix. To get the torus demo running in Away3d 2.0 you have to use the following imports:
    In blendertorus.as-
    import away3d.core.*;
    import away3d.core.base.*;
    import away3d.materials.*;
    import away3d.core.utils.*;
    import away3d.containers.*;

    in Main.as -
    import away3d.materials.*;
    import away3d.core.base.*;
    import away3d.core.math.Number3D;
    import away3d.core.render.*;
    import away3d.core.utils.*;
    import away3d.events.*;
    import away3d.loaders.*;
    import away3d.primitives.*;
    import away3d.containers.View3D;

    There might be some extraneous imports here, but it worked.

    Thanks again!

  60. 5000: The class ‘Monkey’ must subclass ‘flash.display.MovieClip’ since it is linked to a library symbol of that type.

    Receiving this error, Papervision 2.0, Blender 2.5

  61. hello, when i apply subsurf, then triangulate and export to papervision 2.0, object won´t show, and flash won´t trace even papervision default trace.
    any suggestions? is it a bug? m i doing something wrong?

    thank you

  62. Hey Steve,
    Could you send me your files? You can find my e-mail address in the “about” section.
    Thanks,
    Dennis

  63. Hey Pablo,
    There’s nothing in the trace, no errors?
    I can take a look at your code if you’d like. My e-mail address is in the “about” section.
    Thanks,
    Dennis

  64. Hi Dennis and fellows,
    i ve solved a part of the problem; it depends in the order in which you follow the steps to model your final Mesh; if you model, then subsurf, and finally triangulate, the model at least shows up (with some holes in where should be triangles).

    If you model, then triangulate, then subsurf and triangulate again, without using textures, yo have no problem, but with a textured model, the model won´t show up, and papervision trace no error.

    Now the new part of the problem is the holes as triangles, like if the normals where confused and the render wouldn´t recognize the texture in some of the triangles, as you can see at http://www.dicot.net/samples/pablo/Qbin.html

    or maybe i ve no idea what´s goin on! : m

    any help would be really appreciated

  65. please update the link:
    http://wiki.blender.org/index.php/Scripts/Manual/Export/ActionScript_3.0

    the old one is deprecated now.
    cheers
    migius (blenderWiki team)

  66. Guy, Denis
    Thank for a wonderful tool.
    But I am yet to see the output when I run it.
    It get stuck in a loop and I get the following error.

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at org.papervision3d.core.render.command::RenderTriangle/render()

    I am creating a simple cube and exporting it as cube.as.
    Please help me.
    Thanks
    Sathya

  67. After install problems, menu problems etc.. it’s not worth the hassle and it’s just easier to stick with the collada export tools that are the default in blender. :(

  68. thanks for short tutor!!! it’s very useful!

  69. I created a cone with a sphere on top, then i triangulated the mesh. I exported it and it worked fine . Then got it to work in flash. But the model was too small. So i went back to blender and enlarged it. But now when i export ANY item. I get ( public class Piece extends Mesh instead of public class Piece extends Shape3D implements Primitive3D ). Why wont it export as an extension of Shaped3D anymore.

  70. Ok i see whats happening. If you browse the location to save file after u choose ur class name and 3d type. The type keeps defaulting back to Away3d. Maybe a fix is needed. Blah…

  71. Fantastic tool.

    Has anyone come up with a way to get the coordinates of an exported blender-texture-map linked to the vertices/faces array in the AS3 export?

  72. When I try and export I get a error saying that I have no BPyMessages.

  73. Hey could you please update this so it works with the latest svn of Great White??

  74. I’m with Sam, just downloaded this exporter, and I have the newest version of Papervision from the SVN, is there going to be an update? Only errors I’m getting are about FreeCamera3d…

  75. Woops, I mean I’m with Jarrad, i’m not getting the error Sam is getting.

  76. The script runs fine on my mac but Flash bleats about a 5000 error when I load the class:

    5000: The class ‘Main’ must subclass ‘flash.display.MovieClip’ since it is linked to a library symbol of that type.

  77. The script runs fine on my mac but Flash bleats about a 5000 error when I load the class:

    5000: The class ‘Main’ must subclass ‘flash.display.MovieClip’ since it is linked to a library symbol of that type.

  78. There is another very easy way to find .blender folder by using TinkerTool, you can download here:
    http://www.bresink.eu/Downloads/TinkerTool.dmg

    I feel it is better than codes in Terminal as you can see the hierarchy of all the details.

  79. I’m getting the following error on the papervision 3D 2.0 example.

    1017: The definition of base class TriangleMesh3D was not found.
    public class BlenderTorus extends TriangleMesh3D {

  80. Hi all,
    The scripts needs a bit of updating. I’ll fix it soon.
    Thanks,
    Dennis

  81. I see that you’re updating, based on your message from a few weeks ago… any news? I’m getting “implicit coercion of a value…blah blah blah…” with your sample files and similar error with my own.

    Thanks!

  82. Dennis… latest version works great!!!

    As a complete novice here’s a key tip on using Dennis’ script… It just outputs the model, so importing into Sandy3D requires you to set up the scene and THEN include the model output from Dennis’ script… sounds obvious but there you go….

    Mac OSX Intel 2.46 blender python 2.5…

    Dennis your the man.

  83. Hey dennis,
    thanks for the script, unfortunately I can’t get it to work. Tried to export a simple cube. But the resulting AS file always extends Mesh3d. Even so I set it to triangle mode. Is there anything else I should pay attention to in Blender? Thanks.

  84. good post! thanks :)

  85. If you are still having trouble with the MacOSX then open up a terminal window and put this into it. “defaults write com.apple.Finder AppleShowAllFiles YES” this will show every file on your computer. Once you do this you can go to Applications/blender/blender.app/contents/macosx/.blender and then paste the AS3Eporter in there. You may have to click on Show Package Contents when you get to the blender.app part. Hope this helps.

    Oh and to hide your folders again paste this into the terminal window “defaults write com.apple.Finder AppleShowAllFiles NO”

  86. sorry at the end of the line. “Applications/blender/blender.app/contents/macosx/.blender” put “/scripts” and then place the file in the scripts folder.

  87. hi
    i have been having hassles getting your script to work on slightly more complex geometry made in blender, i am more familiar with the blender python api than i am with away3d, but not quite sure where the problem lies, basically some of my faces are missing on my model in my .swf, probably about 30% of them in random positions, any advice as to what might be causing this?

  88. i think i might know why, when i was ctrl+T-ing not all quads might have been converting to tri’s. will double check.

  89. yes that was it!! found ‘em

  90. apologies for posting so many comments. i have just briefly glanced at the script, i don’t think you added the uv’s in, is there a reason for this? i am not quite sure how away3d expects uv to be passed, but am goin to check it out. thanks for the cool script.

  91. ok i will not reply again until some kinda reply :>, i am wrong about above, it seems i must set uv faces first

  92. i guess i told a fib…. but it seems to be workin now, yay.

  93. Hi Dennis,

    great Work, I was successfully using your script on Window XP. Just great and beautiful class it created.
    However, when I turned to my Mac, I could not find the folder that supposed to be junk with the script :(

  94. I’m having an issue where I can’t seem to name my package or class. When I try to publish, it gives me an error, and I think it must be associated with the fact that I’m not giving a class name. what am I doing wrong?

  95. In PV2
    Any ideas why clone() doesn’t work
    In the example if you add

    var foo:DisplayObject3D = torus.clone();
    foo.x = 300;
    scene.addChild(foo);

    Fault, clone() at GeometryObject3D.as:190

    Clone works fine for collada, primitives but if any DO3D contains the AS3 exporter class?thing it gives the same error.

  96. I’m getting the following error in Flash 3.0. When I try to compile the simple cube.
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    The object was selected and triangulated. The Torus example works fine.
    If I remove one line of code from the BlenderTorus function such as: v(1.250000,0.000000,0.000000); I get the same error. Does this mean that the “as” is incomplete when it’s created?
    Has a solution been found for it yet?

  97. I am trying to install the script from above and in my blender directory there are no /scripts/ folders. Also no Application Data folder in my username’s documents and settings folders. Where do I place this python script to be recognized by blender’s export. I placed the file in the blender directory with the executable files for blender and it cannot find. Please advise where this file needs to go. It looks like it will be great, as soon as I can get it to display in Blender..!
    Thanks
    Shane

  98. There is a problem with your script and the latest version of sandy. When sand renders and exported model it comes out like a checkerboard with the texture in one tile and a white space in the adjacent. The whole texture is mapped mind you but there are just these white squares. I worked with both makc and ReeVee at flashsandy and they verified the problem. I made a model in 3dsmax and exported it to as and was able to render fine. You the thread at
    http://www.flashsandy.org/forum/viewtopic.php?f=5&t=993&st=0&sk=t&sd=a

    Thanks

  99. Forget about the above problem with sandy 3.0. It was solved by converting the mesh to triangles by going into edit mode and pressing contol t. Sorry for the false alarm.

  100. Hi, I’m using blender 2.46 compiled with python 2.5 allows the script to be installed no problem, and well as exporting the .as file without a hitch.

    The problem lies with the Away3D 2.2.0 release. I get countless errors with trying to compile the as, and even with the example file, it won’t run.

    I tried cleaning up the code to no longer return the errors, but I’m wondering if there’s a 2.2.0 workaround out there that allows this wonderful script to work properly.

    Basically if I can get the example file to run, I feel like I’ll be able to fix the exported .as file as well. Oh, and I was also wondering how the example away3D file has a material .as bundled as well, and if that was something that the script exported as well, becaus I’m just getting the single geometry .as exported from Blender. Any insight would be appreciated.

    Thanks!

  101. [...] Blog de l’auteur [...]

  102. can anyone help me? there is no error in my 3d scene but the texture can’t seem to work. all i have in the 3d scene is a white lines. i’m really sure that it is triangulated and selected.

    i’m using sandy 3.0, blender 2.46 and adobe cs3.

    thanks and more to you guys!

  103. [...] loading the model, I’ve used an export to actionscript with the custom exporter for Blender. (Away3d & Papervision export). So no time is spend on loading the model from the [...]

  104. Im sure that here i will get an answer, im tryng to export a simple animation from blender to flash, there´s some chance i can do that without retracing with this plugin…?

    Thanx…

  105. [...] thanks to Dennis Ippel whose creation of the AS3 Blender exporter made my creation of the XML Exporter and XML Papervision Primitive possible (or at least infinitely [...]

  106. [...] book about Papervision3D, has released a new Papervision3D XML exporter for Blender. He has used my Blender to ActionScript exporter script as a base for his [...]

  107. Hello. Awesome script. However, I am a newbie at papervision3d and can’t seem to get my exported object working. I’ve tried replacing everything in the example to fit my object, but nothing shows up. It’s not throwing any errors (not anymore).
    How would I go about NOT using that TorusTexture.png and simply use a solid color? That is my first main question. I’ve tried a few different things with no luck!
    I guess after that I will go from there.

  108. It seems like the exported AS files that DON’T work have a big list that looks like this:
    f(66,2430,2,null,0.000000,0.000020,1.000000,0.999992,0.000000,0.000030,-0.138575,0.985253,-0.100370); f(66,2429,3,null,0.000000,0.000020,1.000000,0.999990,0.000000,0.000030,0.473669,-0.806298,0.354290); f(2422,2426,3,null,0.000000,0.000010,1.000000,0.000010,0.000000,0.000030,-0.002614,0.999942,0.010443); f(3,2425,2422,null,0.000000,0.000030,1.000000,0.999990,0.000000,0.000010,-0.058320,-0.970770,0.232816); f(2280,2424,149,null,0.000000,0.000010,1.000000,0.999990,0.000000,0.999950,-0.642134,0.531650,-0.552279); f(149,2423,2280,null,0.000000,0.999950,1.000000,0.500084,0.000000,0.000010,0.464491,-0.578412,0.670588);

    And the ones that DO work (same object, but I ran the reduce poly script) look like this:
    f2(8,9,4030);
    f2(4032,7,4031);
    f2(7,8,4031);
    f2(4033,6,4032);
    f2(6,7,4032);
    f2(4,5,4033);
    f2(5,6,4033);

    I don’t know why one has a list of f2 and others have a complicated list of just f variables.

    All I know is the ones with just f variables don’t seem to work… I triangulated my object and everything… any help please?

  109. Ok I got it working fine, looks great. But is there a reason I can’t use ShadedMaterial on the object? PhongMaterial, ColorMaterial, etc works.. but nothing with a bitmap it seems.
    Is there a reason this doesn’t work?

    The ShadedMaterial I have works on regular objects like spheres and stuff, but not for my exported object :(

  110. Is there a way for Blender to add UV numbers without unwrapping the object? If I unwrap my object it looks like crap, but I can’t add textures to it unless I unwrap it because it uses f2() instead of f()
    How can I add a texture to an object without unwrapping it? That is what I need to know, thanks!

  111. [...] Andrea Boschini from Panurge Web Design was kind enough to change the exporter script so that it supports Away3D 2.2.0. Download it here. [...]

  112. Does this thing pump out the physics and material data into the model?

    part of the nice thing about Collada files is they do that…

    If not I don’t think this replaces the Collada file which houses a lot of really useful things about the model which papervision collada support also uses… (IE physics and material density)

    I’m new to Away3D… I’m excited to try it out and I love blender so I’ll of course be checking this out as well….

  113. I think I just figured out the real glory in this method… in theory… it is that you can adjust the models in code while developing your site… this would give you the ability to trouble shoot your texture mapping vs number of triangles on the surface you are mapping to within Flash as opposed to having to back track in your workflow to another application. Which could be nice… or not… depending on how you like to work… I imagine programmers will like this while designers will not care as their comfort zones in work flow are naturally balanced in their own ways…

  114. could you make a zip file of this available?

  115. [...] Export Blender objects to PaperVision3D, Away3D and Sandy: http://www.rozengain.com/blog/2008/01/02/export-your-blender-objects-straight-to-away3d-papervision3… [...]

  116. [...] – a powerful free alternative to 3D Studio Max and Maya. Plug-ins are available to export directly to PaperVision3D and Away3d – [...]

  117. I’m trying to build this with the FlashDevelop IDE and I’m having more success with the collada plugin. Seriously, I can’t see how the texture is mapped. Plus I’m getting plenty compile errors. I’ve tried the Flash IDE and that’s not much better…

  118. Hi Murray,
    What engine are you using? What errors do you get?

  119. [...] ねこ(?)が揺れてるだけです。 ActionScript 3.0 Exporterを使用して、モデルの頂点情報をasファイルで出力しています。 [...]

  120. This is awesome! I got it to work, but I had to tinker with it a bit. I did a test with a rotating cone I created in Blender, but it only exported the AS3 class for the cone, not for the animation or for the material. I called the class ‘myCone’, and put ‘myCone’ in as the class for the flash file. It gave me the error ‘The class ‘myCone’ must subclass ‘flash.display.MovieClip’ since it is linked to a library symbol of that type’. I realized it only exported the AS3 class for the model. I had to use your example Main.as file, set the document class as Main, then use Main to do the animation.

    So, does this script only export geometry, and you have to write your own animation/texture scripts? Or should I have gotten the Main script that described the animation as well? Or, do you have to do a separate export for that? Thanks for any help you can provide, and thank you so much for making this!

  121. Hi there, just wondering if there was a solution to the ‘cannot access a property or method of null object reference’ error. Have tried like other posts to export a basic cube but is not working. Have converted to triangles, also the torus .as file works. Have read all of the above posts and hopefully didn’t miss the info I’m looking for… Any help would be greatly appreciated. Thanks.

  122. Hey Dennis, I’ve downloaded Blender 2.48 and had a slight problem with locating the scripts folder. It no longer exists :) So what you have to do to make it workig is go to User Prefences and Click on File Paths and look for Python Scripts Section. Add a new folder there ( create it first whereever you want ) and click Select Script Path. After that click on the litle icon where the path appears which is Re-evaluate the Scripts registration in Menus and that will add the script to Export scripts in Export menu. Now the only thing you have to do to avoid adding the script every single time you run Blender is choose from File -> Save Default Settings. That should do the work! Cheers Tom

  123. [...] is actually yet another way to get your 3d models from Blender. Dennis Ippel has developed a Blender to Actionscript 3.0 Exporter. (it’s very [...]

  124. Hey!

    Is there anyway we can use this to convert a normal .dae file (exported from 3dsMax), to AS3?

    Cheers,
    Andre

  125. [...] data. File sizes were big as well and unacceptable for a banner. I overcame that problem by writing a plugin for the Blender 3D creation suite that created ActionScript 3.0 class files that contained all the [...]

  126. [...] is an AS3 object exporter for Blender3D written by Dennis Ippel that can be download here. With this plugin, I can export some noob 3d models I did to Flash [...]

  127. I tried it with away3d, but no texture,..

  128. hay, i’ve bin hitting the same problem as Steve,

    5000: The class ‘Monkey’ must subclass ‘flash.display.MovieClip’ since it is linked to a library symbol of that type.

    Receiving this error, Papervision 2.0, Blender 2.5

    whats up??

  129. Hi! jus wondering that it doesnt export animation info… and I dont know any coding for bender… but I want to know how difficult could be on blender read each vertex position on each keyframe and the add that info to the .as file for each keyframe whith a name prefix and a consecutive number.

  130. @Flamander: this is possible, and will be part of the exporter soon

  131. it says 10-08-2006 there, probably should have been 10-06-2008

  132. Hi.
    Isn’t there any COMPLETE tutorial?

  133. For macusers, here’ s an another handy way to put into .scripts hidden file in blender.app : Tinkertool -> “Show hidden files” and you’ ll see the no-more-hidden .scripts file !o)

    this worked great for me.

    thx yondertoy

  134. [...] the latest version here. Tags: 3D, Blender, exporter, modifiers, Python, quads, [...]

  135. Hi.
    I made a plane in blender, then in edit mode I pressed ctrl+t, then I exported it. the result is:

    package {
    import away3d.core.base.Face;
    import away3d.core.base.Mesh;
    import away3d.core.base.UV;
    import away3d.core.base.Vertex;
    import away3d.core.utils.Init;

    public class MyPlane extends Mesh {
    private var ve:Array;
    private var fa:Array;

    public function MyPlane(init:Object = null) {
    super( init );
    init = Init.parse(init);
    ve = [];
    v(1.000000,0.000000,1.000000);
    v(1.000000,-0.000000,-1.000000);
    v(-1.000000,-0.000000,-1.000000);
    v(-1.000000,0.000000,1.000000);

    f2(0,3,2);
    f2(0,2,1);

    this.x = 0.000000;
    this.y = 0.000000;
    this.z = 0.000000;

    this.rotationX = 89.999996;
    this.rotationY = -0.000000;
    this.rotationZ = -0.000000;

    this.scaleX = 1.000000;

    this.scaleY = 1.000000;

    this.scaleZ = 1.000000;
    }
    public function v(x:Number, y:Number, z:Number):void {
    ve.push(new Vertex(x, y, z));
    }

    public function f(vertexIndex1:int, vertexIndex2:int, vertexIndex3:int, uv00:Number, uv01:Number, uv10:Number, uv11:Number, uv20:Number, uv21:Number, normalx:Number, normaly:Number, normalz:Number):void {
    var face:Face = new Face( ve[vertexIndex1], ve[vertexIndex2], ve[vertexIndex3], null, new UV(uv00, uv01), new UV(uv10, uv11), new UV(uv20, uv21) );
    addFace(face);
    }

    public function f2(vertexIndex1:int, vertexIndex2:int, vertexIndex3:int):void {
    addFace( new Face(ve[vertexIndex1], ve[vertexIndex2], ve[vertexIndex3]) );
    }

    }
    }

    I named it “MyPlane.as”. I created a new fla file and set Document Class “MyPlane” and saved it alongside the as file. When I test the movie all I get is this error:
    5000: The class ‘MyPlane’ must subclass ‘flash.display.MovieClip’ since it is linked to a library symbol of that type.

    Windows XP sp2
    Flash CS3
    Away3D 2.3.3
    Blender 2.48a

    What is wrong?

  136. Hi open the blender 2.48a, Add->Mesh->UVsphere,then File->Export as3,but when I use this as3 file,it complains,
    TypeError: Error #1009:
    at org.papervision3d.materials::BitmapMaterial/transformUVRT()[H:\proj\papervision3d\src\org\papervision3d\materials\BitmapMaterial.as:244]
    at org.papervision3d.materials::BitmapMaterial/drawTriangle()[H:\proj\papervision3d\src\org\papervision3d\materials\BitmapMaterial.as:116]
    at org.papervision3d.materials::MovieMaterial/drawTriangle()[H:\proj\papervision3d\src\org\papervision3d\materials\MovieMaterial.as:181]
    at org.papervision3d.core.render.command::RenderTriangle/render()[H:\proj\papervision3d\src\org\papervision3d\core\render\command\RenderTriangle.as:78]
    at org.papervision3d.render::BasicRenderEngine/doRender()[H:\proj\papervision3d\src\org\papervision3d\render\BasicRenderEngine.as:256]
    at org.papervision3d.render::BasicRenderEngine/renderScene()[H:\proj\papervision3d\src\org\papervision3d\render\BasicRenderEngine.as:168]

    But when I use the example from this page,it run very well, I don’t know what is wrong.

  137. @expose: I’ll investigate this asap
    @zjuyyl: did you triangulate your mesh (ctrl+t)?

  138. Thanks

  139. [...] but when I get around to cracking open Blender and get a few of my own models and textures exported to .as my I can probably motivate myself to do some more experiments with [...]

  140. Im a newbie at this 3D engine stuff, ive gone thru loads of tuts and not getting anywhere. Im using Away3d with Flash cs4. Downloaded the Away3d example from this site. And i cant get it to publish. I get compiler reports.

    1149: The return statement cannot be used in static initialization code.
    1149: The return statement cannot be used in static initialization code.
    1149: The return statement cannot be used in static initialization code.
    1084: Syntax error: expecting identifier before lessthan.
    1084: Syntax error: expecting identifier before lessthan.
    1084: Syntax error: expecting identifier before lessthan.
    1084: Syntax error: expecting identifier before lessthan.
    1084: Syntax error: expecting rightparen before private.
    1084: Syntax error: expecting identifier before lessthan.
    1084: Syntax error: expecting identifier before lessthan.

    Can someone please help!!!

  141. does it function with character animation or simple animations?

  142. [...] car physic model require to set it seperately. As you can see I have no time to set it textured. Here you can get a nice exporter to Away3D, Papervision3D and Sandy 3.0. Car physic has many [...]

  143. I used version 0.3 to export one of my models from Blender to the AS3 format for Sandy3D 3.1. I work in Maya, so I first had to export my model as an .obj file and then import it into Blender. Once in Blender I ran the Action Script Exporter and made an .AS file for Sandy3D. When I set up the AS3 file in Flash using Sandy3D and tested my movie, I noticed an issue with, what I believe is, the normals. With BackFaceCulling On, I can only see a few faces of my object. With BackFaceCulling Off, I can see the whole object but the material isn’t displaying correctly on the faces that have the normal issue. Any suggestions or solutions would be great. Thanks!

  144. Hi Dennis,

    Papervision 2.0, Great White and
    Have been using your exporter for a while now but just started to try and put some interactiveScene3DEvents onto its material (which is set to interactive = true along with the viewport) and Flash does not like it.

    Do you think this has something to do with the way materials might be applied to every face of the object similar to a .dae model and therefore do you think I would need to apply an event listener to every face of the object either in the as3 class file which is exported from Blender or from my main class through which I am referencing the as3 3D model object class?

    What do you think?

    Thanks!

  145. [...] Link: http://www.rozengain.com/blog/2008/01/02/export-your-blender-objects-straight-to-away3d-papervision3… [...]

  146. How can I contribute a fix to Away3D code generation?

  147. transformUVRT() is dying because the RenderTriangle has no texture UV coordinates.

    i trace this to the fact that my object is built using the f2() method, rather than
    the f() method as in your working example. the f2() method does not take texture
    UV coordinates as arguments.

  148. Hi Philippe,
    If you have a fix you can send it to me. You can find my email address in the sidebar.
    Thanks,
    Dennis

  149. any chance you could add export for the Alternativa3D engine as well as Sandy etc.
    - otherwise it looks like I’ll have to try to learn Python (as well as Blender) to adapt your script :-)

    many thanks if someone in the community has the knowledge to add compatability with this new 3D engine

    .. mattt ..

  150. when I first tried to run the .as file in flash i got:

    5001: The name of package ‘test’ does not reflect the location of this file. Please change the package definition’s name inside this file, or move the file. C:\Adobe CS4\Master Collection\Adobe CS4\flash project\HEAD_9.as

    I tried removing the package name and got:

    1017: The definition of base class Mesh was not found.
    5000: The class ‘HEAD_9′ must subclass ‘flash.display.MovieClip’ since it is linked to a library symbol of that type.

    here is the original .as file after exporting from blender

    package test {
    import away3d.core.*;
    import away3d.core.mesh.*;
    import away3d.core.material.*;
    import away3d.core.utils.*;

    public class HEAD_9 extends Mesh {
    private var ve:Array;
    private var fa:Array;

    public function HEAD_9(init:Object = null) {
    super( init );
    init = Init.parse(init);
    ve = [];

    *then like 300 lines of calls to function v and 300 calls to f2

    this.x = 0.606351;
    this.y = 6.550067;
    this.z = 2.273537;

    this.rotationX = 0.000000;
    this.rotationY = 0.000000;
    this.rotationZ = -0.000000;

    this.scaleXYZ(1.000000, 1.000000, 1.000000);
    }
    public function v(x:Number, y:Number, z:Number):void {
    ve.push(new Vertex(x, y, z));
    }

    public function f(vertexIndex1:int, vertexIndex2:int, vertexIndex3:int, uv00:Number, uv01:Number, uv10:Number, uv11:Number, uv20:Number, uv21:Number, normalx:Number, normaly:Number, normalz:Number):void {
    var face:Face = new Face( ve[vertexIndex1], ve[vertexIndex2], ve[vertexIndex3], null, new UV(uv00, uv01), new UV(uv10, uv11), new UV(uv20, uv21) );
    addFace(face);
    }

    public function f2(vertexIndex1:int, vertexIndex2:int, vertexIndex3:int):void {
    addFace( new Face(ve[vertexIndex1], ve[vertexIndex2], ve[vertexIndex3]) );
    }

    }
    }

    I only have like 3 hours of experience with flash/away3d and have never used blender, someone else exported it from blender I think they triangulated it but I cannot be sure.

  151. [...] Sandy 3D can import the Collada format that Blender exports. But there is also an easier way. A Python script for Blender allows you to export models straight to ActionScript code. However, as you will see in this post, it’s not as straightforward as it [...]

  152. I was getting a python error when trying to export. Turns out the zip may be missing AS3Export.png

    Just make any png file, name it AS3Export.png and put it in the same folder as AS3Export.py

    This is a great plugin thanks.

  153. @db82: thanks for the tip, i also got the python error . btw great plugin !

  154. Hi Denis

    Thanks for the exporter, but I would really appreciate it if you could shed some light on the 5001 error:

    5001: The name of package ‘sp99′ does not reflect the location of this file. Please change the package definition’s name inside this file, or move the file. /sp99/sp99.as

  155. Hi,
    I have been getting an error message when I try to export. It’s saying it’s line 677 in draw logoImage = Image.Load(Get<’scriptsdir’)+’AS3Export.png’) IOError:couldn’t load image .
    I just installed Blender 2.49 and python v 2.6.2. Does it only work with older versions?
    Thanks for creating this!

  156. @Gareth and anyone else with package error. place the “.as” file in a folder named “sp99″ (for example) or whatever name matches the packages name (in Sean’s case: “test” should be the folder’s name). then places this folder in your project’s src directory (if your using Flash Develop). add an “import .;” (eg: “import test.HEAD_9;”). now try and compile again. HTH

  157. sorry the one example didn’t come out right. it should be: “import your_package_name_here.your_classname_here;”. the file name should be the same as the main class name (as stated in this example). The file should already have the correct name from the export (it will be named after your blender mesh). HTH

  158. Excellent script, just testing blender and this script for 3 hours now and it workd correctly, using papervision 2.0 and blender 2.49a. the objects generated accept lights which is really cool.

  159. Ok I did finally see the comment about dropping a .png file named AS3Export.png into the scripts folder. Did the trick. Now I just can’t seem to get a texture on a cube (using Away3d). I did triangulate the box in Blender before exporting.

  160. @Elizabeth: I forgot to zip up the logo png file. The zip file has been updated and the script is working again :-)
    Cheers,
    Dennis

  161. Hi Dennis,
    Thanks for the great script. One question though, will the exporter eventually support multiple materials on an object?

  162. Hi, I’ve been testing the converter using papervision, I’ve built a rounded rectangle the shape is exported correctly but i have a small problem with the materials I need to set them to doubleside(oneSide = false), looks like sometimes they look into the center of the object than the external shape, also this seems to be affecting when using lights, is there anything to do with about this, Thanks.

  163. Please let us know where we can download AS3 Geom Class Exporter…
    the dreammania site does seem to work right now.. and I am in urgent need..
    Please

  164. I’ve been using your “BlenderExportAway3D” example with away3d(2_4_0 for flash player 9) and Flex.
    It turns out, it does not work in Flex, only showing a white torus without any texture.

  165. Away3DLite was just released a few days ago. How soon can we expect your exporter to support it?

  166. I manged to get the Taurus example to work after
    (1) commenting out the line
    this.scaleXYZ(50.000000, 50.000000, 50.000000);
    In BlenderTorus.as in the constructer of the class BlenderTorus
    as i caused the following error
    1061: Call to a possibly undefined method scaleXYZ through a reference with static type BlenderTorus.
    The image was tiny so I changed the line 26 in Main.as to
    sphere.scale(25);
    It then worked fine.
    I then took a look at the Blender file and noticed that there was no image of the unwrapped taurus. The wire view consisted a rectangles and as you have to convert to triangles before exporting to Away3D do yo have to do this before the image is unwrapped?

  167. [...] to update the Blender to ActionScript exporter! The updated script can be found on the usual page here. It’s good to be productive again. That wasn’t easy after 4 weeks in the Netherlands [...]

  168. I’ve got the similar error that occurred at the Steve, Rob Brough and Lei.
    I’m using a Dutch version of Flash CS3, so the error is in Dutch i’m affraid.

    5000: Klasse ‘woning2′ moet een subklasse zijn van ‘flash.display.MovieClip’ omdat deze is gekoppeld aan een bibliotheeksymbool van dat type.

    It’s probably a simple fix (I think:P) but i’m new to AS3.

    How can this be fixed?

    Thanks in advance

  169. Hi Jochem,
    The Dutch error message is no problem for me, die begrijp ik wel :-)
    What 3D engine are you using?
    Thanks,
    Dennis

  170. Hi Dennis,

    I’m using away3D 2.4.0.

    I hope you can help me, because i’m getting a bit annoyed by the error:P.

    Thanks,

    Jochem

  171. Hi Jochem,
    Is it possible to send me your files? Then I’ll take a look at it.
    You can find my email address on the right hand site.
    Thanks,
    Dennis

  172. God bless your generous soul!! I expected this update to take a while, instead its available within a week since of my request. Thanks again.

  173. Hi there,

    I can see this being a very handy tool for me, but right now I cannot get it to work. I can get the supplied torus demo working, no problems, but I can’t figure out how to change that to use the .as classes that I have exported from blender. The link to the tutorial above does not seem to work any more either.

    Are there any more detailed explanations anywhere?

  174. I am having pretty much the same problem Mark is having. I can export the blender torus file to .as in Sandy, away3d, and Papervision format. I can get it working when I rename the generated .as file from BlenderTorus.asTorus.as to BlenderTorus.as.

    In the .as file, where it has “public class Torus extends Shape3D implements Primitive3D {” I change Torus to BlenderTorus. When I compile in the flash ide (cs4) It runs.

    However, when I do the same thing with my own Torus or cube (I edit both of these and press control-T), I always come back with the same output:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at sandy.materials::BitmapMaterial/renderPolygon()
    at sandy.core.data::Polygon/display()
    at sandy.core.scenegraph::Shape3D/display()
    at sandy.core::Renderer/renderDisplayList()
    at sandy.core::Scene3D/render()
    at Main/animate()

    Thanks for any help you can provide.

  175. I am using Flash cs4, as3 flash 10, Python26, Blender release_249, and Sandy3-1-1_src_rev1008

  176. [...] Alternative : Away 3D, Sandy Addons : Blender to AS3 export [...]

  177. upon further testing. I can export the original Torus file and run that correctly but only half the time can I export my own torus and run that. Exporting a cube never seems to work.

  178. @Matt: can you send me your files?
    Cheers,
    Dennis

  179. [...] and use this application to create the .pat file. Blender – Free open source 3D software Blender AS3 expoter plugin – This plugin allows you to export 3D models as AS3 classes. This works with Papervision, [...]

  180. Help! I’m on a short timeframe for a project… I thought I would be able to export .as for both the model and textures like your torus example… I’m able to export my model, but nothing exports for the textures! I selected the box “export all scene objects” just in case, but that didn’t help either.

    Please help… basically, my object consists of 8 faces, and each face has a an image on it.

  181. @solarnoise: that’s right, you need to export the textures separately. Download one of the sample .fla files and you’ll see how that’s done.

  182. Thank you Dennis, but I’m not sure how I would export the textures separately… in Object mode I can only select the whole model, so how do I go about exporting the texture .as?

    Basically I’m just trying to find a way to not have to texture my models through away3d, as that takes a lot of time and guess work. I’d like to just texture them in Blender and have them show up that way in my project =)

  183. Ah, I finally figured out… I’m so new to 3D Modeling and UV mapping that it didn’t occur to me..

    I realized that the exporter also includes the UV maps!! So I just import my bitmap as the material in away3d and it already knows where to apply the images.

  184. Brillant :) Thanks!

  185. Great Work :)

  186. Thank you Dennis, but I’m not sure how I would export the textures separately… in Object mode I can only select the whole model, so how do I go about exporting the texture .as?

  187. [...] Download the new version here! Tags: 3D, ActionScript, Blender, haxe, sandy [...]

  188. [...] 公式では、 First make sure that the Blender object satisfies the following preconditions: [...]

  189. I want to thank you for your great job.
    It is the easiest way to export from blender to away3d.

    I have a small problem. Whenever i export from blender into away3d faces flip backwards. the only solution i can do is scale them by -1. but not ure whether it is the best solution.

    Is it possible to change some vertex points in away3d exporter.

    Thank you in advance.

  190. This looks great!

    I’ve got a snag though. I’m getting a lot of “No such file” errors, such as:

    IOError: [Errno 2] No such file or directory: ‘/Applications/blender-2.49a-OSX-10.4-py2.3-intel/blender.app/Contents/MacOS/.blender/scripts/AS3Export/AS3ExpAway3D.as’

    The file does exist though. Is this some sort of permissions issue? Any tips would be much appreciated.

  191. Oops, nevermind. I put the whole AS3Export folder in the scripts folder, instead of extracting its contents to the scripts folder. Disregard that last comment.

  192. i have been trying to install “AS3Export” in to the hidden blender.app folder.i found the folder..
    f you navigate to the /Applications/blender/blender.app/Contents/MacOS/

    but no .blender folder because it is an exec file… i also tried terminal not found so I have still not managed to add AS3Export, and AS3Export.py in to the application.

    /Applications/blender/blender.app/Contents/MacOS/.blender/scripts/
    please help

  193. Mac OSX 10.5.8
    Blender 2.49b
    Python 6

    I go to Export > ActionScript 3.0 class (.as)…

    But I get a generic “Python script error : check console”

    Any ideas?

  194. Dennis, your work is great! May I ask you a questtion here?
    Does the blender to actionscript exporter support animation yet?
    I’m wondering When it would be available along with COLLADA to actionscript exporter.
    Thanks in advance. :)

  195. Hi. First, thanks for your work on this script.
    Unfortunately, I always have the same python error in the console:

    File “/Volumes/oui/Applications/3D/Blender/scripts/AS3Export/AS3Export.py”, line 423, in draw
    logoImage = Image.Load(Get(‘scriptsdir’)+sys.sep+’AS3Export’+sys.sep+’AS3Export.png’)
    IOError: couldn’t load image

    I tried, as Elisabeth said to move the png in different places, but the error remains.
    Mac OS X 10.5.8, Blender 2.49a, Python 2.5.1

    Thanks for any help.

  196. [...] exporter. Away3D Lite 1.02. has been added to the list. Download it from the usual place here. Tags: 3D, [...]

  197. [...] it’s already compiled into actionscript and available immediately. We used great blender plugin AS3 Blender Exporter to export 3D models as plain actionscript [...]

  198. Ok, I`m trying to use this exporter with FlashDevelop and Away3D for some time, still no success. It seems to missing some Away3D packages – like no ScaleXYZ function. Like examples – they work with CS4, but I can`t run them with flashdevelop. And I run out of ideas how to make it work… Best regards.

  199. @Karwoch

    In the last version of Away the packages and class hava changed a little bite, In the as class exported from Blender you should try to remplace :

    import away3d.core.mesh.*;
    and import away3d.core.material.*;

    to :
    import away3d.core.base.*;

    ScaleXYZ to scaleX, scaleY and scaleZ

    may be it could be changed in the .py ?

  200. finaly don’t take about what i said before, there is an “away3D 2.2 2.3 2.4 3.4″ in the menu of the py export… I didn’t saw it :)

  201. 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?

  202. this plug don’t support bones animation!!!!

  203. hope bones animation supporting

  204. 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!

  205. 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!

  206. [...] Need the AS3 export plugin. [...]

  207. [...] Blender to AS3 (Away3D) Mod Filed under: 3D, AS3.0, Away3D, Blender 3D, Flash — delfeld @ 9:25 pm Tags: Actionscript, Actionscript 3.0, AS3.0, Away3D, Blender to AS3 export, flash, FlashDevelop First, here is the original script for exporting to AS3: http://www.rozengain.com/blog/2008/01/02/export-your-blender-objects-straight-to-away3d-papervision3… [...]

  208. Hey there, wondering if we can port this to Javascript. Should be a simple jump: http://gyu.que.jp/jscloth/miku.html, if you look at the source you will see he encodes his models in a metadata.js file: http://www.d4.dion.ne.jp/~uym/tmp/miku_meshdata.js.

  209. @Matt: there is a Blender to WebGL exporter. You can use the same data for 2D Canvas drawing stuff: http://www.rozengain.com/blog/2010/03/19/blender-to-webgl-animation/

  210. [...] FYI: GTA = Grand Theft Auto Rozengain’s Blog (Anyone designing games in Flash?) http://www.rozengain.com/blog/2008/01/02/export-your-blender-objects-straight-to-away3d-papervision3… FYI: This script allows you to export to ActionScript 3.0 from Blender!!! Note: Papervision3D [...]

  211. 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

  212. 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!

  213. 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?

  214. 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?

  215. [...] 今天从http://www.rozengain.com/blog/上看到两个flash3d模型导入工具。Blender to ActionScript Exporter和Collada to ActionScript 3.0 exporter。 Blender to ActionScript Exporter支持Blender模型,不过对Blender不了解。 [...]

  216. 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

  217. 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

  218. 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?

  219. Yodam
    hmm
    public class Cube extend Movieclip ?

  220. 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.

  221. [...] should be bugged as well, as I wrote the last time, with faulty animation. And while there’s tons of options for exporting Blender models into PV3D, none seems to include [...]

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

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

    Cheers!

  224. I also need a install procedure vor blender 2.54

  225. “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. :-/

  226. 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!

  227. 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.

  228. [...] Even when using the Away3D community’s recommended tools on Rozengain.com for the Blender to Actionscript Exporter and the COLLADA to ActionScript Exporter I was unsuccessful. What I had to resort to doing was [...]

  229. 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 .

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

  231. 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()

  232. bon et bien se site ne vie pas personne je vais voir ailleurs :(

  233. 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.

  234. Hi Ron, I’ve already looked at the API changes but I just need some time to do it :-)

  235. I look forward to it.

  236. I’m also looking forward to this. Thanks

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

  238. 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!

  239. there is much more stuff to (manually adapt) with new version of away3d.

    i will blog on this as video tutorial ASAP.

    http://dwaver.wordpress.com

  240. [...] should be bugged as well, as I wrote the last time, with faulty animation. And while there’s tons of options for exporting Blender models into PV3D, none seems to include [...]

  241. 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.

  242. [...] there is another way to do this using the application Blender and a plugin for exporting models as AS3 classes. But I couldn’t get it to work. :-( Tags: Away3D, Away3D 101 [...]

  243. I could’t find /.blender ( window7 )

  244. 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?)

  245. Is there an updated version for Snow Leopard and Blender 2.57?

    I’ve tried this and it’s not showing up.

  246. http://winxalex.blogspot.com/2011/10/collada-dae-to-proscenium-actionscript.html

  247. 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

  248. excellent stuff =) definitely enjoyed this article, i’m going to read more on the blog after im finished with work! ;)

  249. [...] coordinates unleashing the possibility of creating some complex models. The script can be found here This entry was posted in Game Development by os. Bookmark the [...]

Leave a comment