PDA

View Full Version : Help with SWAPDEPTH tutorial


jake88
01-04-2001, 11:16 PM
Jesse, is there any way to modify the swapdepth tutorial so that the windows could have different names? I can't seem to make it work. I've tried the following:

on the main timeline, I have 2 windows and I've named the first one window1update and the 2nd one window2news.
I left the original code in the time line as it was discribed in the tutorial. in the 1st window's button, I put the following:

on (press) {

this.swapDepths( "_level0:window" + _level0:highest +"update" );
_level0:highest = substring ( _name, 7, 1 );
startDrag ("_root.window1update");
}
on (release) {
stopDrag ();
}


and in the 2nd window's button I have:

on (press) {

this.swapDepths( "_level0:window" + _level0:highest +"news" );
_level0:highest = substring ( _name, 7, 1 );
startDrag ("_root.window2news");
}
on (release) {
stopDrag ();
}


but it doesn't work. Help Jesse? Anyone?

[Edited by jake88 on 01-04-2001 at 06:36 PM]

Jesse
01-05-2001, 12:00 AM
Do you plan on having only 2 windows on the screen? If so there's a much easier way to do it...

Let me know...

jake88
01-05-2001, 01:05 AM
Yes, give or take, around 10 windows (hopefully not more then 5 windows open a the same time- it depends on the user's interaction)

Jesse
01-05-2001, 01:16 AM
Nah, OK then, if you're going to have 10 windows total (even if they're not on the screen at the same time) you'll have to stick witht he old style.
You don't have to name them 'window' but you have to keep a standard name which ends in a digit. Each box has to have the same name with a different digit.
Why? Because when you .swapDepths() you need to be able to tell it who to swap depths with. And how are we doing that at the moment? We're building the name of the target from the word "window" and the number of the highest window.
You could just as easily call them "box1", "box2", etc but then you woul dhave to change my substring call. There are 6 letters in "window" and I want the 7th lette rin the name because that will be the number of the window:

1 2 3 4 5 6 7
w i n d o w #

where # is the number. Get it? So if you rename them box you woul dhave to do:
_level0:highest = substring ( _name, 4, 1 );
because for box it's:

1 2 3 4
b o x #

Don't get me wrong, it's possibel to do it where the names are: "windowPortfolio" etc etc, but it would involve a lot more work and it wouldn't really effect the output at all.

Cheers

Jesse

jake88
01-05-2001, 04:21 AM
Cool, Thanks Jesse! I guess I'll just stick to the normal names that were used in your tutorial.

By the way, thanks for the tutorial. Very easy to follow.

Jesse
01-05-2001, 04:29 AM
Not a problem. Thanks for the compliments :)

flyrod
01-19-2001, 04:03 PM
hey jesse - concerning swapDepths():

do the MCs have to be the same? meaning, can i loadMovie(red.swf) and then loadMovie(blue.swf) and have them swapDepths()?

one other thing:

i am using a FSCommand exec to launch applications from my computer (basically pointing the button to a shortcut of the actual appliaction). i have word, excel, photoshop, ilustrator, flash, dreamweaver and many others... but can i have flash "add" buttons thru user interaction that will also do this? meaning, if users do not want to use photoshop or flash, but want to use acrobat or powerpoint, can i have flash drop and drag buttons from a loadMovie(choices.swf) and add them to the main movie? i know this is asking alot of action script, but what the hell, why not push the boundries.

or, can they input a name (say acobat) and have that button added to the main movie?

btw, our tutorials and this forum is without a doubt the best i have found.

tah!

Jesse
01-19-2001, 10:24 PM
Yeah you can, provided you load them into 2 blank MCs on the main stage on the same level. So on level0 create 2 isntances of a blank MC with instance names, then load your lcips up into those.

The other is possible, but you would only be able to add links for file types that you creates manually. So you would have create all the buttons manually, then set their Visibility property to True or False based on the user preferences. That much wouldn't be too hard... except storing the preferences would get a bit tricky on a local HDD...

Cheers

Jesse

flyrod
01-22-2001, 06:42 PM
hey jesse - i have tried loading the MC into a blank MC

on (release) {
loadMovie ("search.swf", "load1");
}

this happens multiple times. i have set the number of MCs equal to the number of levels (z coord). but the depth does not change on the loaded MCs. i have named all of the MCs the same with a number (app1-10).

do i have to change something about the loaded MC? i assumed the loaded MC would target the blank MC (app8-10) and sit inside of that..?

tah!

Jesse
01-22-2001, 10:42 PM
If you're loading them onto level0 there should be no problems. Remmeber that the code is dealign with windows called 'windowX' so if you lable yours 'loadX' it wont work...

Cheers

Jesse

flyrod
01-23-2001, 01:27 PM
thnaks jesse - but the swapDepths still isn't working. i changed the name of the blank MCs to app8-10, but no change.

tah!

Jesse
01-23-2001, 10:32 PM
hmm ok I'm going to try this one out myself today.
What you want to do is swapDepths loaded clips right?
So I'm going to put 3 blanks MCs on the same level of the main stage of one movie, then load 1 SWF into each and see if I can't get it working...

I'll let you know

CHeers

Jesse

Jesse
01-24-2001, 12:03 AM
OK I got it working. Simple as pie :)
See the example here (http://www.actionscripts.org/help/swapDepths_loaded_movies/blanks.html)

Grab the source file (http://www.actionscripts.org/help/swapDepths_loaded_movies/swapDepths_loaded_movies.zip)

Cheers

Jesse

flyrod
01-25-2001, 01:49 PM
hey jesse - this is what i already have done. problem is, i am trying to swapDepths with 11 other MCs that are already on the main stage.

i have 14 MCs/buttons, three of which load the 3 .sfw files into the main stage. but when i load them, they won't behave like they are supposed to.

it looks like this:

app1
app2 <--- these launch predefined applications
app3
...
app11

then...

on (press)
on (press) <--- these call the MCs into the three blank MCs
on (press) which are named app12-14

app12 is an email .swf
app13 is a file search
app14 is a txt to xml converter

any ideas with this?

oh! also, the unload (i guess CLOSE) function does not work. i am thinking back to when you told me about the _visible function... can i just have the MC preloaded and on (press) have the visibility change o true?

Jesse
01-25-2001, 10:55 PM
That sounds easier because you've lost me in that last description :)

on (press){
_root.object._visibility = True
}

Cheers

Jesse

venkman
06-03-2005, 03:16 PM
whats up.. nice tutorial yo, but i am having trouble adapting it to what im trying to do with it.

i have 3 empty movieclips that are on stage to load pictures. container1, container2, container3 and a series of pictures. they load in when the playhead goes to a new frame (at the moment)

container2.loadMovie("06.swf");

so the user clicks a button and the playhead moves to a marker (and stops) .. and in there the container is identified and loads. what i would like to do is make sure that the new movie is always loading ontop of the last one: because if it loads underneath then you wont see it - obviously.

i tried:
container2.loadMovie("02.swf");
container2.swapDepths( "_level0:window" + _level0:highest );
_level0:highest = substring ( _name, 10, 1 );

but i'm not too hot at AS so i guess i have something wrong. i got rid of 'this' because the script is now in a frame and not in the movieclip / button. the buton i am using just moves the playhead to a different place. to be honest i have kinda tied myself in knots thinking about this: im sure there is a simple way to do it.

any ideas? :)