Featured post
actionscript 3 - restoring scroll position in Flex Web Page -
this crucial overlooked functionality guess in web page - on standard (non flex) web page, navigate away page , return via or forward button , restores scroll position @ on page previously. crucial function , annoying if wasn't there - having page automatically go top each time when scrolled way down on long text site. guess browser must managing this,as surprised find deleting cookies, cache , not rid of saved scroll position.
so problem doing on flex web page - correct way it. have been using sharedobject.getlocal, dumbfounded discover once local shared object created , never deleted, there nothing user can in browser delete them (deleting cookies, etc has no effect.) had 100 different sharedobjects in macromedia subdirectory storing nothing scroll positions. standard web pages can delete browsing history, sharedobject they're there unless delve file subdirectory , delete them manually (which of course user never do.) subquestion be, true there no way delete sharedobjects browser. flex calls sharedobjects "flash cookies" in docs, real cookies user can delete them.
my solution have 1 sharedobject url's generated, , sharedobject holds object operating circular buffer. object has properties indexed url, each property pointing session info url (e.g. scroll position, etc.). haven't tested following yet, i've got. if there built in way in flex circular buffer in local sharedobject haven't found it.
function createsessioninfo(url:string,info:object):void { var so_obj:sharedobject = null; try { so_obj = sharedobject.getlocal("session_info","/"); } catch (e:*) {} if (!so_obj) return; if (so_obj.data.session == undefined) so_obj.data.session = new object(); var session:object = so_obj.data.session; var date:date = new date(); var max:int = 100; var first:string; var first_created:int=date.time; var cnt:int=0 (var p:string in session) { if (session[p].created < first_created) { first_created = session[p].created; first = p; } if (++cnt == max) delete session[first]; } session[url] = new object(); session[url].created = date.time; session[url].info = info; }
- Get link
- X
- Other Apps
Comments
Post a Comment