Transitioning between external .swfs only using movie clips as buttons

I followed the tutorial here on transitions between external SWFs and can get it to work on my own page just as in the tutorial.

My problem is that my page doesn’t use simple buttons. The buttons on my main page that load my external SWFs into the container are movie clip buttons. Basically what I want is a main page with an empty container for playing movies and a few buttons on the main page that load external swfs into that container. These said buttons are movie clips that animate on rollover and act as buttons when you click them.

So let’s say the main page is called “mainpage.swf” and contains an empty movie clip called “container” in which to load the external swfs, “button1” loads “mc1.swf” and “button2” loads “mc2.swf” (all hypothetical because I surely haven’t gotten this to happen yet…).

On the main timeline (of “mainpage”), I click on the layer for button1 and enter the script from the tutorial:

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

This, of course, doesn’t work. Probably because this code only works for simple buttons. So I try altering it for complex buttons using info learned in another tutorial about linking complex buttons:

this.onRelease  =  function() {
if (_root.currMovie == undefined) {
_root.currMovie = "mc1";
} else if (_root.currMovie != "mc1") {
if (container._currentframe >= container.midframe) {
_root.currMovie = "mc1";;

Which returns the following error:

Statement must appear within on/onClipEvent handler
     this.onRelease  =  function() {

I’ve also tried placing this code elsewhere, such as editing the button’s movie clip and putting the code there, but no dice with everything I tried.

My zipped collection of files was too big to attach, but you can download it from here. (The buttons are the spinning bikes on the left. The top one should open “600shell” in the container and the bottom one should open “1000shell” in the container. There’s no onRelease scripting anywhere for either button because I could never get it right, but the buttons are in place.)