Advertisement
Advertisement
| 09.07.2008 at 11:31AM PDT, ID: 23710428 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: |
package net.mikesvendsen.photography {
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.DisplayObject;
import flash.display.GradientType;
import flash.display.Loader;
import flash.display.Shape;
import flash.display.SpreadMethod;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.ProgressEvent;
import flash.filters.BlurFilter;
import flash.geom.Matrix;
import flash.net.URLRequest;
public class Thumbnail extends Sprite {
internal var container:Sprite;
internal var imageContainer:Sprite;
internal var reflectionBMPRef:DisplayObject;
internal var fileName:String;
internal var imageLoader:Loader;
internal var imageRequest:URLRequest;
internal var background:Shape;
internal var progBar:Shape;
internal const thumbWidth:Number = 75;
internal const thumbHeight:Number = 50;
public static const THUMB_CLICK:String = "this thumbnail has been clicked";
public function Thumbnail(fileToUse:String) {
fileName = fileToUse;
createInitialClip();
}
private function createInitialClip():void{
container = new Sprite;
imageContainer = new Sprite;
background = new Shape();
background.graphics.beginFill(0x000000, .45);
background.graphics.drawRect(0, 0, thumbWidth, thumbHeight);
background.graphics.endFill();
progBar = new Shape();
progBar.graphics.beginFill(0x000000, .45);
progBar.graphics.drawRect(0, 0, thumbWidth, 10);
progBar.graphics.endFill();
imageContainer.addChild(background);
imageContainer.addChild(progBar);
container.addChild(imageContainer);
addChild(container);
imageRequest = new URLRequest("images/" + fileName);
imageLoader = new Loader();
imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, handleLoadProgress);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleImageComplete);
imageLoader.load(imageRequest);
}
private function handleImageComplete(e:Event):void{
imageContainer.addChild(imageLoader.content);
imageLoader.content.width = thumbWidth;
imageLoader.content.height = thumbHeight;
addFunction();
createReflection();
}
private function addFunction():void{
imageContainer.addEventListener(MouseEvent.CLICK, handleClick);
}
private function handleClick(e:MouseEvent):void{
dispatchEvent(new Event(THUMB_CLICK));
}
private function handleLoadProgress(e:ProgressEvent):void{
progBar.scaleX = e.bytesLoaded / e.bytesTotal;
}
private function createReflection():void{
var refContainer:Sprite = new Sprite();
var refBMP:BitmapData = new BitmapData(thumbWidth, thumbHeight, true, 0x000000);
refBMP.draw(imageContainer);
var reflectionBMP:Bitmap = new Bitmap(refBMP);
reflectionBMPRef = refContainer.addChild(reflectionBMP);
container.addChild(reflectionBMPRef);
reflectionBMPRef.scaleY = -1;
reflectionBMPRef.y = thumbHeight * 2;
blurReflection();
}
private function blurReflection():void{
var blurFilter:BlurFilter = new BlurFilter(3, 3, 5);
reflectionBMPRef.filters = [blurFilter];
addMask();
}
private function addMask() : void {
var thumbMask:Sprite = new Sprite();
thumbMask.x = reflectionBMPRef.x;
thumbMask.y = reflectionBMPRef.y / 2;
var fillType:String = GradientType.LINEAR;
var colors:Array = [0x000000, 0x000000];
var alphas:Array =[100, 0];
var ratios:Array = [10, 225];
var gradMat:Matrix = new Matrix();
gradMat.createGradientBox(10, 10, Math.PI / 2, 0, 10);
var spreadMethod:String = SpreadMethod.PAD;
thumbMask.graphics.beginGradientFill(fillType, colors, alphas, ratios, gradMat, spreadMethod);
thumbMask.graphics.drawRect(0, -30, thumbWidth, thumbHeight);
thumbMask.graphics.endFill();
container.addChild(thumbMask);
reflectionBMPRef.mask = thumbMask;
reflectionBMPRef.alpha = .5;
}
}
}
|