Click to See Complete Forum and Search --> : flash rotating banner please help


iowadevguy
06-25-2008, 10:06 PM
I'm a html/css web developer whose pretty much a newbie when it comes to action script. I used to write a little in as2 but am completely new to as3.

I'm creating a flash rotating banner like that you see on bestbuy.com, ign.com or countless other sites. 4 slides that cycle through externally loaded swfs every 10 to 20 seconds unless the next or prev button is pressed.

Got through loading the externally swfs, as well as setting up an array so it can cycle through my swfs. I also am reading up on for loops that I believe I will use for the next and prev buttons to cycle through my swfs. Unfortionitly my lack of knowledge on as3, I keep getting errors every time I try to set that up.

If anyone here can help me out or at least point me in the way of a good tutorial on rotating flash banner ad (because all I get in my searches are "create your own using our software") that would be amazing.

here's what I have so far:
var movieOrder:Array = new Array("external1.swf", "external2.swf","external3.swf");
var request:URLRequest = new URLRequest(movieOrder[0]);
var loader:Loader = new Loader()

function loadit(){
loader.load(request);
addChild(loader);
}

myButton.addEventListener(MouseEvent.CLICK, buttonPress);

function buttonPress(event:MouseEvent):void{
loadit();
}

Eye for Video
06-26-2008, 12:54 AM
Don't know if he has any up on this topic yet but a pretty good source for tutorials (many moving on to AS3) is:
www.gotoandlearn.com
Eye for Video
www.cidigitalmedia.com

infinityspiral
07-09-2008, 04:07 AM
You're 90% there. A for loop would work but you'd need to regroup and rearrange your code a little. An alternative to the for loop would instead be creating a new variable, called "counter" to keep track of which array item you're on. Set it equal to 0 at the start and then at the end of the function add counter++;
to add 1 to the current amount. You can then use the counter variable in the [] instead of a number to load the array item you want.

Now if your project needs to scale and load say... 50 array items then a for loop could save you some time sure.