Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

play intro once 1

Status
Not open for further replies.

thompom

Technical User
Dec 4, 2006
395
GB
the main page for my site has an intro that lasts 3 seconds - the problem is if a user clicks back or wants to return to the page they have to sit through the intro again.

whats the best way to stop this?
i thought about making another page without the intro but most users click back and this would not stop the problem.

the entire page is done with flash
 
I'd use SharedObject class. It is just like a browser cookie. In your scenario retrieve a SharedObject in the frame 1 and if, say, "visited" is "true" skip the intro, if "undefined" set it to "true" and play the intro - the next time it hits the frame 1 since "visited" is now "true" it skips the intro.

Kenneth Kawamoto
 
thanks for your reply!

can you give me a bit instruction - that was way over my head
 
have found thee follwing code which may be useful
but dont know how to change it

Code:
// Get the kookie
so = sharedobject.getlocal("sccookie");

// Get the user of the kookie and go to the frame number saved for this user.
if (so.data.user != undefined) {
	this.user = so.data.user;
	this.gotoAndStop(so.data.frame);
}

The following code block is placed on each movie frame.


// On each frame, call the rememberme function to save the frame number.
function rememberme() {
	so.data.frame=this._currentFrame;
	so.data.user="John";
}

 
ok - have created a new layer and put the following code
on the first frame - but my movie just runs the first few frames

Code:
mySO = SharedObject.getLocal("scintro");
if (myso.data.name = "seenit") {
	this.gotoAndStop(153);
}
if (myso.data.name != undefined) {
	mySo.data.name = "seenit";
    success = mySO.flush();
}
 
...sorry forgot to comment

Code:
//get the cookie
mySO = SharedObject.getLocal("scintro");
//if the cookie = seenit goto frame 153
if (myso.data.name = "seenit") {
    this.gotoAndStop(153);
}
//if name doesnt exist write sceneit to cookie
if (myso.data.name != undefined) {
    mySo.data.name = "seenit";
    success = mySO.flush();
}
 
Code:
stop();
//
mySO = SharedObject.getLocal("scintro");
if (mySO.data.name == "seenit") {
	this.gotoAndStop(153);
} else {
	mySO.data.name = "seenit";
	success = mySO.flush();
	play();
}

Kenneth Kawamoto
 
thanks ken - heres a *
but have an issue with the gotoandstop

at the moment it says this.gotoandstop
so i think it sticks on frame 153 of that layer

what is the syntax to get it to goto frame 153 of the whole movie?
 
i am new to flash - so bear with me

i created a new layer in the main timeline called cookie
and inserted frames along the timeline the length of the movie
on the first frame of this layer i put the code

also, the layer is at the top of all the other layers - does this matter?
 
That's good. Layer orders in the Timeline is irrelevant.

The code tells the play-head to skip to the Frame 153 and stop there. If you mean you want the play-head to carry on beyond the Frame 153, just replace "this.gotoAndStop(153);" with "this.gotoAndPlay(153);"

Kenneth Kawamoto
 
when i change it gotoandplay it plays the whole movie -
gotoandstop shows a black screen [the background]

Code:
stop();
//
mySO = SharedObject.getLocal("scintro");
if (mySO.data.name == "seenit") {
    gotoAndPlay(153);
} else {
    mySO.data.name = "seenit";
    success = mySO.flush();
    play();
}
 
i chose frame 153 because when i move the slider on the timeline, all the intro animation is finished by frame 152.

so i thought frame 153 was the best place to skip to.

do i have to have a keyframe on 153?
 
hi ken have put a keyframe at 153 on layer cookie
and still no joy
guna play over the weekend

thanks again
 
put a rectangle on keyframe 153 in layer cookie
and stop(); on that frame

put gotoAndStop(153); on keyframe 1

but all i get is a black screen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top