Nitobi
About Nitobi
Services
Products
Home -> Blogs -> Andre’s Blog

Andre’s Blog

Building a Mac Dock like Menu in AIR with Ajax

August 21st, 2007

So I’ve been cruising on the Adobe AIR Bus across the country this summer and I’m the only guy with a PC, well Ben and Lee were back up for a bit but not consistently enough. So Alexei and I thought it be cool to build a Mac dock type menu for AIR using the Nitobi Fisheye Ajax component.

Mac Dock:

I thought it would be a neat demo too since it’s flashy (nice graphics, animation etc…) and we have some new Dreamweaver Extensions coming out soon which makes it accessible to those aren’t yet full blown “Ajax Engineers”.

First off, so we all know what I’m talking about check this little video of it below:

Here’s how to build it (Dreamweaver + Nitobi Style):

  1. Use the Nitobi Fisheye Component (Dreamweaver Extension) this set ups the Ajax component on the page, and configures the component by setting the properties for display, animation and images:
  2. Sets up the Declaration:

    <ntb :fisheye="" id="myEyeObj" growpercent="200" opendirection="down" expanddirection="center" iconwidth="54">

    </ntb><ntb :menuitem="" imagesrc="images/blinklist.png" label="Blinklist" onclick="runWindow('www.blinklist.com');"></ntb>

    <ntb :menuitem="" imagesrc="images/blogger.png" label="Blogger" onclick="runWindow('www.blogger.com');"></ntb>

    …You get the idea, this repeats for all the menu items.

  3. Includes the script and CSS

    <link type="text/css" rel="stylesheet" href="osx/fisheye.css">


    <script language="javascript" src="nitobi.toolkit.js"></script>


    <script language="javascript" src="nitobi.fisheye.js"></script>
    </link>

  4. Onload Function
    function onLoad()
    {
    nitobi.loadComponent("myEyeObj");
  5. Add a a function to call when the a menu item is clicked to open a new AIR window and load a given URL.
    function runWindow(wid) {
    var bla = window.open("http://" + wid, wid, "width=800, height=600"); }
  6. Add the capability to click and drag the app around the screen when the bar above the menu is clicked with the mouse.
    nitobi.html.attachEvent($("grabby"), "mousedown", function() {window.nativeWindow.startMove();});
    ....
    <img src="images/grabby.png" style="cursor: move;" id="grabby" />
  7. Then Package as an AIR application with the System Chrome set to “None” and set it to “Transparent”.
  8. More Info and files. Download the code and AIR file to play around with it.. Check out Alexei’s original Ajax Fisheye post.

    Technorati Tags: , , , , , , , , ,

    Digg! | Del.icio.us

    This entry was posted on Tuesday, August 21st, 2007 at 8:26 pm and is filed under AJAX, Software Development, Technology, components, design, nitobi. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “Building a Mac Dock like Menu in AIR with Ajax”

  1. 10668844 Says:

    pretty darn cool - thanks for sharing that. i’m going to check it out now.

    b.

Leave a Reply


Search Posts

Does your company Jiibe?
My ideal work culture:
[See my summary] [What's yours?] Get your own Jiibe

Twitter

Google Reader

Flickr Pics

www.flickr.com
This is a Flickr badge showing public photos from Andre Charland. Make your own badge here.

Pages

Archives

Categories

All contents are (c) Copyright 2006, Nitobi Software Inc. All rights Reserved
Andre’s Blog Entries (RSS) and Comments (RSS).