Loaded movie pathing problem - quick one i promise

hi,

i have some code in my main movie which load in a couple of swfs.
in mc2.swf there is an mc called button.

why does the code below not work (and make the button active)?


createEmptyMovieClip("mcPlaceholder1",0);
mcPlaceholder1._y = 0;
loadMovie("mc1.swf","mcPlaceholder1");


//createEmptyMovieClip("mcPlaceholder2",1);
mcPlaceholder2._y = 200;
loadMovie("mc2.swf","mcPlaceholder2");

this.mcPlaceholder2.button.onPress = function(){
	//_parent.mcPlaceholder1.stop();
}

if you know why, please let me know (the actual file i’m working on is massive with lots of functions on the main timeline that need to be referenced by the child swfs - so even though i’m sure the answer is simple, it’s really important)!

thank a million

kd

This is probably not the answer per se but ‘button’ is one of those reserved words that you shouldn’t use as a name for anything. May or may not make a difference in this case but you might want to reconsider changing that.

Other than that - are you sure you want to use ‘this’ in the path?

:hr:

oops the “this” should not be there, and i have tried with other instance names.

any other ideas?

anybody?

Sorry to be pushy, i got a tight tdeadline (about 12 hours)!

Try this:

createEmptyMovieClip(“mcPlaceholder1”,0);
_root.mcPlaceholder1.loadMovie(“mc1.swf”);

createEmptyMovieClip(“mcPlaceholder2”,1);
mcPlaceholder2._y = 200;
_root.mcPlaceholder2.loadMovie(“mc2.swf”);

_root.mcPlaceholder2.button.onPress = function(){
_root.mcPlaceholder1.stop();
}

hi,

nope doesn’t work. basically whatever i do, any code i have (on the main timeline) for instances inside the loaded swf do not work!

i tried _root, this. etc - but nothing is working.

try it and see if you have the same problem.

thanks for the reply

kd

Okay let’s backtrack a moment here. So you are creating the empty movie clips in the main movie right? And then you are loading external swfs in. Are they loading successfully? You can see them an everything? If there is animation on them then it should start as soon as it is done loading.

:hr:

you need to make sure the move is loaded before you can do anything to it.
Set up a loop to compare getBytesLoaded()/getBytesTotal().

right

the swfs are loading fine (and playing automatically).

on swf2 i have an mc button.

on the stage i have the .onPress AS for the button that is in swf2.

The instance names are all correct, there are no typos.

what is going on!!!


in my real project i am loading in swfs (seriously big ones) and i want the loaded swfs to execute functions on the main timeline.

But i really don’t want to complicate this thread!!!

please help…

hey Stringy,

if the child movie is playing, then it’s loaded - right?

yes it is but maybe it has passed your button code before it loads

yeah but i tried putting the .onPress code a few frames further on as well.

if you want to upload the files,i`ll have a quick look.

Put a trace on the button see if it returns anything.

e.g.


_root.mcPlaceholder2.button.onRelease = function(){
trace("button has been pressed");
}

here are the files.

lunatic - yeah i tried that but seeing as i can’t make the button active, not of much use!

see if you can see anything in the files.

thanks!

Unexpected file format - are you in MX2004? Can you save as MX?

http://www.gifsrus.com/testfile/master.swf
i put a stop action in the first frames of the movies you are loading and then a bytesloaded preloader type thing in master with a command to play() and the button action.

hey

try this.

Just got Flash MX 2004, didn’t even think about it!

hey Stringy.

Could you upload the fla please?

That would be brill

cheers,

you could also give your button in mc2 the actions
on(release){
_root.mcPlaceholder1.stop();
}
that does work… but i guess you want to use the .onPress function?