I’m trying to implement a css theme switcher for the background image of the page that contains the flash movie, so that it changes the background based on what part of the movie the user navigates to.
I have a test file up at http://www.lilana.com/test/. I made the buttons work, in that if you push ‘style 1’ the background becomes the spotty black and white one, and if you push ‘style 2’, the background is the repeating faces down the right side, but the problem I’m having is that when I switch, the flash movie reloads and always displays scene 1, frame 1.
Ideally this is what’s supposed to happen:
style 1=spotty background, flash file says ‘crackas’ (scene 1, 1)
style 2=face background, flash file says ‘cheez’ (scene 2, 1)
As you can see, if you push ‘style 2’, it says ‘cheez’ for one second, and then reloads with the new bg and we’re back to scene 1.
I’m trying to use a shared object to fix this, where a cookie will be set based on the style chosen, which will then be read by the movie and make the movie move to the appropriate scene when it reloads with the new background. This is the actionscript I’m using in scene 1, frame 1 (frankensteined from a similar example tutorial that wasn’t doing exactly the same thing I was–which is probably why it doesn’t work):
stop();
myLocalSO = sharedobject.getLocal(“csschangefla” );
if (myLocalSO.data.ldpage = style2) {
gotoAndPlay(“Scene 2”, 1);
}
else {
stop();
}
style1.onPress = function() {
myLocalSO.data.ldpage = style1;
}
style2.onPress = function() {
myLocalSO.data.ldpage = style2;
}
What’s going wrong? Why won’t it set the cookie? Why won’t it read the cookie if it’s being set? Help!
Edit: before I included the above actionscript, it was misbehaving like I described. Now that I included the script (and cleared my internet cache (duh)) I can see that it won’t even run because it keeps insisting that the script is making flashplayer 8 run too slowly, and asking me if I want to abort the script. Why??? Shouldn’t this whole operation be fairly painless?