PDA

View Full Version : Re...another AS trap



Inflicted
September 12th, 2003, 10:09 AM
I posted a thread yesterday (...another AS trap), but I realize the questions were not clear. I've spent the whole day trying to fix it, but my head is just a mess now.
The problem is, in the main.fla I load an swf, that loads another swf, that loads several swf's!!! How can a newbie get lost...

Is someone willing to take a look at my movie?

Thanks

regards

http://www.tantesteef.nl/Files.zip

blah-de-blah
September 12th, 2003, 10:40 AM
sorry i don't have much time....but i'm pretty sure its the targetting problems. Have you tried using _parent instead of _root? It won't work until you actually load the movie from the main movie...

Voetsjoeba
September 12th, 2003, 11:47 AM
And what's the problem exactly ? What mc is not loading while it should ? And by the way, the code in the Actions layer, is it supposed to stay like that or is it temporary ? If not, it can be shortened very much ...

Inflicted
September 12th, 2003, 12:30 PM
Oh, if you can show me how to shorten that code, please! I knew it should be possible, just don't know how.
The biggest problem is that in the main movie
when you hit the "speelgoed" button, you see the line "BRIO" at the bottom. This triggers the brio.swf. In the brio.swf the buttons trigger other swf's. But they show up in the wrong place! They should show up at x=0 and Y=125. Anyway, I found out I still got a long way to go, back to the tuts!!

Hope to hear from you

regards

Voetsjoeba
September 12th, 2003, 12:36 PM
Here's how to shorten the code:



for (i=1; i<=7; i++) {
this["btn_"+i].onRelease = function() {
_root.blok_mc.imageSymbol = "speelGoed";
_root.blok_mc.textfileUrl = "scherm.txt";
_root.blok_mc.gotoAndPlay(2);
};
}


You used this._aprent.blok_mc, which is relative so I was unsure to change it to root, but it didn't look like a file to be loaded into another, so I changed it anyway. If you require the paths to be relative, just change it back :)

I'm gonna go have dinner now, I'll have a look at your FLA when I get back :)

Voetsjoeba
September 12th, 2003, 01:25 PM
I had a look and saw that "piraten.swf", triggered by the link BRIO piraten, loads at the top, but it's as wide as the whole movie ! How do you want this to be positioned ?

Inflicted
September 12th, 2003, 01:40 PM
I think I get the code there, except, what does the "i" stand for?

As you can see the main movie has a sort of a "window". This "window" is 800 X 335, and is positioned at x=0 and y=125. When I test the file brio.swf, the loaded swf's are in the right position. But when I load it in the main movie, it's positioned at the top. That's the main problem.

Where would that code problem be? In the brio.swf I suppose, could you take a look at it? Thanks for your time, man.

regards

Eric Jr.
September 12th, 2003, 01:51 PM
"i" is a variable, made in when you initialized the for-loop, which increments each time a loop takes place. Once the condition in the loop returnes false, it stops looping:

for (init; condition; next) {}
In this case, the init part creates the variable "i" and sets it to "1".

The condition is "i <= 7", meaning it will proceed with the loop if that is true. Well, "i" is smaller then 7, so it loops.

Next increments the value "i", so every loop, "i" increments, untill is it 8, then it stops.


"i" is the generally used variablename for loops, its short for "identifier". Loops within loops usually continue in alfabetic order, "j", "k", "l" ..etc

Voetsjoeba
September 12th, 2003, 02:19 PM
You have quite some errors in brio.fla. The main errors were

- Creating an empty movieclip in _root, which should've been this for the known reason that _root will become _root of the host movie when this movie is loaded into the host movie.

- Using loadMovieNum. This loads into level1, which will be level1 of the host movie. Instead, use a movieclip to load them into and thus the loadMovie action.

I'm busy fixing it all now ...

Voetsjoeba
September 12th, 2003, 02:44 PM
I've spent some time on it, but here it is :)

http://users.pandora.be/voetsjoeba/inflicted.zip

Pay attention to the paths; they were messing up your whole structure. When testing a movieclip on its own, it will work using _root, but when it is loaded by another movie that is again loaded by the main movie, _root will become the main timeline of the main movie and no longer the loaded swf.

Inflicted
September 12th, 2003, 03:09 PM
Voetsjoeba,
Thanks a lot, man...
I'm gonna take a severe look at it and to what I've done wrong. Thanks for your time and effort, and if you don't mind , I'll get back to you on this tomorrow.

regards!

Inflicted
September 14th, 2003, 09:40 AM
Voetsjoeba,
I will still get back to you with a few questions, if you don't mind, but here's a preview of the site. Still got aproblem with text display, posted athread in D&D about it.

http://www.tantesteef.nl/new_site.html

Thanks again!

regards