At Swimfish, as with any small/start-up company, I have the pleasure of working with people that are decathletes. Everyone is capable of tackling tasks in a variety of areas which makes every day a true pleasure.
One of our talented support engineers has been helping out by working on a replacement for our small product ad that we show on our login page. Essentially, we need to rotate between three product ads, with each of them looking something like:

Key points are:
- Every time the page loads we need to open a random ad.
- The arrows handle forward and back behavior.
- The numbers (below the phone) can be selected to move to the correct ad.
- The “Schedule a Demo” buttons open up a scheduling application that our sales team uses.
Here is how this simple Flash file was put together:
- Using Adobe Flash CS4 Professional my teammate put the images and text in place.
- To support starting on a random frame, we used two simple lines of ActionScript:
var startFrame:int = ((Math.random() * 100) % 3) + 1;
gotoAndPlay (startFrame);
Using the modulo function to get the remainder of a number (plus 1) we’re able to generate a random number that ranges from 1 to 3. We then use gotoAndPlay to start with that frame number.
- The ActionScript to handle the button clicks is very simple as well, looking something like:
btn3.addEventListener(MouseEvent.CLICK,go30);
function go30(e:MouseEvent):void{
gotoAndPlay(3);}
We simply apply an event listener to each button that is setup to navigate to the correct frame in the movie.
- The code that is used by the “Schedule a demo” buttons is only slightly more complicated:
anywherebtn.addEventListener(MouseEvent.CLICK,goAnywhere);
function goAnywhere(e:MouseEvent)
{var request:URLRequest = new URLRequest(“http://my.timedriver.com/GYXDM“);
navigateToURL(request);}
Once again the button click is managed by the event listener. The only difference is that we open a web page when the button is clicked, going to TimeDriver.com.
Let me know if you have any questions or comments.
John

