PDA

View Full Version : alternating movie levels


borago
12-26-2006, 03:36 PM
hi folks,

am choked with a problem at the mo....

i have several 'pages' of a book, some of which are quick intenstive with animations and flowery visuals. each page is a seperate swf file. i want to be able to click a link on a certain page, which takes me to another page and unloads the pervious one (...the player slows down on older machines if i keep all of the pages open on different levels).

and i want to be able to keep the current page open, with an animated cursor (a tasteful simple hourglass) rolling away until the new page is loaded, so there are no gaps or inconsistencies when viewing.

my approach has been this....

1. create a blank intro page which loads the first page in to level 1 using loadMovieNum [loadMovieNum("page1.swf",1)]

2. linking to page 2 by using loadMovieNum [loadMovieNum("page2.swf",2);]

3. when getting to page 3, things get a little tricky as the user could go back to page 1, or page forward to page 3, and this gets trickier the further on in the book (e.g. page 23 could link to page 22, and 24, but also page 2). So i thought I could alternate the levels that each page is on (using just level 1 and level 2) and load the next page into the available level.....

button.onRelease = function()
{
if (this._level = 1)
{
loadMovieNum("page3.swf", 2);
}
else
{
loadMovieNum("page3.swf", 1);
}
};

4. to unload the previous page, i thought that similar code at the beginning of the actions layer of each page could check the current layer and unload the previous one...

if (this._level = 1)
{
unloadMovieNum(2);
}
else
{
unloadMovieNum(1);
}


It all seems to make sense to me and seems quite logical, but it dont work. i have tried using _level1 or _level2 instead of only a number, but to no avail. Have also checked out the internet for some ideas but am going cross eyed.

Can anyone help? Am i totally barking up the wrong tree??

Many thanks

David

Scottae
12-26-2006, 06:05 PM
Use == equality operator (http://livedocs.macromedia.com/flash/8/main/00001822.html) instead of = assignment operator (http://livedocs.macromedia.com/flash/8/main/00001800.html)