Posted By

derrekwayne on 08/19/10


Tagged

actionscript mouseleave mcv


Versions (?)

Neonsunburst DocumentClass


 / Published in: ActionScript 3
 

URL: neonsunburst.com

The Main class uses the MCV design pattern. The entire flash embed responds to mouseover with the engage function.

  1. package com.neonsunburst {
  2.  
  3. import flash.events.*;
  4. import flash.display.MovieClip;
  5. import com.gskinner.motion.GTween;
  6. import com.gskinner.motion.easing.*;
  7. import com.neonsunburst.*;
  8.  
  9. public class Main extends MovieClip {
  10.  
  11. var model:Model;
  12. var controller:Controller;
  13. var _content:Content;
  14. var navigation:Navigation;
  15.  
  16. public function Main () {
  17.  
  18. model= new Model();
  19. controller = new Controller(model);
  20. _content = new Content(model);
  21. navigation = new Navigation(model, controller);
  22.  
  23. grad.alpha = 0;
  24. //device.photo.alpha = 1;
  25. device.shaddow.alpha = 1;
  26.  
  27. contentHolder.addChild(_content);
  28.  
  29. stage.addEventListener(MouseEvent.MOUSE_OVER, engage);
  30. stage.addEventListener(Event.MOUSE_LEAVE, unEngage);
  31.  
  32. arrowHolder.addChild(navigation);
  33. }
  34.  
  35. function engage(e:MouseEvent) : void {
  36. //grad.alpha = 1;
  37. new GTween(grad, .5, {alpha:1}, {ease:Sine.easeOut});
  38. new GTween(device.photo, .5, {alpha:0}, {ease:Sine.easeIn});
  39. new GTween(contentHolder, .5, {alpha:1}, {ease:Sine.easeIn});
  40.  
  41. device.shaddow.alpha = 1;
  42. //device.photo.alpha = 0;
  43.  
  44. navigation.activate();
  45. _content.engage();
  46.  
  47. stage.removeEventListener(MouseEvent.MOUSE_OVER, engage);
  48. }
  49.  
  50. function unEngage(e:Event) : void {
  51. //grad.alpha = 0;
  52. new GTween(grad, .5, {alpha:0}, {ease:Sine.easeIn});
  53. new GTween(device.photo, .5, {alpha:1}, {ease:Sine.easeIn});
  54. //new GTween(contentHolder, .5, {alpha:0}, {ease:Sine.easeIn});
  55.  
  56. device.shaddow.alpha = .3;
  57. //device.photo.alpha = 1;
  58.  
  59. navigation.unActivate();
  60. _content.unEngage();
  61.  
  62. stage.addEventListener(MouseEvent.MOUSE_OVER, engage);
  63. }
  64. }
  65. }

Report this snippet  

You need to login to post a comment.