PDA

View Full Version : Targetting an MC - proper syntax



dmog
November 24th, 2005, 01:14 PM
I am targeting a a movie clip. The problem is that all the syntax I have found for targetting clips looks like this:

_root.sample_mc.sample2.mc. etc.

The problem is, my target clip is in an swf that I've loaded into a container clip from my main timeline.

So, essentially, I have a home.swf that loads menu.swf into a container called 'location'. In menu.swf, I have an MC called center, which contains the MC I am targetting called 'target'.

Can someone enlighten me as to what the proper path would be to target my 'target' MC?

Thanks a lot!

lunatic
November 24th, 2005, 01:18 PM
Depends on where you put the code and what you are doing with it. If you put the code on the main timeline it would be

_root.location.center.target

If you put the code on the timeline of location it becomes

this.center.target

If you put the code on the timeline of center it becomes

this.target

If you put the code on teh timeline of target it becomes

this
//for example to start playing from the 5th frame of the target movieclip
this.gotoAndPlay(5)

See? :beam:

Also - notice how "target" becomes blue within the actionscript tags up there. Means it's a reserve word and I wouldn't use it as an instance name. Call it targetMC or something else entirely.

dmog
November 24th, 2005, 01:31 PM
Thanks Lunatic. I'm afraid I'm still at a bit of a loss. I'm trying to use the method described in the Smooth Transition tuturial here. When I click the buttons to load the next swf into container_MC, nothing happens anymore. The tutorial only shows how the path would look on a main timeline... see below:
on (release) {
if (_root.currMovie == undefined) {
_root.currMovie = "section1";
container.loadMovie("section1.swf");
} else if (_root.currMovie != "section1") {
if (container._currentframe >= container.midframe) {
_root.currMovie = "section1";
container.play();
}
}
}


I've tried to use your suggestion and change the path to this.container but still nothing...see below:


on (release) {
if (_root.currMovie == undefined) {
_root.currMovie = "section1";
this.container.loadMovie("section1.swf");
} else if (_root.currMovie != "section1") {
if (container._currentframe >= container.midframe) {
_root.currMovie = "section1";
this.container.play();
}
}
}


Any more help would be extremely appreciated!