PDA

View Full Version : Skip Frame Q...



jjdelv
March 9th, 2009, 02:43 PM
So...

I have a page which has an intro animation which lasts 314 frames and finishes with a button. When you click the button it takes you to a separate html page with a scrolling photogallery. When I click the 'back' button in the photogallery it takes me back to the first html page with the intro animation.

How do I make sure that when I click the back button it skips the first 314 frames (bearing in mind I am returning from a separate html page)?

Whoever answers this is a total star...

IQAndreas
March 9th, 2009, 04:36 PM
I don't know how this can be done in HTML, but if you have PHP, you can store a session variable to see if the user has already accessed the front page.

Or, after the introduction (a swf stored on the index.html page) you could redirect to index2.html or main.html which contains what is supposed to be at the end of the index.html swf.

If you need help with any of these two, just ask, and I'll write up some sample code for you.

IQAndreas
March 9th, 2009, 04:52 PM
I have got it! Use Shared Objects, or "Flash Cookies".

I'm guessing you are using AS3. Here is the sample code you could use in the intro SWF on the first frame:


var so:SharedObject = SharedObject.getLocal("introSettings");
if (so.size == 0)
{
// Shared object doesn't exist.
so.data.seenIntro = false;
}
if (so.data.seenIntro == true)
{
gotoAndPlay(314);
}


In frame 313 (it actually would still work in frame 314), place the following code:


so.data.seenIntro = true; //This data won't be written to the cookies until you use the command below
so.flush();


You might also want to add error checking, but that is not necessary.

You might also want to add a label to frame number 314, so even if your animation's size changes, you won't need to change any of the above code to match.

Just ask if you need more help.


:top_hat: < I love these smileys...

jjdelv
March 9th, 2009, 09:08 PM
My word, I love you so far!

It does indeed work but I'm having one minor (or major... I can't decide!) problem.
Once I've implemented your code I can no longer see that introduction... EVER again.
That is not a problem when moving back from the image gallery, but I would like to be able to see it again if I come from the main 'home.html'.

Let me explain.

At the moment I have 'home.html', if i click on a button it takes me to 'cake.html' where the into is housed, at the end of that intro a button pops up which if clicked takes you to the photogallery. The code you have given me so far has helped me miss the Intro when coming back to 'cake.html' after visiting the photogallery. That is amazing, but if I go back to home.html would it be possible to write some code that deletes that cookie so I can see the animation if coming from there?

Cheers my friend!



I have got it! Use Shared Objects, or "Flash Cookies".

I'm guessing you are using AS3. Here is the sample code you could use in the intro SWF on the first frame:


var so:SharedObject = SharedObject.getLocal("introSettings");
if (so.size == 0)
{
// Shared object doesn't exist.
so.data.seenIntro = false;
}
if (so.data.seenIntro == true)
{
gotoAndPlay(314);
}
In frame 313 (it actually would still work in frame 314), place the following code:


so.data.seenIntro = true; //This data won't be written to the cookies until you use the command below
so.flush();
You might also want to add error checking, but that is not necessary.

You might also want to add a label to frame number 314, so even if your animation's size changes, you won't need to change any of the above code to match.

Just ask if you need more help.


:top_hat: < I love these smileys...

IQAndreas
March 10th, 2009, 01:08 PM
Hmm... Indeed a tricky situation. This could easily be solved using PHP cookies to store things, but that is really not so "easily".

I have another idea, but I have a few questions...

1. Do you have any SWF on the "index.html" page?
2. Do you have any SWF on the "gallery.html" page?
3. Would it be possible to set the animation on the "index.html" page, and then when the user clicks the button, he is redirected to "cake.html"?
4. Do you have a sample site set up already with the contents and SWFs that you will be using?



:pac: < Waka waka waka waka waka

Anogar
March 10th, 2009, 01:10 PM
Put a tiny SWF (1x1) file on the pages that you want to 'reset' the SharedObject.

jjdelv
March 11th, 2009, 09:25 AM
The site is not yet online (and irritatingly it wont let me upload the .fla)... and no, I can't move that animation onto the index page. I don't think I have any swfs on either page.
I'm pretty new to this game so everything is based in my library thus far...

What do I need to do? I'm trailing behind!

Thank you so much for your help so far though!