Completley lost with movieclip-as-button actionscript

hi, i was in new york last week, so i’m out of practice and cant seem to get this working.
i have this code on a movieclip.

on (rollOver) {
	this.gotoAndPlay("in");
}
on (rollOut) {
	this.gotoAndPlay("out");
}
on (releaseOutside) {
	this.gotoAndPlay("out");
}
on (press) {
	gotoAndPlay("main-out");
	chosen = "_root.home";
}

the rollover and rollout actions work, its just that when i press, it doesnt goto frame labelled “main-out” (which is the next frame from where this code is). instead, it plays the rollout animation. :confused:

someone over at flashkit reccommended this, but it still didnt work.

onClipEvent (load) {
	onRollOver = function () {
		this.gotoAndPlay("in");
	};
	onRollOut = onReleaseOutside=function () {
		this.gotoAndPlay("out");
	};
	onPress = function () {
		gotoAndPlay("main-out");
		chosen = "_root.home";
	};
}

can anyone help???

thanks :slight_smile:

hey sharif, chek your pm’s :wink:

To make it a little more clear, post your fla:)
(or upload it, seems that the attachments are not working at the moment)

scotty(-:

ok, here’s the url.
[edit] resolved now

thanks :slight_smile:

…Failed to open ducument…
Is it mx2004?? Else try to zip it:)

scotty(-:

sigh this allways happens :frowning:

its mx (not 2004)

[edit] resolved now

which i doubt you can open.

thanks anyway.

I’ve got it:)
I’ll have a look.

scotty(-:

I may have solved the problem, from the looks of it you had ‘scope’ issues all over.

Place this in frame 31 of ‘main’ mc:
[AS]
stop();
trace(chosen);
_parent.gotoAndPlay(chosen);
[/AS]

And this on the ‘home’ mc on frame 14 in ‘main’ mc:
[AS]onClipEvent (load) {
this.onRollOver = function () {
this.gotoAndPlay(“in”);
};
this.onRollOut = this.onReleaseOutside=function () {
this.gotoAndPlay(“out”);
};
this.onPress = function () {
_parent.chosen = “home”;
_parent.gotoAndPlay(“main-out”);

};

}[/AS]

also you had a frame label of “main-end” and code targetting “main-out”. If you leave the label, change the code above to fit, if you leave the code, change the label.

Well done, kill.robot:)
I’m just too late…
I almost had the same, only on frame 31
[AS]stop();
_root.gotoAndPlay(chosen);[/AS]

scotty(-:

cool, thanks everyone. see, i told you i was out of practice. :smiley:

thanks :slight_smile:

excelent, works like a charm, except once it goes to the home section, the output window opens saying “home”.

but thanks, really appreciate it :slight_smile:

[AS]
stop();
trace(chosen); //<-- take this line out…
_parent.gotoAndPlay(chosen);
[/AS]

oh ok, cool thanks :slight_smile: