PDA

View Full Version : Help making movie clip act as button.


designpoint
06-13-2007, 07:24 AM
I have a line of action script that works fine when used on a simple button located on the main time line. My problem is using the same action script on a movie clip that has children. The movie clips will be used as navigation for the site. They have "over", "out" and "on" states. The "on" states switch depending on the last clicked movie clip. You will find 2 basic test buttons below the "home" and contact us" movie clip buttons. Again… the AS works fine on the basic buttons but not on the advanced rollover, rollout movie clips. I'd be happy to email the 3 MB source files to anyone willing to help. Please let me know if there is anything I can do to clarify. Please feel free to modify the files to function properly.

atomic
06-13-2007, 11:53 AM
Check your PM's for address.

atomic
06-14-2007, 12:10 AM
Ok, got your files... Although I'm familiar with Kirupa's coding on this, this will take some time... Looking into it!

atomic
06-14-2007, 03:14 AM
I don't like your preloaders... For one thing, they'll always re-appear whether the external .swf has been viewed (& cached) or not... And I'd use a generic preloader within your index.swf, rather than adding a preloader to each external movie...

That said, you can partly solve your problem, by using the following... I've commented out your own faulty code...


on (rollOver) {
if (_root.link<>1) {
this.gotoAndPlay("s1");
}
}
on (rollOut) {
if (_root.link<>1) {
this.gotoAndPlay("s2");
}
}

/*
on (release) {
unloadMovieNum(1);
if (_root.link<>1) {
this.stop();
_root["item"+_root.link].gotoAndPlay("s2");
_root.link = 1;
}
}
on (release) {
_root.link = 1;
_root.play();
}
*/
on (release) {
if (_root.currMovie == undefined) {
_root.currMovie = "home";
_parent.container.loadMovie("home.swf");
} else if (_root.currMovie != "home") {
if (_parent.container._currentframe>=_parent.container.midframe) {
_root.currMovie = "home";
_parent.container.play();
}
}
}


And on the other button mc...


on (rollOver) {
if (_root.link<>2) {
this.gotoAndPlay("s1");
}
}
on (rollOut) {
if (_root.link<>2) {
this.gotoAndPlay("s2");
}
}
/*
on (release) {
unloadMovieNum(1);
if (_root.link<>2) {
this.stop();
_root["item"+_root.link].gotoAndPlay("s2");
_root.link = 2;
}
}
on (release) {
_root.link = 2;
_root.play();
}
*/
on (release) {
trace("YO!"+ _root.currMovie);
if (_root.currMovie == undefined) {
_root.currMovie = "contact_us";
_parent.container.loadMovie("contact_us.swf");
} else if (_root.currMovie != "contact_us") {
if (_parent.container._currentframe>=_parent.container.midframe) {
_root.currMovie = "contact_us";
_parent.container.play();
}
}
}


But, you won't be out of the woods yet! You'd need to disable all button mcs to start with, and only enable them after the home.swf is loaded... Otherwise, if the user hits any one of those buttons before the home.swf is fully loaded, it throws the whole movie into a standstill...

Major re-coding required...

designpoint
06-20-2007, 06:20 PM
Thank you Atomic,
Unfortunately I was not able to make it work. The ActionScript is just too complicated for me. I'm afraid to ask… would you mind applying the script and sending the fixed index.fla? I know I should be able to figure it out on my own, but I can't.
If I don't hear from you again, Thank you for your help.
Paul
[email protected]

atomic
06-20-2007, 11:52 PM
This was almost a week ago... Will see if I've kept the files, and mail you the .fla if I did...

atomic
06-21-2007, 12:50 PM
Just mailed you the corrected .fla.