Posted By

chrisaiv on 10/30/08


Tagged

fullscreen as3


Versions (?)

Who likes this?

13 people have marked this snippet as a favorite

THEPWN3R
dx0ne
useallfive
themill
loric
davidino1978
ssolen
donaldleegraham
tspitzr
elkraneo
dug
kojok
eludnasud


AS3: FullScreen


 / 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"

  1. fullScreenBtn.buttonMode = true;
  2. fullScreenBtn.addEventListener(MouseEvent.CLICK, goScaledFullScreen);
  3. fullScreenBtn.addEventListener(MouseEvent.MOUSE_OVER, toggleButton, false, 0, true );
  4. fullScreenBtn.addEventListener(MouseEvent.MOUSE_OUT, toggleButton, false, 0, true );
  5. fullScreenBtn.addEventListener(MouseEvent.CLICK, toggleButton, false, 0, true );
  6.  
  7. function goScaledFullScreen(e:MouseEvent):void
  8. {
  9. if(stage.displayState == StageDisplayState.NORMAL)
  10. {
  11. stage.displayState = StageDisplayState.FULL_SCREEN;
  12. } else {
  13. stage.displayState = StageDisplayState.NORMAL;
  14. }
  15. }
  16. function toggleButton(e:MouseEvent):void
  17. {
  18. // trace(e.type + "\n" + e.target.currentFrame + "\n" + e.target.currentLabel);
  19. if(e.type == "mouseOver")
  20. if(e.target.currentLabel == "upStateFull") e.target.gotoAndStop("overStateFull");
  21. else if (e.target.currentLabel == "upStateNormal") e.target.gotoAndStop("overStateNormal");
  22. if(e.type == "mouseOut")
  23. if(e.target.currentLabel == "overStateFull") e.target.gotoAndStop("upStateFull");
  24. else if (e.target.currentLabel == "overStateNormal") e.target.gotoAndStop("upStateNormal");
  25. if(e.type == "click")
  26. if (e.target.currentLabel == "overStateFull") e.target.gotoAndStop("overStateNormal");
  27. else if (e.target.currentLabel == "overStateNormal") e.target.gotoAndStop("overStateFull");
  28. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: nireve on May 28, 2009

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

You need to login to post a comment.