"Simple" Flash Coundown Timer
Posted by Ryan on Apr 24, 2009 in Company News | 0 commentsI hate Flash. I’ve got more than a few reasons, but sufficed to say that it is one of the most unintuitive programs I’ve ever used. Regardless of that fact, I faced off with my web nemesis the other day when, at my day job, I began working on a countdown clock that would count the time until John Calvin’s birthday. Probably the biggest help I found was from the folks at Flash Speaks Actionscript. With their help I was able to get the countdown working, but I was still stuck with not being able to make the resulting .swf into a link.
It seemed like an easy enough task, but every actionscript I tried ended up breaking the script running the clock. Finally I found a solution that worked. To make my resulting .swf into a link I needed to create an invisible “movie” button and apply the actionscript:
function gotoPage(event:MouseEvent):void
{
var targetURL:URLRequest = new URLRequest(“http://www.calvin500.com”);
navigateToURL(targetURL);
}b1.addEventListener(MouseEvent.CLICK,gotoPage);
b1.buttonMode = true;
b1, of course, being the name of the button. See… this is the thing about flash… how is the above code intuitive? Why can’t I just created a “button” and assign a “link” to the button!?!? Instead I have to write this crazy script to make a simple link.
Alas, it is all over now and the resulting clock in included below. (I made a second version. You can see it on the Calvin 500 website.)
Get the John Calvin birthday clock at Calvin 500
