Last week we released a new Floorplanner account, the Enterprise account. With it, companies can have an online Floorplanner solution completely branded to their wishes. It includes the Roomplanner module and a custom library of their own furniture elements. Steelcase and Maxon are the first to have an active Enterprise account.

The interesting part of this release, from a tech point of view, is the new drag-and-drop functionality. The Roomplanner is running in the Flash Player. However, the library of furniture elements is in HTML. We chose to build the furniture library in the HTML sidebar for a couple of reasons. It’s not in the Roomplanner, so there is more space left to design. It gives us more freedom in the page layout. All items on the page are indexed and things like sorting and tags we’re easier to build in Ruby on Rails than in Flash.
Now we only needed a way to get the furniture from the sidebar to the Roomplanner. That’s where the drag’n'drop comes in, drag from HTML and drop in Flash. To drag an image of a furniture element in HTML we used the fantastic JavaScript script.aculo.us framework. The next step was to swap the image to an element in the Roomplanner and to update the position of the element while moving the cursor on the Flash content. For this we used ExternalInterface to communicate between JavaScript and ActionScript. That’s all there is to it. The theory is actually quite simple, but in practice it was very (I repeat, VERY) difficult to get it working in all the main browsers. All those nitty gritty browser details…
At this moment everything seems to work just fine, so please take a look at Steelcase and/or Maxon and let me know what you think!
Tags: drag, drop, externalinterface, Flash, html, Javascript, script.aculo.us



November 19th, 2008 at 7:25 am
Very cool and seamless! Can you share a bit about the implementation details?
November 20th, 2008 at 5:52 pm
I can give you some details about the Javascript implementation. We use the Draggable object from Prototype to implement this. However, there are a lot of gotchas that you have to take into account. We have therefore implemented some event handlers of the Draggable object to overcome those.
Hopefully this clarifies the implementation a bit! As a last remark, you really have to be careful with Javascripts events in different browsers when Flash is involved. Some browsers simply will not fire an event, other events will not bubble correctly and some events have different parameters among the different browsers. This makes it really tricky to get it right.
November 23rd, 2008 at 8:04 pm
There’s a little bug though, if you drag and drop in 3D mode, and then go back in 2D, you see that drops were not ignored. Ok, maybe that’s not a bug, but dropping something onto invisible view is counter-intuitive at least.
November 24th, 2008 at 1:04 pm
Thanks for reporting this. We will certainly address this issue, as it is indeed very counter-intuitive.