To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 06-30-2007, 02:48 PM   #1
dbforch
Junior Member
 
Join Date: Jun 2007
Posts: 5
remember frame on reload (browser refresh) using LSO

Hi,
I"m not an expert in AS (by far), but i have a thing i need to get solved.

I have a site, which has a flash banner. The whole website is based
on PHP en MySQL. Everytime the user clicks somewhere, the site
reloads (doh) but the thing is, i need the banner to remember which
frame it was located so it returns and plays to the saved frame, and not
from the start.

I have 5 banners, and each banner calls another banner at the end
randomly, so it looks like it never ends.

I have already googled alot, also this forum and a lot of tuts on shared objects, but most of the tutorials are specified to saving text, score or
how many times a user has accessed the site, the only thing i need is
the frame it's playing, save it to the so, and after reload, access the so,
and play from that particular frame again .. so it does'nt start from the beginning all the time.

Perhaps someone knows how to get the current frame? is there some kind of command for?

Tnx,
F
dbforch is offline   Reply With Quote
Old 06-30-2007, 03:35 PM   #2
Speed85
Senior Member
 
Speed85's Avatar
 
Join Date: Apr 2007
Posts: 292
_currentframe gives you the current frame, I'd imagine the best thing to do would be save the _currrentframe as you would to save a score then when the banner loads have it pull that and gotoAndPlay.
__________________
Whoever taught EVERYONE to put all their code on movie clips needs to be shot...
Speed85 is offline   Reply With Quote
Old 06-30-2007, 03:49 PM   #3
dbforch
Junior Member
 
Join Date: Jun 2007
Posts: 5
Yer already figured out _currentframe ..

I'm testing the stuff now, i saw a few other posts with the same question,
if i have solved it i will post it here for others to use ..

Cheers
dbforch is offline   Reply With Quote
Old 06-30-2007, 05:16 PM   #4
dbforch
Junior Member
 
Join Date: Jun 2007
Posts: 5
Ok, gheghe .. done it, AS is pretty cool .. never worked with it ..

So shortcut version, i didn't want to reload the flash movie everytime
the user clicked somewhere in the menu.

So this is the code (based on my envirement).

I've put this at the first frame.
Code:
// function for saving the current frame
function saveCurrentframe() {
	LSO.data.currentframe = this._currentframe;
	//trace(LSO.data.currentframe);
}

//create the Local Shared Object
LSO = SharedObject.getLocal("pacman" );

//check content currentframe and do something
if(LSO.data.currentframe != null && LSO.data.currentframe != 350)
  gotoAndPlay(LSO.data.currentframe);
else
   LSO.data.currentframe = 1;

gotoAndPlay(LSO.data.currentframe);
So... I check if the currentframe is empty (not set) or at the end of my movie (frame 350), set it to 1 (so it starts at the beginning) and play the frame, if it's not true, play the saved frame.

The function saveCurrentframe(), has been put on every frame left (counting from 2), copy paste it

Well if someone has a better solution or has some modifications, please reply ..

(Used Flash CS3)

Cheers
dbforch is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:24 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.