Trying to load a library image with toggle button
This is the AS3 for working the button that I created and it works fine. However, I want something to happen and I put in the // in this code for what I need help with...
import flash.events.MouseEvent;
toggleButton.addEventListener(MouseEvent.MOUSE_OVER, rolloverToggle);
toggleButton.addEventListener(MouseEvent.MOUSE_OUT, rolloutToggle);
toggleButton.addEventListener(MouseEvent.CLICK, toggleClick);
toggleButton.buttonState = "on";
function rolloverToggle(event:MouseEvent) {
toggleButton.gotoAndStop(toggleButton.buttonState+ "over");
}
function rolloutToggle(event:MouseEvent) {
toggleButton.gotoAndStop(toggleButton.buttonState);
}
function toggleClick(event:MouseEvent) {
if (toggleButton.buttonState == "on"){
toggleButton.buttonState = "off";
//I want to load a png from library called MyImage1 to 0,0
}else {
toggleButton.buttonState = "on";
//I want to remove png called MyImage1 from stage
}
toggleButton.gotoAndStop(toggleButton.buttonState+ "over");
}
If there is an easier way to handle this, that's great. I just don't know if I need anything else to do this. I tried addChild, but not as though I know what I'm doing. In AS2 I didn't have this problem.
