Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Load/Unload

Status
Not open for further replies.

Rhiannon

Technical User
Feb 8, 2002
55
US
Okay, here's what I've got going on:

I've got a page in this site I'm doing that has a menu of web sites that I want people to be able to click on and view screen shots, etc. When you first enter the page, the menu drops down and the first site on the list loads into a placeholder movie clip called "wsholder" and is set into position. There's an arrow underneath of this screenshot that takes you to the second one and you also have the choice of going back to the previous one. (This is a movie clip in this swf). And yeah!! it works! :)

My question is, how do I unload this first swf file that's in this movie clip "wsholder" and load the next web site in it when you click on the appropriate button? I tried unloading "wsholder" and loading the next swf but it didn't work. Apparently once the first web site loads into "wsholder" it's then considered a "parent" cos this is how I had to address it to get it to go to the next screenshot. (Hope this makes sense.)

To get a better idea of what I'm talking about the URL is Once you get to the homepage click on "portfolio" and then "web sites" and you'll see what I'm referring to.

Also, please note this site is still a "work in progress". :)

Thanks for your help from all you Flash wizards!
Rhiannon
 
load them all on the same level.... when a movie loads into a level it will automatically replace any movies already on that level. Ya' Gotta Love It!
sleepyangelsBW.jpg
 
Hi Tulsa,

I did that. Have a version where I load all the movie clips on that one page, but thought I'd try it this other way to keep the file size down.

 
As for levels, when you load a new external .swf (is that what you're doing?) into a holder clip, it will automatically replace the movie clip that was there previously.
The only way to cut down on size of the main .swf is to load those external movies on demand, since the main preloader igores loadMovie actions. If your using movie clips, they will all be loaded in the initial download, thus not cutting down on size.
Anyways, it's a bit hard, to really suggest something to fix your current problem, without seeing the actual coding, and based solely (no offense!) on your description.

Regards,
new.gif
 
Ok. Understand what you're saying. My question is, how do you replace that initial external swf that's first loaded into the placeholder with a new swf? The reason I'm loading that swf into the placeholder is to position it on the stage.

If I use the just the loadMovie command without the placeholder how do I set the Properties to set the position of it on the stage?

Seems most of my confusion comes in when dealing with loading/unloading of mc's and swf's. :)

Glad I've got a few actionScripting books on order. :)
 
What I am trying to tell you is NOT to load them all at once... if you are concerned with file size then only call them as you need them. You do have to specify a level to put them on... _root is level 0 and the levels just stack up from there.

What you do is specify...say... level2 in the loadMovie script which loads your 1st movie... when the button is pushed or the frame is reached which loads the 2nd movie... since it is also specified to be loaded onto level2 it will automatically REPLACE the 1st move thereby rendering any unload action to be of no benefit.

If you are concerned with file size this IS the correct way to do it. Ya' Gotta Love It!
sleepyangelsBW.jpg
 
Another question. If I initially load all the movie clips, and then I click on the "Ad Insights" button, and that movie clip comes up, then later on after I've gone through the list and I want to access Ad Insights again, won't I have to reload that movie clip?

I tried using this code:

on (release) {
tellTarget ("_level1.ami1") {
gotoAndPlay (2);
}
}

Didn't work. (ami1 being the mc instance name).
 
you can set the properties of your loaded movie by addressing its level(_level2) the same way you would in the parent(_root) and using set property functions. Ya' Gotta Love It!
sleepyangelsBW.jpg
 
One other note... The tell target is deprecated in Flash 5.
Your above script would be better written as:

Code:
on (release) {
    _level1.ami1.gotoAndPlay (2);
}

Regards
Ya' Gotta Love It!
sleepyangelsBW.jpg
 
Okay. I get all that about loading the swf into a specific level and then any others replace it. I've done that successfuly in other areas of the site. But for some reason I can't get this external swf to load the set properties.

Am using:

loadMovieNum ("ami.swf", 1);
setProperty ("1", _x, "235.0");
setProperty ("1", _y, "122.9");

It's not working. When I debug the movie I can see that these variables are still set to "0".

Ok, I know it's Friday but my brain isn't that fizzled out, is it? :)

Appreciate your help, Tulsa.
 
When working with different levels, if the "to be loaded" movie (the first one or any of them...) is of the same dimensions as your main movie, and created based on the dimensions of that main movie, then no actual positioning or scaling is necessary. It will be aligned from the top left corner and should fall right in place.
The same goes for empty holder movie clips. If your holder clip is of the same dimensions as the main movie, and you load in an external movie that was designed with those dimensions in mind, then, once again, everything should fall right in place.
If this is your situation, then the use of the loadMovie action on your 5 (or whatever...) buttons on the left side, should work fine! Each button in turn, loading a new external .swf on the same level, thus each time replacing the previous movie. The same applies for loading them in an empty holder clip.

The coding on the lower arrow clip is another story, but basicly based on the same principle. It should be a serie of 5 frames (move by the click from one to the other so that they cycle - and probably with a variable check to determine when it's on the last frame of that cycle), that basicly load the same external movies on a same level or in the holder clip.

One thing I noticed, which might complicate things, is this "shape tweened transition", you seem to be wanting to use between each web site picture. This would require a little more thinking, because then the loadMovie action has to be placed in the transition clip itself and not really in the buttons' coding. In other words, what the buttons would actually have to do is called the transition, while telling it which movie to load. While in it's closed position, it's then the transition that would do the actual loading. Not as easily done than said!

Regards,
new.gif
 
loadMovieNum ("ami.swf", 1);
setProperty ("1", _x, "235.0");
setProperty ("1", _y, "122.9");

Replaced by...

loadMovieNum ("ami.swf", 1);
_level1._x = 235;
_level1._y, 122.9;

Not sure if it wouldn't be better to just use 123 on the second one!

Regards,
new.gif
 
Sorry typo in the above!

loadMovieNum ("ami.swf", 1);
setProperty ("1", _x, "235.0");
setProperty ("1", _y, "122.9");

Replaced by...

loadMovieNum ("ami.swf", 1);
_level1._x = 235;
_level1._y = 122.9;

Not sure if it wouldn't be better to just use 123 on the second one!

Regards,
new.gif
 
Think I have it worked out now. Thanks for all your help guys!

Oldnewbie, any way you could email me that bird fla? Wanna see the difference in the code.

Cheers

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top