Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rotating Images based on visit

Status
Not open for further replies.

deviation

Programmer
Apr 17, 2001
13
US
Ok, here's the deal. I want to be able to cycle through some images I have. I want the image on the flash page to change everytime you either visit the page or refresh the the page. Is this possible?

dev
 
My guess is that it would be possible through the use of cookies... But then again if cookies are dissabled, well...

On the other hand, you could probably more easily have a randomly selected picture come up upon each new visit or refresh, meaning there's a remote chance you would see the same picture twice in a row... But hey! Better than nothing!

Would this be a background picture to your site? Or part of your background? Or a separate section?

;-)
 
How would I accomplish the second option. The page I need to do this on is completely made in with flash.

Rick
 
Can't work on this before tonight!
Meanwhile, maybe somebody else can come up with the code.

But, as I asked you, would these pictures fill the whole background of your Flash movie, or just be a smaller element within it?

;-)
 
they would be a smaller element within the movie.


Rick
 
Deviation,
Have a look at this:

Of course this probably won't be even close to what you had in mind, but it does demontrate the process.
This is using but 5 different clips appearing in random order on visit or refresh. You could have 200 or more different pictures or clips... Depending on what size you find acceptable.

You can download the .fla
It is commented... But if you have other questions, don't hesitate in coming back here to ask.

;-)

Hope this was helpful!
 
Thanks Man ,
It was close enough for me to get an idea of what I need to do. Again Thanks for your time.....

Rick
 
I have one quick question, You have a condition in your code &quot; x == previous & x<=4 &quot; this is a flash 5 only condition is there a similar condition I can use to be flash 4 compliant?

Thanks
Rick
 
Hi deviation,

That was faulty anyways (mix up with C++)...
Should of used and...

if (x == previous and x <= 4) {
x = x-1;
if (x == -1) {
x = random(3);
}
}

I've also changed the rest of the condition, 'cause I was sometimes getting x = 5, which doesn't exist in my array!

;-)

May try to whip up something for you tonight on that other thread, if nobody else comes up with an example.
 
Im doing it in 5 but saving as 4 ....so I would say it has to be 4 compliant.

Thanks
Rick
 
nice code old (I'm crap with arrays) ;-)

non-array version:

for (hide=0; hide<6; hide++) {
setProperty (&quot;mc&quot;+hide, _visible, false);
}
x = random(4)+1;
if (x == previous ) {
x = x+1;
}
previous = x;
setProperty (&quot;mc&quot;+x, _visible, &quot;1&quot;);
stop ();

dave
davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
nice one LOL davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top