Sightsmap
January 24 2012 Categorized Under: Code Examples Comments: None
January 24 2012 Categorized Under: Code Examples Comments: None
September 7 2011 Categorized Under: Code Examples Comments: None
In working on the new Pantone Moods this week, I needed to add a listener to the widget to halt the realtime updates if a user no longer had the page active (meaning, they switched to another browser tab or application) to prevent unnecessary traffic to the server.
The application cycles through the ten most recent Moods posts and, upon nearing the end of its cache, queried the server for a new supply. However, if someone’s focus wasn’t on the page, it makes no sense to keep collecting and displaying results.
With ActionScript 3, this task is quite easy:
stage.addEventListener(Event.DEACTIVATE, onDeactivate); stage.addEventListener(Event.ACTIVATE, onActivate);
And it’s just as easy when programming for Mobile Applications:
NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, onActivate); NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, onDeactivate);
With JQuery, we can now accomplish the same thing for AJAX/PHP browser applications to no longer commit resources to updating a page that isn’t being viewed:
$(function(){ $(window).bind('blur', function(){ onDeactivate(); }); $(window).bind('focus', function(){ onActivate(); }); // IE EVENTS $(document).bind('focusout', function(){ onDeactivate(); }); $(document).bind('focusin', function(){ onActivate(); }); });
Note that the second two methods must be added because Internet Explorer uses focusin/focusout rather than simply focus/blur.
December 2 2009 Categorized Under: Code Examples Comments: 2
While working on a new project for era//404, I received a great tip from Zeh, my Flash Obi Wan whom you’ve no doubt read me gushing about in the past. The site (which will be launched at the top of 2010) is centered around a video loop. The loop began as a 208MB raw Quicktime video clip shot by one of era//404′s video directors/editors, Greg Stadnik (you may remember his work from our Beautiful Children viral video that was featured in Gawker and AdRants last year). The clip was then scaled in 1/2, compressed using the On2 VP6 codec, imported into flash and then manipulated manually. The final SWF was 3.12MB, but the quality suffered terribly.
This is when Zeh clued me in to video smoothing. It’s the same principle as bitmap smoothing, since embedded video clips are technically just an image sequence. The result was night and day. The left half of the below screenshot shows video smoothing set to true, where the right shows smoothing set to false.
Figure 1. Video Smoothing – Click image for larger/detailed version
Note that this is just the beginning of this site with the radial gradient and scanlines stripped away to accentuate the smoothing detail. Overall, it’s an easy way to preserve quality without increasing loadtime, memory or processor demand. Give it a try. I’m sure you’ll be as pleasantly surprised as I was by the result.
August 1 2009 Categorized Under: Code Examples Comments: One

I wasted almost an entire day this week attempting to figure out why a link started pulsing when activated by a mouse. The link, a 0% alpha “hotspot” or “rollbox” (as it’s sometimes called) movieclip (mouse enabled) with a dynamic textbox (mouse disabled), was listening for onRollOver and onRollOut mouse events. OnRollOver, the link was expected to switch indexes to the front, grow to 3x the original size and then ColorTransform to an active color. The index switch was updated immediately, and the scaleX/scaleY and ColorTransform was a timed action handled by Tweener. With the exception of the re-indexing, these tweens were triggered onRollOut as well, though in reverse. There are obviously a million other ways to handle this, and numerous tweening engines that could be used instead of Tweener, but this was the method I’d used in the past and was most comfortable with.
Upon testing, I found that most of the menu items worked fine, but some “pulsed” or flickered between growing and shrinking, as well as changing color sharply. Moving the mouse over the words while the tween was occurring sometimes seemed to thwart the issue. And some links seemed unaffected by the bug. Also, I noticed that when the link hit the onComplete method of the tween (meaning, it had finished growing to 300% and colorTransforming to the active state), the pulsing stopped.
June 19 2009 Categorized Under: Code Examples, Miscellaneous Comments: None
From Google’s Webmaster Central:
We just added external resource loading to our Flash indexing capabilities. This means that when a SWF file loads content from some other file—whether it’s text, HTML, XML, another SWF, etc.—we can index this external content too, and associate it with the parent SWF file and any documents that embed it.
This new capability improves search quality by allowing relevant content contained in external resources to appear in response to users’ queries. For example, this result currently comes up in response to the query [2002 VW Transporter 888]:
June 10 2009 Categorized Under: Code Examples, Miscellaneous Comments: 8

A [d]online reader recently requested that the Flash File Uploader allow provision to upload all filetypes. And while I’d previously decided against such an option—due to security/malicious action issues, this was not the first time I received such a request. In fact, since the uploader was created a few years back, I’ve gotten dozens of requests for this feature. As such, I’ve decided that my disclaimer for downloading the uploader should adequately cover me from any litigation and wrote the feature into the latest version of the uploader.
For people wishing to just use the uploader without understanding the changes, simply add “all” as an item under the extensions flash variable in the swfobject embed code:
fo.addVariable("types", "video|text|pdf|audio|archive|office|image|all");
For those that wish to know the changes, the Flash loop that adds the array extensions to the “allowed” list also looks for the “all” option and changes a variable to true, if all filetypes are allowed. This is then passed to “upload.php” and skips the extensions test. Lastly, it’s passed to index.php to properly display the success message.
For your convenience, the link is the same as the last one.
Comments and feedback always welcome. Thanks again, Mike, for the assistance and to all the [d]online readers and commenters for your interest in the FFU and readership.
May 11 2009 Categorized Under: Code Examples, Miscellaneous Comments: None
May I just take a moment to vent my extreme frustration with the Facebook Developers API? Cardinal rule of development that you should change the public interface unless it’s a last resort. Facebook, who has made a practice of changing their API almost regularly, has got its application developers jumping through hoops just to keep old projects functioning properly. Read more…