PDA

View Full Version : plz make my nav listen to me!!!


gonda
09-26-2003, 10:37 AM
Can anyone help me with this?

"balk.swf" is my navigation and contains 8 MC's
I want to load (attach) "balk.swf" in another file and then when I click my navigation I want another file to be attached (my content). So my main fla contains 2 attached fla's "balk.swf" and the the "content.swf".

This script is the "balk.swf" but it's not working!!!

var i = 1;

while(i <= 8) {
// movieclip on stage
_root.attachMovie("balk"+i,"balk"+i,i);
// position
_root["balk"+i]._x = 0;
_root["balk"+i]._y = 90 + (i*20);


// store data
//_root["balk"+i].id = welkeBalk[i];


_root["balk"+i].onRollOver = function() {
this.gotoAndPlay("over");
}

_root["balk"+i].onRollOut = function() {
this.gotoAndPlay("out");
}

_root["balk"+i].onPress = function() {
this.gotoAndStop("press");
//["balk"+i] == ["balkb"+i]
}

_root["balk"+i].onRelease = function() {
//this.gotoAndStop("press");
createEmptyMovieClip("externalMovie",20);
externalMovie.loadMovie("content.swf");
externalMovie._x = 200;
externalMovie._y = 0;
}

// keyframe
_root["balk"+i].gotoAndPlay("start");

counter
i++;
}


When I run a test movie on "balk.fla" it works, but if I attach it in my main file, it doesn't. This is the script of the main file :

createEmptyMovieClip("externalMovie",30);
externalMovie.loadMovie("balk.swf");
externalMovie._x = 50;
externalMovie._y = 50;

externalMovie.getDepth();

I tried to leave _root or put it in front, but it doesn't help, and I think the depths are quite alright like this. Right??? :(

please help me out ...
;)

webguy
09-26-2003, 11:14 AM
Bad Nav..bad bad bad!

I think this is your problem...


_root.attachMovie("balk"+i,"balk"+i,i);

// unless you have several 'balk' instances in your library it will not listen.



Also you mentioned that it was called 'balk.swf', wouldn't you use loadMovie for external assets?

Whoops bailed a little early. :D

When I run a test movie on "balk.fla" it works, but if I attach it in my main file, it doesn't. This is the script of the main file :

Because your dot notation is no longer correct. When you use _root as a reference you are in effect targeting _level0, which will always be your main stage. So if you load say MC1 into MC2 and MC1 has a reference to _root (as you have in 'balk.swf') then you are now referencing MC1's _root. You will have to use relative referencing. Like _parent.mc1, etc.

webG

gonda
09-26-2003, 11:19 AM
Yes, I have 8 MC's in my library called balk1, balk2, balk3 ... untill balk8. So I thought I could fix it with a while thing ... no?

Thing is that this script (the first one) works fine when I test it. But when attached in another file it only shows the background ... and no buttons!

gonda
09-26-2003, 11:27 AM
_parent is not working either ... wait, let me explain again, cause I think I'm being very confused ... maybe it's not all the fault of my nav after all :D

I have a main file : main.fla
I have 2 swf's : balk.swf and content.swf

I want to load "balk. swf" and "content. swf" in my "main.fla"

"balk.swf" works on its own when I test it, but if I attach it in main.fla ... I don't see the buttons (the 8 MC's in balk.swf's library)

better?? I think so ... so you tell me to use _parent instead of _root ... but that doesn't change anything

if I do the debug thing both files, balk & main are on level0

webguy
09-26-2003, 11:32 AM
I'm sorry i am spacing out here..hehe.

when you use loadMovie on an external swf (balk.swf) you lose all of it's library contents. You can no longer attach things from balk.swf's library if you import it into another file. You will have to put it in the movie being loaded into's library or put it on stage and dupe it, or use loadMovie. Sorry about that.

web