Tom Lauck’s Deseloper.org

Get Yourself a Flex Application Name

author:

While working with ExternalInterface on a recent Flex project it became a little cumbersome accessing the embedded SWF several times.  This is especially true if there is more than one SWF in a given page. Typing document.getElementById gets old fast as well. Therefore, this issue illustrates the need for core or global methods that can be reused, especially if you aren’t using a framework such as Prototype or jQuery.

When a SWF is embedded into a page, it naturally becomes a part of window.document/document/window (Internet Explorer).

The document is contained by the window object and may contain any number of elements.

Because of this, it is rather simple to access a SWF to pass a method into a Flex app.  The idea is simply to check whether or not the browser is IE (in this example we will use a UA check), then return the element with the appropriate SWF name:

function getSWFApp(appName) {
	if (navigator.appName.indexOf ("Microsoft") !=-1) return window[appName];
	else return document[appName];
}

Of course, there is more than one way to skin a cat. In this case, a more traditional approach:

function getSWFApp(appName) {
	return document.getElementById(appName);
}

Elsewhere in your code you can then pass a method to the SWF using dot syntax just as you would by using document.getElementById:

getSWFApp("ExampleApp").exampleEventName(exampleEventParams);

As an alternative to document.getElementById, returning the object from the document works like a charm. More importantly, a global method to retrieve a SWF saves many keystrokes. As an added bonus, this method can easily be added to the Flex HTML wrapper, thus allowing quick and easy deployment of applications using ExternalInterface.

Feb 27 2008

Ten SEO Tips

author:

Lately, many have been asking about SEO. With the economy in a little slump of sorts, I am assuming people are for one feeling the pinch and realizing the selling value of the internet. The end of the age of bad flash sites and complex tables is in sight! For many years, big companies have been playing the pragmatic SEO game, but now the average joe is finally jumping on the bandwagon and willing to invest in SEO and SEM. In my opinion this is big, because small businesses are willing to give up valuable revenue to the relatively uncertain territory of SEO and SEM.To accompany my recent observation of those with small businesses I have compiled a brief list of essential SEO tips:

  1. If you use Flash, please give alternate content. Sure Google can “spider flash” now, but do you really trust the outcome? And how is any search ever going to get high quality content from this?
  2. Keep your markup clean.
  3. Use heading tags well. So don’t overuse/abuse h1′s and h2′s – I usually use each once on a page.
  4. Use markup tags for their intended purpose.
  5. Make sure page titles are used and content rich.
  6. Use keywords and descriptions when you have something important to say about that page. Just like your momma told you, if don’t have anything good to say don’t say it all.
  7. Use URL rewriting. If you are an SEO, in my opinion, URL rewriting should be your best friend. In strong accordance, be familiar with HTTP/1.1 status codes and know how to use them.
  8. Use and be familiar with robots.txt, the X-Robots-Tag, the “rel” attribute, and sitemap.xml files.
  9. Use webmaster tools from one or all of the major players (Google, Yahoo, and Microsoft).
  10. Use Google Analytics at the very least. For the most accurate metrics, combine Google Analytics with server analytics like AWStats, and other tools.

For the more advanced readers, please feel free to add to or suggest alternatives. And for the rest, this list is not meant to be a be all and end all, but – just like one’s wedding day – a mere beginning on a long journey.Now for the shameless plug…If you need some assistance implementing an SEO plan, drop Vovéo or myself a line, we will be glad to help :)

Feb 18 2008