From movie1 to movie2 and back

 

The goal is to show how to load a movie in a main movie, then to come back to a particular frame in the main movie.

⇒ animation ⇐

Principle

We'll use SharedObject, Labels and LoadMovieNum.
Flash Help says :
Because the shared object is locally persistent, Macromedia Flash MX saves its data attributes on the user's machine when the movie ends.
Alternatively, you can delete the shared object before the movie ends, in which case the calculator opens without any prior values the next time the movie runs.

Right now, let's see the different stages.

A - Main Movie

Creating Objects

1 - Set up the size of the stage 320x240. Backgroundcolor as you wish.
Frame rate = 25.
In Movie Properties (= CTRL J) , toggle Stop playing at end of movie

2 - Create a text ( any size and color )
Name it Main Movie

3 - In frame 2,set an embedded effect Stream and turn in from side over 20 frames, then Tall and thin and back over 20 frames, puis Weave into center over 20 frames.
In next frame (62), put a Remove

4 - Then create a text you'll convert to button.
In frame 62 of the button, put a Place.

Scripts

1 - For the button, enter the following script :
on (release) { loadMovieNum("anim2.swf",1); }
This button allows you to load another movie in level 1.

5 - For Scene_1, enter the following script :

Save and Export (name anim1 ).

Remarks :
SharedObject.getLocal() - returns a reference to a locally persistent shared object that is available only to the current client.

SharedObject.flush() - immediately writes a locally persistent shared object to a local file.
The following values are returned:
If the user has permitted local information storage for objects from this domain, and the amount of space allotted is sufficient to store the object, this method returns true.
(If you have passed a value for minimumDiskSpace , the amount of space allotted must be at least equal to that value for true to be returned).
If the user has permitted local information storage for objects from this domain, but the amount of space allotted is not sufficient to store the object, this method returns "pending".
If the user has permanently denied local information storage for objects from this domain, or if Macromedia Flash MX is unable to save the object for any reason, this method returns false.

B - Imported Movie

Take the same sizes as previous, put in the Stage all what you wish as long as you put a button Return with the following script :

on (release) { unloadMovieNum(1); }

Save and Export (name anim2 ).
Test !

To sum up : When you run the main movie, an introduction with effects begins then is removed, a button appears which allows to launch another movie in level 1.
When this movie ends, a click on a button allows to return to the labelled frame GoHere of the main movie because of the reading of the data value of an internal cookie.

 


Si vous aimez le site

 

Select a language if you need :


Page chargée en 0.006 sec.

Dernière Modification : Mer 25 Janvier 2017 8:56
Copyright © 1999-2017 Jean-Paul Molina Tous droits réservés.

to Google