PDA

View Full Version : loading into container problem


sandman9
07-31-2003, 05:58 PM
on my main timeline I have this:

loadMovie("wolfe.swf", "pics");

And this loads the movie wolfe into the container pics

then i have a MC on the main timeline which has a button inside. So on that button I have
on (release) {
_root.loadMovie("CelekAd.swf", "pics");
}

When I click on this button it closes my swf file and opens celekAd.swf.

Anyone had this problem before or know why this is happening?

Sandman9

linckx
07-31-2003, 06:05 PM
isn't that what's supposed to happen?

you've got that first movie loaded in the container, and then you load another one in it so it 'overwrites' the first...

If you want to show them both use two containers

robin

Sualdam
07-31-2003, 06:08 PM
I think it should be:loadMovie("CelekAd.swf","_root.pics");It is the target clip that you need to pinpoint - not the actionscript itself.

linckx
07-31-2003, 06:10 PM
stupid me
...


indeed that is :D

robin

sandman9
07-31-2003, 06:13 PM
linchx

When i click it does not load into the container. Rather it opens such as a pop up does with web pages

Sualdam

When I get rid of the root in front then it does not work at all

Sandman9

linckx
07-31-2003, 06:15 PM
you need to type it like this

_root.pics.loadMovie("myMovie.swf");

robin

Sualdam
07-31-2003, 06:16 PM
Well you must have something else wrong, because that's the way it should be :)

Remember: the path applies to a target, and it is your container clip which is the target.

Are you sure that the frame with the clip with the button in it also has the holder clip 'pics' present as well?

Robin - it shouldn't matter: the two different syntaxes mean the same thing.

sandman9
07-31-2003, 06:25 PM
I only have the one container which is on the main timeline ......

linckx
07-31-2003, 06:27 PM
oh, never tried the other way, but if you say so :D

robin

Sualdam
07-31-2003, 06:34 PM
Or rather, see the attached.

It works exactly like I said above - check to see how your movie differs.

File1 and file2 are just two movies to load.

sandman9
07-31-2003, 06:40 PM
sorry it says my files too big ... let me cut it down

sandman9
07-31-2003, 06:44 PM
when the swf file starts up then click on the top options (first solutions button). Then once that loads click on the second thumb nail to your right and you'll see the problem.

www.harbourgreenplace.com/test.zip

Thanks
Sandman9

Sualdam
07-31-2003, 06:50 PM
Now, explain to me what I'm supposed to see.

I see the two thumbnails and I click the bottom one.

What appears to be six magazine covers then open with a text box that says 'text would go here blah blah blah'.

I am guessing that that isn't what you are seeing.

sandman9
07-31-2003, 06:52 PM
what I see is that when I click on solutions then it loads the movie wolfe.swf "into" the container. Then when I click on the thumbnail it shuts down the current swf file you viewing and opens uup celekAd.swf. Kinda like a pop up does on a webpage. Is that not what your seeing?

So basically CelekAd.swf is not being "loaded" .... rather it's opening up this .swf file .... (never ever seen this before .... Weird!)

*edit*

Sandman9

Sualdam
07-31-2003, 06:53 PM
Ah right.

The way your code is the six covers open on their own.

When I change that thumbnail button code to what I said right at the start the six covers open in the middle of the layout - which I guess IS what is supposed to happen.

This is your code on that second thumbnail:on (release) {
_root.loadMovie("CelekAd.swf", "pics");
}This is wrong and doesn't work.

Change it to this:on (release) {
loadMovie("CelekAd.swf", "_root.pics");
}and it appears to work perfectly.

<edit: And it isn't 'weird'. It's just wrong :)>

sandman9
07-31-2003, 06:59 PM
how weird!!! it works now for me too .... i may have maybe typed something in wrong then ...... (learned something new today :) )

Do you know then how to make it so the movie doesn't keep loading when you click on the same thumb nail over and over .....

Thanks again!
Sandman9

Sualdam
07-31-2003, 07:03 PM
Set a flag on the main timeline:myFlag=0;Then, in the button code put:on (release) {
if(_root.myFlag==0){
_root.myFlag=1;
loadMovie("CelekAd.swf", "_root.pics");
}
}and make sure the playhead doesn't go back through the frame on the main timeline where you set it to 0.

<edit: Or set it back to 0 when you come out else you won't be able to load it again during a session>

sandman9
07-31-2003, 07:12 PM
the script that loads the first movie on the main timeline is this
if(myFlag==1){
_root.gotoAndStop("asian");
}

So if i want to go to a differ frame label then I will say if(myFlag==2), etc etc

At frame label asian I have "loadMovie("wolfe.swf", "pics");"

Then a MC on the main timeline that has the button in it says
on (release) {
loadMovie("CelekAd.swf", "_root.pics");
}


The flag script in the start was loading text and not movies so I don't know if that's what you may be been referring to setting to 0

Sandman9

sandman9
07-31-2003, 07:19 PM
i sound confusing.

I didn't get your last post b/c I have script on the maintimeline that says if flag==1 (go here) if flag==2(then go here) etc etc. So when you said set the flag script on my main timeline to 0 you lost me

Thanks sualdam
Sandman9

Sualdam
07-31-2003, 07:27 PM
OK. Forget the name myFlag.

Let's go for myMoose instead (seeing as where you are from) :)

See my point - nothing to do with Flag, but something new and independent.

All you are doing is setting a variable that you can go and look at to see what has happened. Set myMoose to 0 in frame 1 of the main timeline and you can check elsewhere to see what value it has.

In the button, you check to see if it is 0. If it is, you set it to 1 and then load the movie. However, click again and it isn't 0 anymore so the loadMovie code is skipped.

Does that make sense?

sandman9
07-31-2003, 07:45 PM
lol .... yes I'm from canada .... beutiful Vancouver to be precise

yes that makes sense however I just realized that no movie is being loaded with a "if(myFlag==" command.

So it was my fault for not being observant b/c all the movies are being loaded with a script being put on a frame that will say "loadmovie ..." and also through a "Onrelease loadMovie..... " command

Thanks again for all the help :)
Sandman9

Sualdam
07-31-2003, 07:55 PM
Just put the code on the thumbnail. That's all.

sandman9
08-01-2003, 02:08 PM
I replaced

on (release) {
loadMovie("CelekAd.swf", "_root.pics");
}

With what you gave me


on (release) {
if(_root.myFlag==0){
_root.myFlag=1;
loadMovie("CelekAd.swf", "_root.pics");
}
}


This made the button not do anything. My guess is b/c the flag command being used before was not used to load anything (just redirect).

So isn't there a way of saying onrelease if (_____.swf is loaded) then don't do anything else load ______.swf?

Thanks again
Sandeep

Sualdam
08-01-2003, 02:36 PM
sandman

I'm really sorry for confusing you, but I didn't realise you had used the variable myFlag already.

It is already set to 1 on the main timeline which is why the button doesn't do anything.

In frame 1 of your main movie put (and forgive me for labouring this, but it illustrates my point):myGnu = 0;Now, put this on your button:on (release) {
if(_root.myGnu==0){
_root.myGnu=1;
loadMovie("CelekAd.swf", "_root.pics");
}
}Please make sure you understand exactly what is happening - we set a variable (I called it a flag, which caused the confusion) that says 'the button hasn't been clicked yet (i.e. 0)'

On the button we say 'if the button hasn't been pressed yet, note that it has by setting the variable/flag to 1, then load the movie'.

Any further clicks encounter '1' instead of '0' and so the movie isn't loaded because the loadMovie code is skipped.

Like I said last time, you'll need to set myGnu back to 0 when you exit the section otherwise people coming back into that section won't be able to load the movie when they click because myGnu will still be '1'.

Does this make sense?

I usually try things out before I post them - no matter how simple - but I didn't this time, and so missed the use of myFlag in your movie.

Sorry :)

sandman9
08-01-2003, 02:50 PM
ahhhh i see! .... well that did the trick however when setting "myGnu" back to zero I did not figure out where it goes.

I put it

on (release) {
if(_root.myGnu==0){
_root.myGnu=1;
loadMovie("CelekAd.swf", "_root.pics");
}
}
myGnu=0;


But it gave me an event handler error

then i try'd

on (release) {
if(_root.myGnu==0){
_root.myGnu=1;
loadMovie("CelekAd.swf", "_root.pics");
myGnu=0;
}
}


But this didn't work either for I cannot come back to this file afterwards (like you said)

Thanks for your help Sualdam :)
Sandman9

Sualdam
08-01-2003, 02:56 PM
You need to reset it at any point where that section can be exited.

So, put it on the other thumbnail button code, any others you add, and any buttons still visible on the stage that users can click to jump somewhere else.

Again, you must understand how the code (and actionscript) works.

Button code is event code. So, the resetting of a variable code has to go on the event trigger/button that jumps away from this section, and not on the one that focuses on things within the section.

That's why what you tried wouldn't work - a bit like trying to close a door and open it at the same time :)

sandman9
08-01-2003, 04:37 PM
yes, that I understand ..... it was just hard finding a point where the section can be exited b/c all the thumbnails are all on 1 frame (three thumbnails right now and more to come). So if you leave the section and come back your method works but when your staying on the same frame and jumping between thumbnails that don't shift in the timeeline then that's where the problem is ..... however i'll get it up and going :)

thanks a million man!
Sandman9