Letting Visitors Choose a Different Background?

Hi! I used the search function but it only basically comes up with the ‘load random background tutorial’ so i figured i’d take a chance and post! I really like the idea of setting up a flash site that then has buttons that would let visitors then choose a different background on the page – kinda like this site:

http://www.sonypictures.com/movies/charliesangels2/site_index.html (my apologies, please click the skip intro button, then check out the site i mean – sorry for the inconvenience!!)

The buttons i’m talking about are in the right hand corner of the background image that loads. How does this work? Is it basically just movie clips that load behind (how??) everything, once someone clicks the button? Im just contemplating a new look for my site, and wanted to give a little more viewer interactivity to it, and thought this would be neat. Any help would be greatly appreciated!! Thanks in advance!!

Jen

you can have a layer at the buttom that has only a movieclip on it… that movieclip would contain all the different background images, and then you can have the buttons switch between the different frames with a movieclip.gotoAndStop(n) action… hope this helps :slight_smile:

Ahh! OK, I get what you’re saying, thanks very much! But how do they actually get the buttons, once clicked on to then turn into a button for the original background to load? Its hard to explain, but the movie starts with one background always the same one, but when you click on one of the buttons for a different background to load, the button you click on then somehow becomes a button to click to load the original background, and this occurs with all the buttons. Any ideas on how they did that by chance?? Thanks for everything, its MUCH appreciated!!

Jen

You’re talking about the sliding thing?

If you are, it’s not really complicated (would be easier with Flash MX though :beam: ). Imagine that you have that button inside a clip, and that you use a function goThere(dest) to make the whole thing move. You’d have to initialize an array in the clip with 2 values:

myDestinations = [200,0];

In that case, this would mean that the first image is at position 200, and the second at position 0.

Then the code on the clip would look like:

on (press){
dest = myDestinations[i%2]; // first destination, then second, then first...
i++;
}[/As]I'm assuming here that you're using the same kind of code in the tutorial :)

pom :phil:

OK, I’m getting a tad confusd, so bear with me here please!..Ilyas is saying to basically follow that random background tutorial (so that would mean making the images as seperate swfs?)but to then have actionscript somewhere in the main flash movie with the buttons that mentions the destinations? Am i close or way offbase? Sorry for being a twit here!! Thanks!!

Jen

I was talking about the sliding menu tute, sorry :beam:

Oh, you mean the type of menus they have in the example i linked to? Hey no problem, its good to know if i actually want to try something similar like that for a menu too, so thank you kindly!! No what, im referring to, is on this page http://www.sonypictures.com/movies/charliesangels2/base.swf the site loads with a background. In the right hand corner of the background, there are about five different little buttons, that when clicked, they change the background image to a different one. And also whatever button you click on them somehow automatically turns into a button to click on to turn the background into the original image. Any ideas on how they did that by chance??? Thanks again for all your help!!

Jen

That’s what I tried to explain :slight_smile: Except that I thought you also wanted to achieve that sliding effect. Let me try to put up a fla for you…

Oh im sorry, my brain must be on vacation! Yes, how the images slide in and out, is what’s drawing my eye to the idea, besides the idea of allowing a little site interactivity for visitors, sorry about that!!! (there’s so much going on in that swf, i wasnt sure what sliding part of it you were first referring to – sorry!!) ANY help would be greatly appreciated and i thank you so much for your patience and kindness!! :slight_smile: Take care!!

Jen

Here you go. Look at the actions on the big square, on the small circle and inside the circle :slight_smile:

// didn’t see your answer, I hope that’s what you wanted :beam:

Hey that very well could be it! Cool! But do you possibly know how they got it to move in and out? Is this more of an MX capability possibly? I keep contemplating upgrading but the wallet needs a little extra cash before i definitely can! But if fancy things like the interactive/moving backgrounds are easier to do with it then Flash 5, i may just cave anyway and get it! Thanks again!!

Jen

Hi again! OK, you guys have been a great help with me on this, and I just have one more piece to the puzzle before i try and sit down and solve it. I’m now looking to see just how did they make the different background images move into place when the buttons are clicked on, and not just appear in place like the example.fla Ilyas made to show me, what i couldnt figure out. (which, obviously seems to be a lot in this case :slight_smile: !)

Here’s the link again to the swf I’ve been talking about:
http://www.sonypictures.com/movies/charliesangels2/base.swf

Now, i came upon actionscript code, that seems to be for movie clip movement (I’m not sure what code site it came from, i think i saved it as a text awhile ago). Now, im not sure if its missing anything or if its even what im looking for to do like the above example, but is it at all close, if anyone can tell?? If by some chance it is, im assuming i still make all of the various images into a single movie clip, and do i name it in any of the below, and i’d add the code to one of the layer frames correct? Im sorry to be such a twit with this, but im trying to figure it out, so i learn more! I dont know if this is even the right script to try for that moving background effect, but i figured it didnt hurt to see! Thanks again, if anyone can help! Take care!!

Jen

if (currentMovie == section_int)
{
return("");
} // end if
movie.targetX = section_int * -760;
currentMovie = section_int;
var count_int = 1;
while (count_int <= 5)
{
if (count_int == section_int)
{
this[“b” + count_int].gotoAndStop(2);
}
else
{
this[“b” + count_int].gotoAndStop(1);
} // end if
count_int++;
} // end while
setupEnt();
} // End of the function
function setupEnt()
{
movie.onEnterFrame = function ()
{
this._x = this._x + this.targetx;
this._x = this._x / 2;
if (Math.round(this._x) == Math.round(this.targetx))
{
trace(“ending background movement”);
this.onEnterFrame = null;
} // end if
};
} // End of the function
currentMovie = 0;
stop();
init = function ()
{
writeLog(“bgs init…”);
if (this._framesloaded == this._totalframes)
{
writeLog("…loaded");
this.gotoAndPlay(3);
}
else
{
writeLog("…not loaded");
this.gotoAndPlay(1);
} // end if
};
init();

// [Action in Frame 4]
stop();

If you don’t figure this out, I’ll try to make a fla for you, but in the meantime you should check the sliding menu tutorial :slight_smile:

Btw, that code you posted is Flash MX… :beam:

Ahh, OK so it IS better to go with Flash MX, huh? It would be cool to figure it out using the ‘old version’ but its not looking like its as do-able unless its with the MX? I’ll definitely check out the sliding menu tutorial (but isnt that more MX based?)! Thanks yet again!!

Jen

It’s completely doable with Flash 5, it’s just that it’s A LOT easier with Flash MX, that’s all… :slight_smile: