I created an interactive Flash map, where viewers can click on a town that is generated by a Drupal taxonomy tree. Because I spent some time trying to find something like this on the forums, but couldn't, I figured I'd post my solution in case it helps someone in the future. I apologize if it's a bit rough; it's still in development, and not intended to be for general use. I'll post the code & demo links following, in case I need to edit any of it.

- Aaron
Culture Fix Web Identity & Design
Digital Folk Art (my blog)

Comments

aaron’s picture

This is a temporary link. I'll post the real link when the site goes live.

http://winborn.org/temp/ecr/index.php?q=featuredListings/county

You can also see all the code at my blog:
http://digitalfolkart.com/index.php?q=flashInterfaceDrupalTaxonomy

Culture Fix Web Identity & Design
Digital Folk Art (my blog)

aaron’s picture

flash_map.module:

<?php
//flash_map.module

// by Aaron Winborn 
// Culture Fix Web Identity & Design
// http://www.culturefix.org/
// http://www.digitalfolkart.com/ (my blog)
// 
// for Essex County Realty
// http://www.essexcountyrealty.com

// See Drupal.org for GPL copyright
// I'd love to hear about it if you use it!

// aaron@culturefix.org

function _flash_map_get_towns($county_name)
{
  $names = array();
  $tids = array();
  $town_term = taxonomy_get_term_by_name($county_name);
  foreach (taxonomy_get_children($town_term[0]->tid) as $term)
  {
    $names[] = $term->name;
    $tids[] = $term->tid;
  }
  array_multisort($names, $tids);
  return array('names' => $names, 'tids' => $tids, 'county_tid' => $town_term[0]->tid);
}

// sends a list of towns of the county to a url for flash
// also sends other variables needed
function _flash_map_sendTownLists()
{
  // version of this file  
  $version = '1.1';
  
  $union = _flash_map_get_towns('union');
  $essex = _flash_map_get_towns('essex');
  $morris = _flash_map_get_towns('morris');
  $somerset = _flash_map_get_towns('somerset');
  $middlesex = _flash_map_get_towns('middlesex');
  $hudson = _flash_map_get_towns('hudson');
  $passaic = _flash_map_get_towns('passaic');
  $bergen = _flash_map_get_towns('bergen');
  
  $flashVariableList = array(
    'version' => $version,
    
    'essexTowns' => $essex['names'],
    'morrisTowns' => $morris['names'],
    'unionTowns' => $union['names'],
    'somersetTowns' => $somerset['names'],
    'middlesexTowns' => $middlesex['names'],
    'hudsonTowns' => $hudson['names'],
    'passaicTowns' => $passaic['names'],
    'bergenTowns' => $bergen['names'],
    
    'essexTIDS' => $essex['tids'],
    'morrisTIDS' => $morris['tids'],
    'unionTIDS' => $union['tids'],
    'somersetTIDS' => $somerset['tids'],
    'middlesexTIDS' => $middlesex['tids'],
    'hudsonTIDS' => $hudson['tids'],
    'passaicTIDS' => $passaic['tids'],
    'bergenTIDS' => $bergen['tids'],
    
    'essexID' => $essex['county_tid'],
    'morrisID' => $morris['county_tid'],
    'unionID' => $union['county_tid'],
    'somersetID' => $somerset['county_tid'],
    'middlesexID' => $middlesex['county_tid'],
    'hudsonID' => $hudson['county_tid'],
    'passaicID' => $passaic['county_tid'],
    'bergenID' => $bergen['county_tid'],
    
  // defunct... now held within the flash itself.
  // shown here for reference of county names
  //  $countyNames = array('Essex', 'Morris', 'Union', 'Hudson', 'Middlesex', 'Somerset', 'Bergen', 'Passaic');
  
  );
  
  //Send expiration headers
    _flash_map_expirationHeaders();
  
  // send the variables to the flash animation
  echo(_flash_map_arrayWithKeysToString('testArray',$flashVariableList));
}//End function

// explodes an array into a string of variables separated by '&', 
// with items within nested arrays separated by '|'
function _flash_map_arrayWithKeysToString($name,$array)
{
  $ret="";

  foreach ($array as $key=>$value)
  {
    $ret .= "&" . urlencode($key) ."=";
    if (is_array($value))
    {
      $ret .= implode("|", $value);
    }
    else
    {
      $ret .= urlencode($value);
    }
  }
  return $ret;
}//End function

//Prints an expiration headers for form-encoded data
function _flash_map_expirationHeaders(){
  Header("Content-type: application/x-www-urlform-encoded");
  header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); //Creation time
  header("Expires: ".gmdate("D, d M Y H:i:s")." GMT"); //Expiration time.. right away!
  header("Cache-Control: no-cache, must-revalidate");
  header("Pragma: no-cache");
}//End function

function flash_map_menu($may_cache) {
  $items = array();

  if ($may_cache) {
    $items[] = array('path' => 'flash_map', 'title' => t('flash map'),
      'callback' => '_flash_map_sendTownLists',
      'access' => user_access('access content'));
  
  }

  return $items;
}

?>

Culture Fix Web Identity & Design
Digital Folk Art (my blog)

aaron’s picture

I wasn't able to post the flash actionscript here, so if you want to see it, it's at my blog:

http://digitalfolkart.com/index.php?q=flashInterfaceDrupalTaxonomy

- Aaron

Culture Fix Web Identity & Design
Digital Folk Art (my blog)

marcoBauli’s picture

This looks very nice to me. Is just a start, but i reckon is a good alternative to the Googlemap mania (and much faster to load once you have a hundred of listings too!)

Don't know how further will go this, but is a good start for something different and worth to explore

good job!