[REQ HELP] Button code not working :(

Hey Kirupians,

i am trying to create a mini portfolio and have come across a few problems with my code for my buttons.

i have followed the animated buttons tutorial off here and thats working great but now i want to try and use that code with code i already have for loading swf’s into a container.

This is what i have so far…


this.portButton_mc.onRollOver = function() {
 portButton_mc.gotoAndPlay("_over");
}
this.portButton_mc.onRollOut = function() {
 portButton_mc.gotoAndPlay("_out");
}

Now as i mentioned, the above code works great so now i want to add a onPress function that will control my swf’s in the container. now when im working with a button i can use the code


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

And that works great but i need to add that to the movieclip button and have it work the same way. I have tried the following to no avail.


this.portButton_mc.onPress = function() {
 if (_root.currMovie == undefined) { 
_root.currMovie = "TITLE"; 
container2.loadMovie("TITLE.swf"); 
} else if (_root.currMovie != "TITLE") { 
if (container2._currentframe >= container2.midframe) { 
_root.currMovie = "TITLE"; 
container2.play(); 
} 
} 
}

I don’t think i am too far away but i just cant see whats going wrong. the button still animates but when i click it, it does nothing when i want it to load an swf into my container.

Please help :slight_smile:
Thanks in advance

Its ok i fugured it out now. i had to take the _root out of it :slight_smile: