Section 1
//DOF (DOF)
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.ui.*;
import flash.filters.*;
public class DOF extends Sprite {
public var DOF_21:MovieClip;
var MinDist;// = 10
public var DOF_19_def:MovieClip;
public var DOF_23_max:MovieClip;
var MaxDist;// = 100
var MaxAperture;// = 500
var timer;// = 0
public var DOF_17_min:MovieClip;
var DistSlider;
public var Warning:TextField;
public var Sliders:MovieClip;
var CurrentDist;// = 50
var ApertureSlider;
var Planes;
public var DOF_10:MovieClip;
public var DOF_15:MovieClip;
public var DOF_27:MovieClip;
public var DOF_22:MovieClip;
public function DOF(){
var _local1:*;
Planes = new Array();
timer = 0;
MaxDist = 100;
MinDist = 10;
CurrentDist = 50;
MaxAperture = 500;
super();
addEventListener(Event.ENTER_FRAME, SetFocus);
ScanForItems(stage);
MaxAperture = (MinDist * 45);
if (this.Warning){
this.Warning.text = "";
this.Warning.x = -10000;
};
if (this.Sliders){
DistSlider = new UISlider(5, 5, (this.Sliders.width - 10), 15, MinDist, MaxDist, CurrentDist, "Focus Distance");
ApertureSlider = new UISlider(5, 40, (this.Sliders.width - 10), 15, 0, MaxAperture, (MaxAperture * 0.66), "Aperture");
this.Sliders.addChild(DistSlider);
this.Sliders.addChild(ApertureSlider);
};
_local1 = new ContextMenu();
_local1.hideBuiltInItems();
this.contextMenu = _local1;
}
function ScanForItems(_arg1){
var _local2:DisplayObject;
var _local3:*;
var _local4:*;
var _local5:*;
_local3 = 0;
while (_local3 < _arg1.numChildren) {
_local2 = _arg1.getChildAt(_local3);
if ((_local2 is MovieClip)){
_local4 = _local2.name.match(/^DOF_?(\d+\.?\d*)_?(min|max|def)?$/);
if (_local4){
_local5 = new Object();
_local5.sprite = _local2;
_local5.filter = new BlurFilter();
_local5.filter.blurX = 0;
_local5.filter.blurY = 0;
_local5.filter.quality = BitmapFilterQuality.HIGH;
_local5.sprite.filters = [_local5.filter];
_local5.dist = _local4[1];
Planes.push(_local5);
if (_local4[2] == "min"){
MinDist = _local5.dist;
};
if (_local4[2] == "max"){
MaxDist = _local5.dist;
};
if (_local4[2] == "def"){
CurrentDist = _local5.dist;
};
};
};
if ((_local2 is DisplayObjectContainer)){
ScanForItems(_local2);
};
_local3++;
};
}
private function SetFocus(_arg1){
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = 0;
while (_local2 < Planes.length) {
_local3 = Planes[_local2];
_local4 = (((ApertureSlider.Value * Math.abs((_local3.dist - DistSlider.Value))) / DistSlider.Value) / _local3.dist);
if (_local4 > 0xFF){
_local4 = 0xFF;
};
_local3.filter.blurX = _local4;
_local3.filter.blurY = _local4;
_local3.sprite.filters = [_local3.filter];
_local2++;
};
}
}
}//package
Section 2
//UISlider (UISlider)
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
public class UISlider extends Sprite {
var Nub;
var MinValue;// = 0
var NubW;
var Value;// = 0.5
var NubMaxX;
var Dragging;// = false
var MaxValue;// = 1
public function UISlider(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8){
var _local9:*;
var _local10:*;
Value = 0.5;
MinValue = 0;
MaxValue = 1;
Dragging = false;
super();
MinValue = parseFloat(_arg5);
MaxValue = parseFloat(_arg6);
Value = _arg7;
x = _arg1;
y = _arg2;
graphics.moveTo(0, 0);
graphics.lineStyle(1, 0, 1);
graphics.beginFill(0, 0.33);
graphics.lineTo(_arg3, 0);
graphics.lineTo(_arg3, _arg4);
graphics.lineTo(0, _arg4);
graphics.lineTo(0, 0);
Nub = new Sprite();
NubW = (_arg4 - 2);
Nub.graphics.moveTo(0, 0);
Nub.graphics.lineStyle(1, 0, 1);
Nub.graphics.beginFill(0xFFFFFF, 0.5);
Nub.graphics.lineTo(NubW, 0);
Nub.graphics.lineTo(NubW, NubW);
Nub.graphics.lineTo(0, NubW);
Nub.graphics.lineTo(0, 0);
Nub.x = 1;
Nub.y = 1;
NubMaxX = (_arg3 - _arg4);
addChild(Nub);
_local9 = new TextFormat("Verdana", 10, 0);
_local10 = new TextField();
_local10.x = 0;
_local10.y = (_arg4 - 2);
_local10.defaultTextFormat = _local9;
_local10.selectable = false;
_local10.text = _arg8;
this.addChild(_local10);
this.RepositionNub();
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownEvent);
addEventListener(MouseEvent.MOUSE_MOVE, onMouseMoveEvent);
}
public function onMouseMoveEvent(_arg1){
if (_arg1.buttonDown == false){
Dragging = false;
};
if (Dragging){
Value = (MinValue + (((MaxValue - MinValue) * (this.mouseX - (NubW / 2))) / NubMaxX));
this.RepositionNub();
};
}
public function RepositionNub(){
if (Value < MinValue){
Value = MinValue;
};
if (Value > MaxValue){
Value = MaxValue;
};
Nub.x = (1 + (((Value - MinValue) / (MaxValue - MinValue)) * NubMaxX));
}
public function onMouseDownEvent(_arg1){
Dragging = true;
}
}
}//package