/ Published in: ActionScript 3
Create a MovieClip instance named fullScreenBtn with 4 frames, 4 frame labels, 4 stop() actions, and 4 different GUI states. Give each frame a label of "upStateFull", "overStateFull", "upStateNormal", "overStateNormal"
Expand |
Embed | Plain Text
fullScreenBtn.buttonMode = true; fullScreenBtn.addEventListener(MouseEvent.CLICK, goScaledFullScreen); fullScreenBtn.addEventListener(MouseEvent.MOUSE_OVER, toggleButton, false, 0, true ); fullScreenBtn.addEventListener(MouseEvent.MOUSE_OUT, toggleButton, false, 0, true ); fullScreenBtn.addEventListener(MouseEvent.CLICK, toggleButton, false, 0, true ); function goScaledFullScreen(e:MouseEvent):void { if(stage.displayState == StageDisplayState.NORMAL) { stage.displayState = StageDisplayState.FULL_SCREEN; } else { stage.displayState = StageDisplayState.NORMAL; } } function toggleButton(e:MouseEvent):void { // trace(e.type + "\n" + e.target.currentFrame + "\n" + e.target.currentLabel); if(e.type == "mouseOver") if(e.target.currentLabel == "upStateFull") e.target.gotoAndStop("overStateFull"); else if (e.target.currentLabel == "upStateNormal") e.target.gotoAndStop("overStateNormal"); if(e.type == "mouseOut") if(e.target.currentLabel == "overStateFull") e.target.gotoAndStop("upStateFull"); else if (e.target.currentLabel == "overStateNormal") e.target.gotoAndStop("upStateNormal"); if(e.type == "click") if (e.target.currentLabel == "overStateFull") e.target.gotoAndStop("overStateNormal"); else if (e.target.currentLabel == "overStateNormal") e.target.gotoAndStop("overStateFull"); }
Comments
Subscribe to comments
You need to login to post a comment.

you have MouseEvent not a listener for FULL_SCREEN or NORMAL
so if you exit from fullscreen with ESC, does not work !
do you know a sollution ?
Thank you