Im having trouble with my actionscript. I would like the code below to when rolling over mercury have all the other planets alpha at 0.5, also when the mouse leaves the mercury all the planets alpha go back to 1. Also when clicking on a planet this takes you to a diffirent frame. The code below gives me an error when clicking on the planet saying an item is null.
Am i going about this correctly? Should i use removeEventListener instead? Could i use an if statment? Any help will be appreciated.
mercury.addEventListener(MouseEvent.MOUSE_UP, mercuryClick);
function mercuryClick(evt:Object):void {
gotoAndStop(3);
}
mercury.addEventListener(MouseEvent.MOUSE_OVER, mercuryOver);
function mercuryOver(evt:Object):void {
sun.alpha=0.5;
venus.alpha=0.5;
earth.alpha=0.5;
moon.alpha=0.5;
mars.alpha=0.2;
jupiter.alpha=0.5;
saturn.alpha=0.5;
uranus.alpha=0.5;
neptune.alpha=0.5;
}
mercury.addEventListener(MouseEvent.MOUSE_OUT, mercuryOut);
function mercuryOut(evt:Object):void {
sun.alpha=1;
venus.alpha=1;
earth.alpha=1;
moon.alpha=1;
mars.alpha=1;
jupiter.alpha=1;
saturn.alpha=1;
uranus.alpha=1;
neptune.alpha=1;
}
sorry this is the exact error "TypeError: Error #1009: Cannot access a property or method of a null object reference"
Am i going about this correctly? Should i use removeEventListener instead? Could i use an if statment? Any help will be appreciated.
mercury.addEventListener(MouseEvent.MOUSE_UP, mercuryClick);
function mercuryClick(evt:Object):void {
gotoAndStop(3);
}
mercury.addEventListener(MouseEvent.MOUSE_OVER, mercuryOver);
function mercuryOver(evt:Object):void {
sun.alpha=0.5;
venus.alpha=0.5;
earth.alpha=0.5;
moon.alpha=0.5;
mars.alpha=0.2;
jupiter.alpha=0.5;
saturn.alpha=0.5;
uranus.alpha=0.5;
neptune.alpha=0.5;
}
mercury.addEventListener(MouseEvent.MOUSE_OUT, mercuryOut);
function mercuryOut(evt:Object):void {
sun.alpha=1;
venus.alpha=1;
earth.alpha=1;
moon.alpha=1;
mars.alpha=1;
jupiter.alpha=1;
saturn.alpha=1;
uranus.alpha=1;
neptune.alpha=1;
}
sorry this is the exact error "TypeError: Error #1009: Cannot access a property or method of a null object reference"