Join Login

Video Tutorials

Create a Social Network!

Generate a Random Frame with AS3

By: RiverCityGraphix      Views: 7262      Share: Bookmark and Share

In this tutorial, you will learn how to create a random frame generator using AS3 in Flash CS4.

This random frame generator can be very helpful when trying to keep your site looking fresh. If you have an image gallery start on a different image each time, it looks like your site is being updated even when it is not. This can also be a helpful tool in delivering a unique user experience on your site or in games. There are many applications for this method, you just need to find them.

Actionscript 3 (AS3)

random_btn.addEventListener(MouseEvent.CLICK, choose);

function choose(event:MouseEvent):void{
var pic_number : Number = 6;
var randomFrame:Number = Math.ceil(Math.random() * pic_number);


Free Source Files Zip

Host Unlimited Domains on 1 Account