This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Flash Site Design > April 2006 > Random Text





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Random Text
thetis57

2006-04-07, 10:33 pm

Hey I have a flash logo on my site, and id like to figure out how I can cycle
through various slogans and by just publishing one .swf, so everytime someone
refreshes it shows a different slogan.

Thank you.

Ruben

2006-04-08, 6:32 pm

You'd need to create a dynamic textfield (just create a textfield and
select 'dynamic' instead of 'static') and give it an instancename
(let's just say you'd call it "sloganField").
Now, on the frame on which the textfield's placed you'd place the
folllowing script:


allSlogans = ["my site's AWESOME!","I like rubber duckies","I should
really get back to origami-practice now","Me back's sore","Check out
www.com, it really excists!"];
randomIndex = Math.round(Math.random()*(allSlogans.length-1));
sloganField.text = allSlogans[randomIndex];


You can add any value you want to the allSlogans-array and it'll be
included in the random-pick..

- Ruben

Stan Vassilev

2006-04-08, 10:30 pm

Here's a way (assume the textfield instance name is sloganField):

slogans = ["slogan1","slogan2","slogan3","slogan4"];
sloganField.text = slogans[random(slogans.length)];

Regards, Stan Vassilev
www.flashbeyond.com -->

> Hey I have a flash logo on my site, and id like to figure out how I can
> cycle
> through various slogans and by just publishing one .swf, so everytime
> someone
> refreshes it shows a different slogan.
>
> Thank you.
>



Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews