Donaldini

Untitled

Jun 16th, 2011
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package be.sanatorium.MapMarker{
  2.     import com.greensock.TweenLite;
  3.     import com.greensock.easing.Elastic;
  4.     import com.greensock.events.LoaderEvent;
  5.     import com.greensock.loading.ImageLoader;
  6.     import com.greensock.plugins.ColorTransformPlugin;
  7.     import com.greensock.plugins.TweenPlugin;
  8.    
  9.     import flash.display.MovieClip;
  10.     import flash.events.MouseEvent;
  11.     import flash.geom.ColorTransform;
  12.    
  13.     public class Thumbnail extends MovieClip{
  14.        
  15.         public var thumbURL:String;     // URL naar de thumbnail afbeelding
  16.         public var loader:ImageLoader   // Loader voor thumbnail te laden
  17.         public var active:Boolean;      // Selector voor aan te duiden of de thumbnail moet toegevoegd worden aan de marker
  18.        
  19.         public function Thumbnail(thumb:String){
  20.             super();
  21.             this.thumbURL = thumb;
  22.             this.active = false;
  23.             this.loader = new ImageLoader(thumbURL, {width:100, height:100, scaleMode:"proportionalOutside", crop:true, onError:thumbLoadError});
  24.            
  25.             this.addEventListener(MouseEvent.MOUSE_OVER, thumbOverEvent);
  26.             this.addEventListener(MouseEvent.MOUSE_OUT, thumbOutEvent);
  27.             this.addEventListener(MouseEvent.CLICK, thumbClickEvent);
  28.         }
  29.        
  30.         // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° //
  31.         //      Error handler van de thumbnail loader               //
  32.         // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° //
  33.         private function thumbLoadError(event:LoaderEvent):void {
  34.             trace("error loading thumbnails: " + event.target + ": " + event.text);
  35.         }
  36.        
  37.         // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° //
  38.         //      Mouse Over: Thumbnail                                   //
  39.         // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° //
  40.         private function thumbOverEvent(event:MouseEvent):void{
  41.             TweenLite.to(this,0.3,{alpha:1});
  42.             TweenLite.to(this,0.3,{scaleX:1.025, scaleY:1.025});
  43.         }
  44.        
  45.         // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° //
  46.         //      Mouse Out: Thumbnail                                    //
  47.         // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° //
  48.         private function thumbOutEvent(event:MouseEvent):void{
  49.             TweenLite.to(this,0.3,{alpha:0.7});
  50.             TweenLite.to(this,0.3,{scaleX:1, scaleY:1});
  51.         }
  52.        
  53.         // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° //
  54.         //      Mouse Click: Thumbnail selecteren                       //
  55.         // °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° //
  56.         private function thumbClickEvent(event:MouseEvent):void{
  57.             TweenPlugin.activate([ColorTransformPlugin]);
  58.             TweenLite.to(this, 0.75, {ColorTransform:{tint:0xFFFFFF, tintAmount:0.5}, ease:Elastic.easeOut});
  59.            
  60.             this.active = true;
  61.         }
  62.        
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment