PDA

View Full Version : There must be a way to do this...


Whereegosfly
09-03-2003, 03:22 PM
Hi everyone! I'm new to this board but have visited here very often!
I'm not a techie by any stretch of the imagination...so here goes:

Ok, here's what I have:
a layer0, layer1, and a Layer2. Layer0 is the base that contains 5 buttons. There's a "movie1.swf" on layer1 and a "movie2.swf" on layer2. Each movie has a preloader on it.

Here's what I want to do: click a button (say button 3) and for the movie2.swf on layer2 to move down to layer1, (knocking off the movie1.swf) and then a "movie3.swf" moves into layer2 spot. The idea being that each button loads its particular "movie.swf" on to layer 2 and pushing what once was on layer2 to layer 1.

The reason I'm doing it this way is because I want to load rather large files in these layers and I want to show the loader on top of whatever was the old top layer. Obviously, if the files were small, I could just nudge whatever was attached to say, an empty movie clip, and there would be no need for showing the underlying layer. It's just that it looks so choppy when I load a movie and the one that was there first all of a sudden is gone, and then the new one pops up. That's is rather distracting! I want the new movie to look like it's fading over the one that used to be on top.

Sorry if I sound like I'm repeating myself here. I've tried doing the swapDepths.. and that works fine for 2 layers etc...but I have 26 movies or swfs to show, each with preloaders.

Thanks very much for your work in the past... and I look forward to hearing from youze all :-)
Michael

webguy
09-03-2003, 03:36 PM
by layers I'm assuming that you mean levels. Why not increase the level with every loaded movie. So first one is level1 and then level2, that way the newest loaded movie will be above the previous. So you can set an enterFrame event to fade the current clip out, and then fade the new clip in at the same time.

IE:

levelCount = 1;
nM = _root.loadMovie("movie.swf", levelCount++);
nM._alpha =0;
nM.onEnterFrame = function () {
if(this._alpha < 100) {
this._alpha+=10;
}
}
["_level"+levelCount--].onEnterFrame = function () {
if(this._alpha > 0) {
this._alpha-=10;
} else {
this.removeMovieClip();
}
}


I don't know about that ["_level"..] code.. I always have problems with references like that.

Otherwise there is nothing you can do to swap levels. You can duplicate the MovieClip and place the duplicate at the level you want, and remove the original. That is about it.

web

Whereegosfly
09-03-2003, 05:48 PM
Hey thanks WebGuy,
I don't know how you figure things out like this. It seems that Flash information, especially in Flash books are written by engineers who have great senses of humor...but not much realization that the people who are reading their material are below the writer's experience level. If the reader already understood the material, why would the reader be reading it? Anyhow enough venting for today. I appreciate your help and will get back to you on this adventure.
take care "guy"
Michael

webguy
09-03-2003, 06:09 PM
no prob. I had the same outlook as you when I first started actionscript..about 3 months ago. I didn't know anything about anything. Now I know very little about something..lol. No really I was charged with the project of creating a new flash website, because our compitetion outsourced one and I can't have their website being better than mine ;) So I bought Collin Moock's ActionScript for Flash MX and I'll tell you what that guy has it on lock. Everytime someone wants an actionscript book, that one is suggested and given the highest of marks. I read that thing twice (not the language reference) just his explanations. Very concise, very helpful. Look into it, a great resource. I've read 2 other actionscript books. and I haven't looked at them since. I am going to buy Colin's book again because it is very tattered from much use :D

web

Whereegosfly
09-04-2003, 01:04 AM
Hi Web,
this afternoon I came up a compromise to what I asked this morning. I decided to go with the layering on top of each other with this code for each button:

buttonone.onPress = function () {
loadMovieNum("layer1.swf", ++i);
that.text=i;
}

buttontwo.onPress = function () {
loadMovieNum("layer2.swf", ++i);
that.text=i;
}

...etc. for each button
here's the result, though it looks really basic, it does the job!:

http://members.aol.com/MBona19554/1.swf

Though I'm worried about having so many animations under each other (could be a total of 25!) That's why I wated to get rid of the underlying layers.
Eventually, the swf's will fade over the old... not like the way this simple example does.

Thanks again Webguy!
Michael