...

View Full Version : Randomising my banners to show up a different one



britain
01-30-2008, 10:58 PM
Firstly sorry if the title is a bit confusing
Secondly thanks for reading this post
Now,
I am doing my GCSE work for website design,
I want to have a web banner that will show 1 of 3 animations i have created,
I am very new at Flash a my teacher doesn't know how to fully use it,
So i was wondering
Does anyone know a way i can randomise my banner?




Detailed
Its for a website called "Healthy Kids"
I have created the 3 banners on differenet flash docs but dont mind redoing them.

Is this possible in Flash or would it be easier to use some sort of code on the actual website?



Thank you,

StupidRalph
01-31-2008, 06:30 AM
First, http://www.gotoandlearn.com is a great resource for learning actionscript.

As far as the banner you could simply load them into a container movieclip. View the carousel tutorial on the site listed above for specific help on that.

To randomly rotate threw the banners you can use the Math.random() like this.



var min:Number = 1;
var max:Number = 3;

var randomNum:Number = Math.floor(Math.random() * (max - min)) + min;


//just use a SELECT/SWITCH statement to pick which banner to load based on the random number selected


Sorry, I couldn't remember which construct is used in actionscript. I haven't coded all day I've been busy designing a few web templates. But I believe its the Switch statement in AS.

gnomeontherun
01-31-2008, 07:52 AM
I would say that its better to use a PHP script to serve up the random flash file. That way you can add banners to the site that are or are not flash based, and unless they NEED to be flash based they should be images. It would be a more scalable solution.

PS: Rules state that we are not to help with homework directly. We can help in general terms, but we want you to learn so we need to avoid giving you direct answers. Check out that site, as well as this post (http://www.codingforums.com/showthread.php?t=126424). Make sure your questions avoid violating ethical rules as stated below. Good luck.


1.5) No homework assignments - Do not post your entire homework assignment and request that other members do it for you. This is considered cheating, and your thread may even be used by your school to prove your guilt. Now, you may ask for advice or help on a specific aspect of your assignment that you're having trouble with. Use common sense as far as what's acceptable in terms of soliciting help with homework assignments.

britain
01-31-2008, 08:47 AM
This isn't a homework task.
The task is to design a website.
It is my own personal choice to use a randomising web banner :thumbsup:

gnomeontherun
01-31-2008, 06:05 PM
My apologies, I wasn't sure what you meant when you said 'teacher', and I thought it was a class project.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum