While on the topic of 3D - we just launched a new version of away3d.com!. I did the ExpressionEngine part of it, Richard handled the JS/CSS and Alejandro got all the old content into the new site plus a bunch of other things. He also has the role of webmaster for the site.

Great fun to do another EE site and my first time working with the Forum module. Skinning that thing is ... quite a job. It took me about two days to get all the skinning right and it’s far from as easy to work with as EE in general. We also needed a custom field to go with all forum posts (to enable filtering) and adding that wasn’t exactly easy either as the classes are not really written to be extended like that. I ended up extending the base class and overriding the relevant methods. The resulting file contains quite a bit of copied code, but it should be fairly easy to maintain.

It has been a busy winter/spring, but I’ll get back to that very soon. Just thought I’d post a quick solution to an Away3D issue that bit me recently and finding the bug took forever. The problem was in an Away3D FlipBook project where I used the excellent AS3DMod made by Bartek. It’s a fairly complex project featuring video, zoomable images and much more and it also has some clever coding to ensure that it never tries to load more pages than it needs at any given time and it’s all configured via XML. But - on to the problem:

I was tasked with adding a dynamic Table of Contents to the Book. No problem I thought - all the pages are using the MovieMaterial so I’ll just generate a MovieClip or Sprite that has the TOC and then I’ll Jump to pages based on that. The problem was - no matter what I did, I couldn’t get the MouseEvents in the MovieMaterial to trigger as it should. In fact - there was no MouseEvents being triggered at all. I spent almost a whole day fiddling around with it with no result. I searched the Google Group for answers, but all the threads that looked like they had a similar problem/bug were unanswered.

After a lot of testing and failing, I realized that there actually wasn’t any interactive layer present in the View, despite the material being set to interactive = true. My buddy Alejandro suggested that I change the blendmode for the _interactiveLayer in View3D to see what was going on and this really put me onto it. The _interactiveLayer is a transparent layer in View3D that holds the Movieclip that you use as material (the material itself uses a bitmap for display). When you’re clicking in the view, you are actually clicking on this transparent movieclip that the engine cleverly overlays and moves around so it will look as if you’re clicking the 3D object.

By changing _interactiveLayer.blendMode to BlendMode.ADD, I could see the layer and start realizing when it was active or not. Then it struck me - there is no mechanism in Away3D that notifies a material that is has been moved from one Mesh to another! I was swapping materials a lot and as soon as I did the first swap, the interactive material failed. All I had to do was to make sure that the MovieClip used in the material was removed from the _interactiveLayer and then it would be reset.

So - be careful when you swap MovieMaterials in Away3D. If you loose interactivity, change the BlendMode of the _interactiveLayer to debug and make sure that you reset the movieClip by moving it to a different location in the DisplayList. I hope this post can help someone in the same situation!

oh, and by the way - using the latest AS3DMod with Away3D 3.6 seems to have a bug as well. I couldn’t pinpoint it, but if you’re using AS3DMod and seeing performance problems, try downgrading to Away3D 3.5. It solved the problem for me.

Flashgamer is the blog of freelance developer Jens Chr Brynildsen. Jens created applications and games for more than 20 years. He is now focused on Embedded systems and hardware development. If you need a freelancer with solid skills, get in touch.

Featured Posts

This blog's been a litte dead the last year as I've been head deep in two big projects in addition to teaching more than before at Westerdals ACT. I'm not dead and I'm having a blast!
I'm doing exactly what I want at the moment and I feel that I'm creating really good ...

About a year ago, Adafruit launched the FONA. It's a neat little breakout board that packs all the features you'd want in a phone such as Calling, SMS, Data and Lipo battery operation and charging. Add to that a good API that is easy to extend and we have a winner.
By itself, the module ...

Up until now I've had two 3D printers. My first one was the Ultimaker Original and it now has more than 4000 hours of printing behind it. An incredibly solid machine! The next printer was the Printerbot Jr that my son put together. I haven't seen much of it as he's more or less ...

Every now and then there's a project you can't say no to and this was one of them. Finn.no is sort of Norway's version of Craigslist, a big online market where you can sell just about anything. As a marketing stunt, they opened a physical store downtown Oslo. I was called in via some ...

I just came back from the most challenging physical computing project I've ever done. It's a 13 by 8 meter labyrinth where you walk in the dark and get a sensory experience based on more than 300 sensors. The main challenge was actually how much time it took to execute it, but it was such a ...

I recenty did a really fun game for my friends at Last Friday in Stavanger. The game itself was a typical fly-in-space-and-shoot-asteroids-type of game. A simple, but easy to understand concept. However - what was special was how you controlled the game and the size of the screen!
The ...

After playing with my friend Jim's Makerbot for some time, I realized that I simply had to have one of these. However - having a moving build platform really limits the speed and usefulness. I researched what machines were available and they all had similar limitations. Either they were too ...

Once in a while there comes along a project where you get to play with loads of fun things. This project was exactly that. Rock City Namsos is a brand new cultural building in the city of Namsos. It contains a movie theatre, a concert hall, a resource hub for professional music, a super-sweet ...