all groups > flash actionscript > july 2005 >
You're in the

flash actionscript

group:

Need help with shared objects



Need help with shared objects ozmodium
7/22/2005 11:31:28 PM
flash actionscript: I have a project that requires that I have a sound clip play on load and then
one for each page after that. I had to use a different .swf file for each page
as i could not use the flash to navigate the site. (eg movie1.swf, movie2,swf)
I have incorporated a play, stop, pause which are fine but I wanted to use
"shared objects" to set a cookie for the mute. I have them working only they
are saving to there own files as opposed to overwriting the same file. all
information that i have read said that the shared objects can be shared between
..swf files as long as they are in the same directory ( the .swf files that is).

I tried to define a partial folder name in hopes that it would default to
placing them all there with no luck

any help would be great thanks

local_data = SharedObject.getLocal("user_data","bnp");
level = local_data.data.volume;

soundTest = new Sound();
soundTest.attachSound("testMP3");
soundTest.start();
if (level != undefined) {
soundTest.setVolume(level);
} else {
soundTest.setVolume (50);
}


pauseClip.onPress = function() {
pausePositionS = soundTest.position/1000;
soundTest.stop();
};
startClip.onPress = function() {
if (soundTest.position == soundTest.duration) {
soundTest.start();
} else {
soundTest.start(pausePositionS);
}
};
stopClip.onPress = function() {
soundTest.stop();
};

muteClip.onPress = function() {
if (soundTest.getVolume() > 0) {
soundTest.setVolume(0);
local_data.data.volume = 0;
} else {
soundTest.setVolume(50);
local_data.data.volume = 50;
}
};
Re: Need help with shared objects Rothrock
7/23/2005 12:48:26 AM
I don't have much experience with shared objects, but I'm not sure you are
using the localpath parameter of the getLocal() method. Here is the example
they give in the help file:

options for the portfolio shared object created by the SWF file at
www.myCompany.com/apps/stockwatcher.swf are: "/"; "/apps"; or
"/apps/stockwatcher.swf"

"bnp" doesn't start with a /
AddThis Social Bookmark Button