Archive for July, 2006

developing the navigation for an.tidote.us

Following up to my previous post about what's been going on with the development of an.tidote.us

Getting Started

an.tidote.us is the first full flash site I've developed in over a year, and working outside of the infrastructure that Evolving Media previously provided for me, our hosting account with Daily Razor has created a few issues that I've had to take into consideration. Namely the last of Flash Remoting Support.

The site uses a basic two level navigation component that's setup like this.

  • Work
    • Print
    • Web
    • Identity
  • About
    • Mission
    • History
    • Staff
  • Contact

There is a third level that only exists for the Staff section, and we're going to let that section have it's own iteration of the nav component, instead of relying on extending the main navigational component further. Doing so lets me create an xml object with one very simple SQL statement.

No Remoting? Now What?

Looking into alternatives to remoting, I came across AMFPHP. Which would be a great solution if I wasn't hell bent on developing this site in ColdFusion. The last few projects that I've done, including my own site and this blog have been in PHP, and I really wanted to use the simplicity,flexibility and power of CFCs for this site instead of layers of mangled crap that would have come from a mixed Flash/ColdFusion/PHP implementation.

Ok, so there's this little thing that I remembered about it being pretty simple to connect to a webservice in flash and retrieve whatever data, in whatever format it sends. So this is where we get to our CFC.

The World's Simplest Web Service, WSWS...

I wrote a CFC that does two simple things, runs a query against the Sections table, and parses the results to XML.

CODE:
  1. <cfcomponent>
  2. <cffunction name="getNavXML"
  3.     access="remote"
  4.     returntype="xml"
  5.     output="false"
  6.     hint="gets an xml object that is used to build main and subnavigation components">
  7.     <cfquery name="GetNavItems" datasource="antidoteus">
  8.         SELECT *
  9.         FROM Sections
  10.         ORDER BY ParentID ASC
  11.     </cfquery>
  12.     <cfscript>
  13.     // create xml object
  14.     navXML = XmlNew();
  15.     navXML.XmlRoot = XmlElemNew(navXML, "navigation");
  16.     </cfscript>
  17.     <cfoutput query="GetNavItems">
  18.     <cfscript>
  19.     if (parentid eq "0"){
  20.         // create menu node and attach it to the root node
  21.         xnNavItem = XmlElemNew(navXML, "menu");
  22.         xnNavItem.xmlAttributes["name"] = "#name#";
  23.         ArrayAppend(navXML.XmlRoot.XmlChildren, xnNavItem);
  24.     } else {
  25.         // create menu node and attach it to it's parent node
  26.         xnNavItem = XmlElemNew(navXML, "submenu");
  27.         xnNavItem.xmlAttributes["name"] = "#name#";
  28.         ArrayAppend(navXML.XmlRoot["menu"][parentid].XmlChildren, xnNavItem);
  29.     }
  30.     </cfscript>
  31.     </cfoutput>
  32.     <cfreturn navXML />
  33. </cffunction>
  34. </cfcomponent>

This is what is returned, or you can check it out for yourself here.

XML:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <navigation>
  3.     <menu name="Work">
  4.         <submenu name="Print"/>
  5.         <submenu name="Web"/>
  6.         <submenu name="Identity"/>
  7.     </menu>
  8.     <menu name="About">
  9.         <submenu name="Mission"/>
  10.         <submenu name="History"/>
  11.         <submenu name="Staff"/>
  12.     </menu>
  13.     <menu name="Contact"/>
  14. </navigation>

Ok, So Now What?

So I now have my XML to build the nav from, now I need a quick way to build the nav itself, and of course keep to the specs outlined in the site's final comping design. That's where extending flash components, themes and styles comes in. I'll save that for my next post once I finish the nav in a day or two.

an.tidote.us progress report

There are quite a few things that need to get done with an.tidote.us. But first some history...

For those who have no idea what an.tidote.us is...

an.tidote.us is the home of the Antidote Branding Consortium.
So you ask, what the hell is the Antidote Branding Consortium? Well, the ABC is an organization, design collective and identity that has been put together by yours truely and Jim Maximowicz. What we're most excited about at the ABC is The Antidote Project, a web-based initiative inspired by Jim Maximowicz's thesis project at SUNY New Paltz of the same name. But more on that later.

Ok, so onto the progress.

We have an identity

an.tidote.us logo We put this together using Coolvetica by Ray Larabie. The logo uses a 1:1.2 ratio for lineheight to textheight. so if the font size is 24px, the line height is 20px.

We have a finalized color pallete

To keep things simple, we chose to go with a clean CMY based pallete, with C, M, and Y representing the three main categories of the site. One thing i noticed when putting it together is that the luminocity of true CMY vary to a great degree. This was before I began selecting additional color values in for each section to represent various states, actions, relationships, visual effects, etc. I asked myself if there was a color pallete or color theme that i was familiar with, that had good ratios and good luminocity out there. The answer was simple, Adobe's Halo Theme, which is what's used to set the color and feel to Adobe's Exchange. an.tidote.us color pallete

Appying the luminocity and color value relationships used in Halo to our true CMY base pallete, this is what we ended up with.

Navigation Components

The development of the site's navigation will be in a soon-to-be-written post. So check back soon components can be found here.

doing simple things without a code library

So I just was reading this article written by David Talbot on Devx.com about Yahoo's UI libraries aiming to make crossbrowser development a bit easier for some folks.

The only notable feature that I could seem to find, was the simplification of setting the opacity of a DOM element in an elegant way. An entire library for that? I got a little curious and took a further look.

Here's an exerpt from the artile:

The DOM and Event Libraries
YUI's capabilities in regard to core DOM and event handling are incredibly rock-solid, perform as expected, and cover a broad range of capabilities. Most surprisingly, this API gives you simple cross-browser transparency control. Most developers aren't even aware that magic tricks even exist (via DirectX calls) to make semi-transparency work in IE, much less the Mozilla-based equivalents, but YUI enables access to most, if not all, of the CSS properties you'd ever want. Here's an example:

YAHOO.util.Dom.setStyle('MyDivID', 'opacity', .5);

Suprizingly? Are you kidding me? Maybe I just don't get what the big deal is. I've been developing crossbrowser DHTML in one way or another since the beginnings of the last browser wars. And back in 99-2000 when everyone was bitching about the diversity in W3C support between the version 4 browsers, I was just doing what needed to be done to make everything work the way it needed to.

So despite Mr. Talbot's enthusiasm for what I considered to be not much of a big deal at all I headed over to Yahoo's Developer Center poked around their lousy documentation and downloaded the most recent build here on Sourceforge. I took a peek at the source, and it turns out that Yahoo and I have almost the same exact approach, thing is, running their entire library is pretty needless.

Here's what I came up with to put together a fade in effect for the items being loaded into my portfolio via xmlHttpRequest.

here's the very simple browser check:

JavaScript:
  1. var ua = navigator.userAgent.toLowerCase();
  2. var isOpera = (ua.indexOf('opera') != -1);
  3. var isIE = (ua.indexOf('msie') != -1 && !isOpera);

and here's an exerpt from my getPortfolioDetail function:

JavaScript:
  1. xhrPortfolioDetail.onreadystatechange = function() {
  2.     if (xhrPortfolioDetail.readyState == 4 && xhrPortfolioDetail.status == 200) {
  3.         portfolioDetail.innerHTML = xhrPortfolioDetail.responseText;
  4.         var fader;
  5.         for(count = 1;count <= 10; count++){
  6.             fader = setTimeout(function(){
  7.                 val = count*0.1;
  8.                 if (isIE && typeof portfolioDetail.style.filter == 'string'){
  9.                     portfolioDetail.style.filter = 'alpha(opacity=' + val * 100 + ')';
  10.                     if (!portfolioDetail.currentStyle || !portfolioDetail.currentStyle.hasLayout) {
  11.                     portfolioDetail.style.zoom = 'normal'; // if you use '1' it distorts things
  12.                 }
  13.             } else {
  14.                 portfolioDetail.style.opacity = val;
  15.                 portfolioDetail.style['-moz-opacity'] = val;
  16.                 portfolioDetail.style['-khtml-opacity'] = val;
  17.             }
  18.         },100*count);
  19.     }
  20.     xhrPortfolioDetail = null;
  21. }

Pretty simple eh? One thing that you can't see is where I use the same approach to lower the opacity to 0.1 while loading, so there isn't any flashing of the loaded content before it fades in.

I know that there are tons of AJAX Frameworks out there that provide fade in type effects, but I'm not quite there on implementing one. Noteables include Dojo, MochiKit, and of course the ever popular script.aculo.us.

I'm still working on making it work a little more smoothly and efficient as the delay in setting the opacity while i'm doing the xmlHttpRequest is inconsistant at best.

Similar Posts

Categories

Archives

About

Nater Kane is freelance developer and user experience & technology consultant based in Brooklyn, NY.

Nater's focus is to make the web a better place, one decision at a time.

He likes to spend time playing with his cats, riding bicycles around the city, working on his diesel vw rabbit or motorcycle, and enjoying a decent espresso.

RSS

Twitter » What I'm Up To

Elsewhere

JavaScript JS Documentation: JS String toUpperCase, JavaScript String toUpperCase, JS String .toUpperCase, JavaScript String .toUpperCase

Basecamp

Meta


Nater Kane naterkane personal http://www.naterkane.com LinkedIn Profile Web Technologist personal nater@naterkane.com 1978-09-12 voice 845.234.6698 | fax 707.922.0593
964 Flushing Ave. Brooklyn, NY 11206