Archive | May, 2013

Away3D 4 Basics

12 Mar

Away3D 4 Basics

Finally taking the time to update the tutorials over at Flashmagazine to cover the Away3D 4 Beta that was released a few weeks ago. It's more than 40 code examples mixed into the 12 tutorials so it'll take some time to get through it all. It's mighty fun though and I'm really happy with the speed I'm seeing on both desktop and devices!

I've had a couple requests recently for how to do just a very basic 3D scene using Away3D v4, so here it is in case others need it too. It's just a cube that you can spin with either the mouse or keyboard, but it shows off quite a few of the differences in how to do things in v4. Materials, meshes, lights - there's differences for many core things. I'll summarize all these changes as I go through the code examples.

Away3D interactive MovieMaterial issue

16 Jun

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.

Away3D training - across the world

22 Apr

My friend Rob Bateman is setting up Away3D workshops all over the world these days - Sao Paulo, Buenos Aries, Sydney and London. If you’ve been thinking about getting into 3D in Flash, I highly recommending attending one of these workshops. They’ll teach you all you need to get started.

Rob is also the lead developer of Away3D and has done lots of workshops on it so he is certainly the one to learn from. Read more on the Away3D Blog.

a3d_training.jpg

Realtime 3D on the web - a toy or a useful tool?

22 May

A little late, but here’s the slides from my presentation at the FlashForum Konference in Cologne. In the session, I discussed 3D on the web and what it’s good for. I started with a historical overview for we’ve had 3D on the web for a long time already. It’s never been a success though and I highlighted some possible reasons as well as why Flash changes this. I also tried to draw up some rules for what constitutes “good use of 3D on the web”. Is showed no code at all in the presentation and the slides don’t give away all I said, but you’ll get the idea.

PDF of presentation

I’ve done lots of presentations before, but this was the first time I presented at an international conference in English. I was super-nervous but the session went really well and I got some good feedback. It kind of surprised me how little feedback you get initially. Just a few mentions on Twitter that said my session was “nice” - not all that encouraging. Later I got the feedback from the Feedback forms as well as blog articles such as this one that said “Fantastischer Vortrag und super Redner”. Really strange to not just give feedback like I usually do on Flashmagazine, but also receive it! :D

jensaAtFfk09.jpg
Photo by Marc Thiele/FFK

The day before the conference, I also did a full-day Away3D workshop. Renowned community expert Peter Elst was there and I’m glad he enjoyed it! I also did two reports from the event for Flashmagazine.

I have to congratulate Marc and Sascha - they really know how to pull off such an event! The mood was excellent. 500 attendees, 28 sessions, 10 workshops and not a glitch. Pretty neat and all served at a fraction of the cost of other conferences? Pretty impressive if you ask me! I had a great time!