Urggh
I posted a thread a little while ago about some problems i was having with shared objects, someone was good enough to help me out.
Now i have a new problem. Basically i have a scroll bar and i want it to remember where it last was when you load another page. So i use a shared object to save how far along someone has scrolled and the load the value and auto scroll there on reload. This all works fine in FF, but IE it doesn’t.
I’m a flash noob so all that i’ve done so far is basically trial and error. But what it seems to do in IE is always be one shared object value behind. I’ll try and explain a bit better. Say i scroll along 300 then reload, the bar will be in the starting place. Then save i scroll along 600 and reload the bar will then be at 300. Then if i scroll along 1000 and reload the bar will be at 600. I just don’t see why its doing it. I need to get this sort quite quickly so any help would be appreciated. If someone things they can sort this out i’m also willing to pay. As said it only does this in IE in FF it works fine.
here is my code that deals with the auto scroll
This is what it does on load:
//If the shared object isn't present then start at default position
if (so.data.pos_x == null) {
so.data.pos_x = -180;
}
last_position = so.data.pos_x;
var g_interval = 0;
var g_step = 8;
var g_iid = -1;
var m = this.scroller;
//m._visible = false;
// this is the movie clip we created to hold the text links
function start_scroll() {
if (g_iid != -1) {
clearInterval(g_iid);
}
g_iid = setInterval(scrolling, g_interval);
}
function scrolling() {
var x = m._x;
x -= g_step;
if (x+m._width<1131) {
m._x = 60;
} else {
m._x = x;
}
if (m._x<last_position) {
stop_scroll();
}
}
start_scroll();
function stop_scroll() {
clearInterval(g_iid);
m._visible = true;
}
and this is present on the buttons code for scrolling. It basically saves the shared object when you roll off the button. All this works as i’ve monitored the values with tect boxes as it says them:
on (rollOut) {
stop_scroll();
so.data.pos_x = m._x;
}
I’ve declared my shared object as a global at the start, i’ve also tried declaring it in other places:
This is in script: frame 1;
_global.so = SharedObject.getLocal("position");
_global.so_last = SharedObject.getLocal("last_page");
Just to add to the wierdness i have a local version which seems to work fine in ie.