Jump to content


Photo

Rotating banner from random slection of SWF banners


  • Please log in to reply
No replies to this topic

#1 dewani

dewani

    Young Padawan

  • Members
  • Pip
  • 1 posts

Posted 14 June 2009 - 11:08 PM

I am redeveloping a site for a client, although I have no experience with flash, the client has a banner with the following actionscript in a preloader file which loads a random SWF. Though he would like it so it is loaded randomly but also rotates every 10-20 seconds with another random banner. The following code is used:

[codebox]
var videoList = new Array();

videoList = ["BANNER1.swf","BANNER2.swf","BANNER3.swf"]
var loadFile:String = videoList[Math.floor(Math.random() * 3)]
var l:Loader = new Loader();
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
l.load(new URLRequest(loadFile));

function loop(e:ProgressEvent):void
{
var perc:Number = e.bytesLoaded / e.bytesTotal;
percent.text = Math.ceil(perc*100).toString();
}

function done(e:Event):void
{
removeChildAt(0);
percent = null;
addChild(l);
}
[/codebox]

Is there a way to modify the file to also rotate with a random banner after awhile? Or is there another way to achieve this (it can't be simply rotating image files using PHP, must be a flash component due to limitations with the CMS the host provides plus the banners are already animated in flash format).

Thank you for any help!
;)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users