Section 1
//BindabilityInfo (mx.binding.BindabilityInfo)
package mx.binding {
import mx.core.*;
import mx.events.*;
public class BindabilityInfo {
private var typeDescription:XML;
private var childChangeEvents:Object;
private var classChangeEvents:Object;
public static const METHOD:String = "method";
public static const ACCESSOR:String = "accessor";
public static const CHANGE_EVENT:String = "ChangeEvent";
public static const NON_COMMITTING_CHANGE_EVENT:String = "NonCommittingChangeEvent";
public static const BINDABLE:String = "Bindable";
mx_internal static const VERSION:String = "2.0.1.0";
public static const MANAGED:String = "Managed";
public function BindabilityInfo(_arg1:XML){
childChangeEvents = {};
super();
this.typeDescription = _arg1;
}
private function getClassChangeEvents():Object{
if (!classChangeEvents){
classChangeEvents = {};
addBindabilityEvents(typeDescription.metadata, classChangeEvents);
if (typeDescription.metadata.(@name == MANAGED).length() > 0){
classChangeEvents[PropertyChangeEvent.PROPERTY_CHANGE] = true;
};
};
return (classChangeEvents);
}
private function addBindabilityEvents(_arg1:XMLList, _arg2:Object):void{
var metadata = _arg1;
var eventListObj = _arg2;
addChangeEvents(metadata.(@name == BINDABLE), eventListObj, true);
addChangeEvents(metadata.(@name == CHANGE_EVENT), eventListObj, true);
addChangeEvents(metadata.(@name == NON_COMMITTING_CHANGE_EVENT), eventListObj, false);
}
private function addChangeEvents(_arg1:XMLList, _arg2:Object, _arg3:Boolean):void{
var _local4:XML;
var _local5:XMLList;
var _local6:String;
for each (_local4 in _arg1) {
_local5 = _local4.arg;
if (_local5.length() > 0){
_local6 = _local5[0].@value;
_arg2[_local6] = _arg3;
} else {
trace((("warning: unconverted Bindable metadata in class '" + typeDescription.@name) + "'"));
};
};
}
private function copyProps(_arg1:Object, _arg2:Object):Object{
var _local3:String;
for (_local3 in _arg1) {
_arg2[_local3] = _arg1[_local3];
};
return (_arg2);
}
public function getChangeEvents(_arg1:String):Object{
var changeEvents:Object;
var childDesc:XMLList;
var numChildren:int;
var childName = _arg1;
changeEvents = childChangeEvents[childName];
if (!changeEvents){
changeEvents = copyProps(getClassChangeEvents(), {});
childDesc = (typeDescription.accessor.(@name == childName) + typeDescription.method.(@name == childName));
numChildren = childDesc.length();
if (numChildren == 0){
if (!typeDescription.@dynamic){
trace((((("warning: no describeType entry for '" + childName) + "' on non-dynamic type '") + typeDescription.@name) + "'"));
};
} else {
if (numChildren > 1){
trace(((((("warning: multiple describeType entries for '" + childName) + "' on type '") + typeDescription.@name) + "':\n") + childDesc));
};
addBindabilityEvents(childDesc.metadata, changeEvents);
};
childChangeEvents[childName] = changeEvents;
};
return (changeEvents);
}
}
}//package mx.binding
Section 2
//CollectionViewError (mx.collections.errors.CollectionViewError)
package mx.collections.errors {
import mx.core.*;
public class CollectionViewError extends Error {
mx_internal static const VERSION:String = "2.0.1.0";
public function CollectionViewError(_arg1:String){
super(_arg1);
}
}
}//package mx.collections.errors
Section 3
//CursorError (mx.collections.errors.CursorError)
package mx.collections.errors {
import mx.core.*;
public class CursorError extends Error {
mx_internal static const VERSION:String = "2.0.1.0";
public function CursorError(_arg1:String){
super(_arg1);
}
}
}//package mx.collections.errors
Section 4
//ItemPendingError (mx.collections.errors.ItemPendingError)
package mx.collections.errors {
import mx.core.*;
import mx.rpc.*;
public class ItemPendingError extends Error {
private var _responders:Array;
mx_internal static const VERSION:String = "2.0.1.0";
public function ItemPendingError(_arg1:String){
super(_arg1);
}
public function addResponder(_arg1:IResponder):void{
if (!_responders){
_responders = [];
};
_responders.push(_arg1);
}
public function get responders():Array{
return (_responders);
}
}
}//package mx.collections.errors
Section 5
//SortError (mx.collections.errors.SortError)
package mx.collections.errors {
import mx.core.*;
public class SortError extends Error {
mx_internal static const VERSION:String = "2.0.1.0";
public function SortError(_arg1:String){
super(_arg1);
}
}
}//package mx.collections.errors
Section 6
//ArrayCollection (mx.collections.ArrayCollection)
package mx.collections {
import flash.utils.*;
import mx.core.*;
public class ArrayCollection extends ListCollectionView implements IExternalizable {
mx_internal static const VERSION:String = "2.0.1.0";
public function ArrayCollection(_arg1:Array=null){
this.source = _arg1;
}
public function writeExternal(_arg1:IDataOutput):void{
if ((list is IExternalizable)){
IExternalizable(list).writeExternal(_arg1);
} else {
_arg1.writeObject(source);
};
}
public function readExternal(_arg1:IDataInput):void{
if ((list is IExternalizable)){
IExternalizable(list).readExternal(_arg1);
} else {
source = (_arg1.readObject() as Array);
};
}
public function get source():Array{
if (((list) && ((list is ArrayList)))){
return (ArrayList(list).source);
};
return (null);
}
public function set source(_arg1:Array):void{
list = new ArrayList(_arg1);
}
}
}//package mx.collections
Section 7
//ArrayList (mx.collections.ArrayList)
package mx.collections {
import flash.events.*;
import mx.resources.*;
import flash.system.*;
import flash.utils.*;
import mx.core.*;
import mx.events.*;
import mx.utils.*;
public class ArrayList extends EventDispatcher implements IList, IExternalizable, IPropertyChangeNotifier {
private var _uid:String;
private var _source:Array;
private var _dispatchEvents:int;// = 0
mx_internal static const VERSION:String = "2.0.1.0";
private static var resourceOutOfBounds:String;
private static var packageResources:ResourceBundle = ResourceBundle.getResourceBundle("collections", ApplicationDomain.currentDomain);
public function ArrayList(_arg1:Array=null){
_dispatchEvents = 0;
super();
disableEvents();
this.source = _arg1;
enableEvents();
_uid = UIDUtil.createUID();
}
private function internalDispatchEvent(_arg1:String, _arg2:Object=null, _arg3:int=-1):void{
var _local4:CollectionEvent;
var _local5:PropertyChangeEvent;
if (_dispatchEvents == 0){
if (hasEventListener(CollectionEvent.COLLECTION_CHANGE)){
_local4 = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
_local4.kind = _arg1;
_local4.items.push(_arg2);
_local4.location = _arg3;
dispatchEvent(_local4);
};
if (((hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE)) && ((((_arg1 == CollectionEventKind.ADD)) || ((_arg1 == CollectionEventKind.REMOVE)))))){
_local5 = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
_local5.property = _arg3;
if (_arg1 == CollectionEventKind.ADD){
_local5.newValue = _arg2;
} else {
_local5.oldValue = _arg2;
};
dispatchEvent(_local5);
};
};
}
public function removeAll():void{
var _local1:int;
var _local2:int;
if (length > 0){
_local1 = length;
_local2 = 0;
while (_local2 < _local1) {
stopTrackUpdates(source[_local2]);
_local2++;
};
source.splice(0, length);
internalDispatchEvent(CollectionEventKind.RESET);
};
}
public function readExternal(_arg1:IDataInput):void{
source = _arg1.readObject();
}
protected function startTrackUpdates(_arg1:Object):void{
if (((_arg1) && ((_arg1 is IEventDispatcher)))){
IEventDispatcher(_arg1).addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, itemUpdateHandler, false, 0, true);
};
}
public function get source():Array{
return (_source);
}
public function getItemAt(_arg1:int, _arg2:int=0):Object{
if ((((_arg1 < 0)) || ((_arg1 >= length)))){
throw (new RangeError(StringUtil.substitute(resourceOutOfBounds, _arg1)));
};
return (source[_arg1]);
}
public function toArray():Array{
return (source.concat());
}
public function set uid(_arg1:String):void{
_uid = _arg1;
}
private function disableEvents():void{
_dispatchEvents--;
}
public function itemUpdated(_arg1:Object, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
var _local5:PropertyChangeEvent;
_local5 = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
_local5.kind = PropertyChangeEventKind.UPDATE;
_local5.source = _arg1;
_local5.property = _arg2;
_local5.oldValue = _arg3;
_local5.newValue = _arg4;
itemUpdateHandler(_local5);
}
public function addItemAt(_arg1:Object, _arg2:int):void{
if ((((_arg2 < 0)) || ((_arg2 > length)))){
throw (new RangeError(StringUtil.substitute(resourceOutOfBounds, _arg2)));
};
source.splice(_arg2, 0, _arg1);
startTrackUpdates(_arg1);
internalDispatchEvent(CollectionEventKind.ADD, _arg1, _arg2);
}
public function setItemAt(_arg1:Object, _arg2:int):Object{
var _local3:Object;
var _local4:Boolean;
var _local5:Boolean;
var _local6:PropertyChangeEvent;
var _local7:CollectionEvent;
if ((((_arg2 < 0)) || ((_arg2 >= length)))){
throw (new RangeError(StringUtil.substitute(resourceOutOfBounds, _arg2)));
};
_local3 = source[_arg2];
source[_arg2] = _arg1;
stopTrackUpdates(_local3);
startTrackUpdates(_arg1);
if (_dispatchEvents == 0){
_local4 = hasEventListener(CollectionEvent.COLLECTION_CHANGE);
_local5 = hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE);
if (((_local4) || (_local5))){
_local6 = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
_local6.kind = PropertyChangeEventKind.UPDATE;
_local6.oldValue = _local3;
_local6.newValue = _arg1;
_local6.property = _arg2;
};
if (_local4){
_local7 = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
_local7.kind = CollectionEventKind.REPLACE;
_local7.location = _arg2;
_local7.items.push(_local6);
dispatchEvent(_local7);
};
if (_local5){
dispatchEvent(_local6);
};
};
return (_local3);
}
protected function stopTrackUpdates(_arg1:Object):void{
if (((_arg1) && ((_arg1 is IEventDispatcher)))){
IEventDispatcher(_arg1).removeEventListener(PropertyChangeEvent.PROPERTY_CHANGE, itemUpdateHandler);
};
}
public function set source(_arg1:Array):void{
var _local2:int;
var _local3:int;
var _local4:CollectionEvent;
if (((_source) && (_source.length))){
_local3 = _source.length;
_local2 = 0;
while (_local2 < _local3) {
stopTrackUpdates(_source[_local2]);
_local2++;
};
};
_source = (_arg1) ? _arg1 : [];
_local3 = _source.length;
_local2 = 0;
while (_local2 < _local3) {
startTrackUpdates(_source[_local2]);
_local2++;
};
if (_dispatchEvents == 0){
_local4 = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
_local4.kind = CollectionEventKind.RESET;
dispatchEvent(_local4);
};
}
public function removeItem(_arg1:Object):Boolean{
var _local2:int;
var _local3:Boolean;
_local2 = getItemIndex(_arg1);
_local3 = (_local2 >= 0);
if (_local3){
removeItemAt(_local2);
};
return (_local3);
}
public function getItemIndex(_arg1:Object):int{
return (ArrayUtil.getItemIndex(_arg1, source));
}
public function writeExternal(_arg1:IDataOutput):void{
_arg1.writeObject(_source);
}
public function get uid():String{
return (_uid);
}
public function addItem(_arg1:Object):void{
addItemAt(_arg1, length);
}
public function removeItemAt(_arg1:int):Object{
var _local2:Object;
if ((((_arg1 < 0)) || ((_arg1 >= length)))){
throw (new RangeError(StringUtil.substitute(resourceOutOfBounds, _arg1)));
};
_local2 = source.splice(_arg1, 1)[0];
stopTrackUpdates(_local2);
internalDispatchEvent(CollectionEventKind.REMOVE, _local2, _arg1);
return (_local2);
}
public function get length():int{
if (source){
return (source.length);
};
return (0);
}
protected function itemUpdateHandler(_arg1:PropertyChangeEvent):void{
var _local2:PropertyChangeEvent;
var _local3:uint;
internalDispatchEvent(CollectionEventKind.UPDATE, _arg1);
if ((((_dispatchEvents == 0)) && (hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE)))){
_local2 = PropertyChangeEvent(_arg1.clone());
_local3 = getItemIndex(_arg1.target);
_local2.property = ((_local3.toString() + ".") + _arg1.property);
dispatchEvent(_local2);
};
}
override public function toString():String{
if (source){
return (source.toString());
};
return (getQualifiedClassName(this));
}
private function enableEvents():void{
_dispatchEvents++;
if (_dispatchEvents > 0){
_dispatchEvents = 0;
};
}
private static function loadResources():void{
resourceOutOfBounds = packageResources.getString("outOfBounds");
}
loadResources();
}
}//package mx.collections
Section 8
//CursorBookmark (mx.collections.CursorBookmark)
package mx.collections {
import mx.core.*;
public class CursorBookmark {
private var _value:Object;
mx_internal static const VERSION:String = "2.0.1.0";
private static var _first:CursorBookmark;
private static var _last:CursorBookmark;
private static var _current:CursorBookmark;
public function CursorBookmark(_arg1:Object){
_value = _arg1;
}
public function get value():Object{
return (_value);
}
public function getViewIndex():int{
return (-1);
}
public static function get LAST():CursorBookmark{
if (!_last){
_last = new CursorBookmark("${L}");
};
return (_last);
}
public static function get FIRST():CursorBookmark{
if (!_first){
_first = new CursorBookmark("${F}");
};
return (_first);
}
public static function get CURRENT():CursorBookmark{
if (!_current){
_current = new CursorBookmark("${C}");
};
return (_current);
}
}
}//package mx.collections
Section 9
//ICollectionView (mx.collections.ICollectionView)
package mx.collections {
import flash.events.*;
public interface ICollectionView extends IEventDispatcher {
function refresh():Boolean;
function set sort(_arg1:Sort):void;
function get length():int;
function set filterFunction(_arg1:Function):void;
function itemUpdated(_arg1:Object, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void;
function get filterFunction():Function;
function createCursor():IViewCursor;
function disableAutoUpdate():void;
function enableAutoUpdate():void;
function get sort():Sort;
function contains(_arg1:Object):Boolean;
}
}//package mx.collections
Section 10
//IList (mx.collections.IList)
package mx.collections {
import flash.events.*;
public interface IList extends IEventDispatcher {
function get length():int;
function itemUpdated(_arg1:Object, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void;
function getItemIndex(_arg1:Object):int;
function addItemAt(_arg1:Object, _arg2:int):void;
function removeItemAt(_arg1:int):Object;
function setItemAt(_arg1:Object, _arg2:int):Object;
function addItem(_arg1:Object):void;
function getItemAt(_arg1:int, _arg2:int=0):Object;
function removeAll():void;
function toArray():Array;
}
}//package mx.collections
Section 11
//ItemResponder (mx.collections.ItemResponder)
package mx.collections {
import mx.core.*;
import mx.rpc.*;
public class ItemResponder implements IResponder {
private var _faultHandler:Function;
private var _resultHandler:Function;
private var _token:Object;
mx_internal static const VERSION:String = "2.0.1.0";
public function ItemResponder(_arg1:Function, _arg2:Function, _arg3:Object=null){
_resultHandler = _arg1;
_faultHandler = _arg2;
_token = _arg3;
}
public function fault(_arg1:Object):void{
_faultHandler(_arg1, _token);
}
public function result(_arg1:Object):void{
_resultHandler(_arg1, _token);
}
}
}//package mx.collections
Section 12
//IViewCursor (mx.collections.IViewCursor)
package mx.collections {
import flash.events.*;
public interface IViewCursor extends IEventDispatcher {
function moveNext():Boolean;
function get view():ICollectionView;
function insert(_arg1:Object):void;
function remove():Object;
function get beforeFirst():Boolean;
function get afterLast():Boolean;
function findAny(_arg1:Object):Boolean;
function movePrevious():Boolean;
function get bookmark():CursorBookmark;
function findFirst(_arg1:Object):Boolean;
function seek(_arg1:CursorBookmark, _arg2:int=0, _arg3:int=0):void;
function get current():Object;
function findLast(_arg1:Object):Boolean;
}
}//package mx.collections
Section 13
//ListCollectionView (mx.collections.ListCollectionView)
package mx.collections {
import flash.events.*;
import mx.resources.*;
import flash.system.*;
import flash.utils.*;
import mx.core.*;
import mx.events.*;
import mx.utils.*;
import mx.collections.errors.*;
public class ListCollectionView extends Proxy implements ICollectionView, IList, IMXMLObject {
private var autoUpdateCounter:int;
private var _list:IList;
protected var localIndex:Array;
private var _filterFunction:Function;
private var pendingUpdates:Array;
private var eventDispatcher:EventDispatcher;
private var revision:int;
private var _sort:Sort;
mx_internal static const VERSION:String = "2.0.1.0";
private static var packageResources:ResourceBundle = ResourceBundle.getResourceBundle("collections", ApplicationDomain.currentDomain);
private static var resourceInvalidIndex:String;
private static var resourceBookmarkNotFound:String;
private static var resourceOutOfBounds:String;
private static var resourceUnknownProperty:String;
private static var resourceIncorrectAddition:String;
private static var resourceItemNotFound:String;
public function ListCollectionView(_arg1:IList=null){
eventDispatcher = new EventDispatcher(this);
this.list = _arg1;
}
public function set filterFunction(_arg1:Function):void{
_filterFunction = _arg1;
dispatchEvent(new Event("filterFunctionChanged"));
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
eventDispatcher.removeEventListener(_arg1, _arg2, _arg3);
}
private function replaceItemsInView(_arg1:Array, _arg2:int, _arg3:Boolean=true):void{
var _local4:int;
var _local5:Array;
var _local6:Array;
var _local7:int;
var _local8:PropertyChangeEvent;
var _local9:CollectionEvent;
if (localIndex){
_local4 = _arg1.length;
_local5 = [];
_local6 = [];
_local7 = 0;
while (_local7 < _local4) {
_local8 = _arg1[_local7];
_local5.push(_local8.oldValue);
_local6.push(_local8.newValue);
_local7++;
};
removeItemsFromView(_local5, _arg2, _arg3);
addItemsToView(_local6, _arg2, _arg3);
} else {
_local9 = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
_local9.kind = CollectionEventKind.REPLACE;
_local9.location = _arg2;
_local9.items = _arg1;
dispatchEvent(_local9);
};
}
public function willTrigger(_arg1:String):Boolean{
return (eventDispatcher.willTrigger(_arg1));
}
private function handlePendingUpdates():void{
var _local1:Array;
var _local2:CollectionEvent;
var _local3:int;
var _local4:CollectionEvent;
var _local5:int;
if (pendingUpdates){
_local1 = pendingUpdates;
pendingUpdates = null;
_local3 = 0;
while (_local3 < _local1.length) {
_local4 = _local1[_local3];
if (_local4.kind == CollectionEventKind.UPDATE){
if (!_local2){
_local2 = _local4;
} else {
_local5 = 0;
while (_local5 < _local4.items.length) {
_local2.items.push(_local4.items[_local5]);
_local5++;
};
};
} else {
listChangeHandler(_local4);
};
_local3++;
};
if (_local2){
listChangeHandler(_local2);
};
};
}
mx_internal function findItem(_arg1:Object, _arg2:String, _arg3:Boolean=false):int{
if (!sort){
throw (new CollectionViewError(resourceItemNotFound));
};
if (localIndex.length == 0){
return ((_arg3) ? 0 : -1);
};
return (sort.findItem(localIndex, _arg1, _arg2, _arg3));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
var index:int;
var n:Number;
var name = _arg1;
if ((name is QName)){
name = name.localName;
};
index = -1;
try {
n = parseInt(String(name));
if (!isNaN(n)){
index = int(n);
};
} catch(e:Error) {
};
if (index == -1){
return (false);
};
return ((((index >= 0)) && ((index < length))));
}
public function removeAll():void{
var _local1:int;
var _local2:int;
_local1 = length;
if (_local1 > 0){
if (localIndex){
_local2 = (_local1 - 1);
while (_local2 >= 0) {
removeItemAt(_local2);
_local2--;
};
} else {
list.removeAll();
};
};
}
public function getItemAt(_arg1:int, _arg2:int=0):Object{
if ((((_arg1 < 0)) || ((_arg1 >= length)))){
throw (new RangeError(StringUtil.substitute(resourceOutOfBounds, _arg1)));
};
if (localIndex){
return (localIndex[_arg1]);
};
if (list){
return (list.getItemAt(_arg1, _arg2));
};
return (null);
}
private function moveItemInView(_arg1:Object, _arg2:Boolean=true, _arg3:Array=null):void{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:CollectionEvent;
if (localIndex){
_local4 = -1;
_local5 = 0;
while (_local5 < localIndex.length) {
if (localIndex[_local5] == _arg1){
_local4 = _local5;
break;
};
_local5++;
};
if (_local4 > -1){
localIndex.splice(_local4, 1);
};
_local6 = addItemsToView([_arg1], -1, false);
if (_arg2){
_local7 = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
_local7.items.push(_arg1);
if (((((_arg3) && ((_local6 == _local4)))) && ((_local6 > -1)))){
_arg3.push(_arg1);
return;
};
if ((((_local6 > -1)) && ((_local4 > -1)))){
_local7.kind = CollectionEventKind.MOVE;
_local7.location = _local6;
_local7.oldLocation = _local4;
} else {
if (_local6 > -1){
_local7.kind = CollectionEventKind.ADD;
_local7.location = _local6;
} else {
if (_local4 > -1){
_local7.kind = CollectionEventKind.REMOVE;
_local7.location = _local4;
} else {
_arg2 = false;
};
};
};
if (_arg2){
dispatchEvent(_local7);
};
};
};
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return ((_arg1 - 1).toString());
}
public function contains(_arg1:Object):Boolean{
return (!((getItemIndex(_arg1) == -1)));
}
public function itemUpdated(_arg1:Object, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
list.itemUpdated(_arg1, _arg2, _arg3, _arg4);
}
private function removeItemsFromView(_arg1:Array, _arg2:int, _arg3:Boolean=true):void{
var _local4:Array;
var _local5:int;
var _local6:int;
var _local7:Object;
var _local8:int;
var _local9:CollectionEvent;
_local4 = (localIndex) ? [] : _arg1;
_local5 = _arg2;
if (localIndex){
_local6 = 0;
while (_local6 < _arg1.length) {
_local7 = _arg1[_local6];
_local8 = getItemIndex(_local7);
if (_local8 > -1){
localIndex.splice(_local8, 1);
_local4.push(_local7);
_local5 = _local8;
};
_local6++;
};
};
if (((_arg3) && ((_local4.length > 0)))){
_local9 = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
_local9.kind = CollectionEventKind.REMOVE;
_local9.location = (((!(localIndex)) || ((_local4.length == 1)))) ? _local5 : -1;
_local9.items = _local4;
dispatchEvent(_local9);
};
}
mx_internal function getBookmark(_arg1:int):ListCollectionViewBookmark{
var value:Object;
var index = _arg1;
if ((((index < 0)) || ((index > length)))){
throw (new CollectionViewError(StringUtil.substitute(resourceInvalidIndex, index)));
};
try {
value = getItemAt(index);
} catch(e:Error) {
value = null;
};
return (new ListCollectionViewBookmark(value, this, revision, index));
}
public function get sort():Sort{
return (_sort);
}
public function addItemAt(_arg1:Object, _arg2:int):void{
var _local3:int;
if ((((((_arg2 < 0)) || (!(list)))) || ((_arg2 > length)))){
throw (new RangeError(StringUtil.substitute(resourceOutOfBounds, _arg2)));
};
_local3 = _arg2;
if (((localIndex) && (sort))){
_local3 = list.length;
};
list.addItemAt(_arg1, _local3);
}
private function handlePropertyChangeEvents(_arg1:Array):void{
var _local2:Array;
var _local3:Array;
var _local4:Object;
var _local5:int;
var _local6:Array;
var _local7:int;
var _local8:PropertyChangeEvent;
var _local9:Object;
var _local10:Boolean;
var _local11:int;
var _local12:int;
var _local13:CollectionEvent;
_local2 = _arg1;
if (((sort) || (!((filterFunction == null))))){
_local3 = [];
_local5 = 0;
while (_local5 < _arg1.length) {
_local8 = _arg1[_local5];
if (_local8.target){
_local9 = _local8.target;
_local10 = !((_local8.target == _local8.source));
} else {
_local9 = _local8.source;
_local10 = false;
};
_local11 = 0;
while (_local11 < _local3.length) {
if (_local3[_local11].item == _local9){
break;
};
_local11++;
};
if (_local11 < _local3.length){
_local4 = _local3[_local11];
} else {
_local4 = {item:_local9, move:_local10, event:_local8};
_local3.push(_local4);
};
_local4.move = ((((((_local4.move) || (filterFunction))) || (!(_local8.property)))) || (((sort) && (sort.propertyAffectsSort(String(_local8.property))))));
_local5++;
};
_local2 = [];
_local5 = 0;
while (_local5 < _local3.length) {
_local4 = _local3[_local5];
if (_local4.move){
moveItemInView(_local4.item, _local4.item, _local2);
} else {
_local2.push(_local4.item);
};
_local5++;
};
_local6 = new Array();
_local7 = 0;
while (_local7 < _local2.length) {
_local12 = 0;
while (_local12 < _local3.length) {
if (_local2[_local7] == _local3[_local12].item){
_local6.push(_local3[_local12].event);
};
_local12++;
};
_local7++;
};
_local2 = _local6;
};
if (_local2.length > 0){
_local13 = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
_local13.kind = CollectionEventKind.UPDATE;
_local13.items = _local2;
dispatchEvent(_local13);
};
}
public function get list():IList{
return (_list);
}
private function populateLocalIndex():void{
if (list){
localIndex = list.toArray();
} else {
localIndex = [];
};
}
public function set sort(_arg1:Sort):void{
_sort = _arg1;
dispatchEvent(new Event("sortChanged"));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextValue(_arg1:int){
return (getItemAt((_arg1 - 1)));
}
private function addItemsToView(_arg1:Array, _arg2:int, _arg3:Boolean=true):int{
var _local4:Array;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:Object;
var _local9:CollectionEvent;
_local4 = (localIndex) ? [] : _arg1;
_local5 = _arg2;
if (localIndex){
_local6 = _arg2;
_local7 = 0;
while (_local7 < _arg1.length) {
_local8 = _arg1[_local7];
if ((((filterFunction == null)) || (filterFunction(_local8)))){
if (sort){
_local6 = findItem(_local8, Sort.ANY_INDEX_MODE, true);
_local5 = _local6;
};
if (((((sort) && (sort.unique))) && ((sort.compareFunction(_local8, localIndex[_local6]) == 0)))){
throw (new CollectionViewError(resourceIncorrectAddition));
};
var _temp1 = _local6;
_local6 = (_local6 + 1);
localIndex.splice(_temp1, 0, _local8);
_local4.push(_local8);
};
_local7++;
};
};
if (((localIndex) && ((_local4.length > 1)))){
_local5 = -1;
};
if (((_arg3) && ((_local4.length > 0)))){
_local9 = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
_local9.kind = CollectionEventKind.ADD;
_local9.location = _local5;
_local9.items = _local4;
dispatchEvent(_local9);
};
return (_local5);
}
public function dispatchEvent(_arg1:Event):Boolean{
return (eventDispatcher.dispatchEvent(_arg1));
}
public function getItemIndex(_arg1:Object):int{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
if (sort){
_local3 = sort.findItem(localIndex, _arg1, Sort.FIRST_INDEX_MODE);
if (_local3 == -1){
return (-1);
};
_local4 = sort.findItem(localIndex, _arg1, Sort.LAST_INDEX_MODE);
_local2 = _local3;
while (_local2 <= _local4) {
if (localIndex[_local2] == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
} else {
if (filterFunction != null){
_local5 = localIndex.length;
_local2 = 0;
while (_local2 < _local5) {
if (localIndex[_local2] == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
};
};
return (list.getItemIndex(_arg1));
}
public function enableAutoUpdate():void{
if (autoUpdateCounter > 0){
autoUpdateCounter--;
if (autoUpdateCounter == 0){
handlePendingUpdates();
};
};
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
var index:int;
var n:Number;
var name = _arg1;
if ((name is QName)){
name = name.localName;
};
index = -1;
try {
n = parseInt(String(name));
if (!isNaN(n)){
index = int(n);
};
} catch(e:Error) {
};
if (index == -1){
throw (new Error(StringUtil.substitute(resourceUnknownProperty, name)));
};
return (getItemAt(index));
}
mx_internal function getBookmarkIndex(_arg1:CursorBookmark):int{
var _local2:ListCollectionViewBookmark;
if (((!((_arg1 is ListCollectionViewBookmark))) || (!((ListCollectionViewBookmark(_arg1).view == this))))){
throw (new CollectionViewError(resourceBookmarkNotFound));
};
_local2 = ListCollectionViewBookmark(_arg1);
if (_local2.viewRevision != revision){
if ((((((_local2.index < 0)) || ((_local2.index >= length)))) || (!((getItemAt(_local2.index) == _local2.value))))){
_local2.index = getItemIndex(_local2.value);
};
_local2.viewRevision = revision;
};
return (_local2.index);
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
eventDispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public function removeItemAt(_arg1:int):Object{
var _local2:int;
var _local3:Object;
if ((((_arg1 < 0)) || ((_arg1 >= length)))){
throw (new RangeError(StringUtil.substitute(resourceOutOfBounds, _arg1)));
};
_local2 = _arg1;
if (localIndex){
_local3 = localIndex[_arg1];
_local2 = list.getItemIndex(_local3);
};
return (list.removeItemAt(_local2));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function callProperty(_arg1, ... _args){
return (null);
}
public function initialized(_arg1:Object, _arg2:String):void{
refresh();
}
public function setItemAt(_arg1:Object, _arg2:int):Object{
var _local3:int;
var _local4:Object;
if ((((((_arg2 < 0)) || (!(list)))) || ((_arg2 >= length)))){
throw (new RangeError(StringUtil.substitute(resourceOutOfBounds, _arg2)));
};
_local3 = _arg2;
if (localIndex){
if (_arg2 > localIndex.length){
_local3 = list.length;
} else {
_local4 = localIndex[_arg2];
_local3 = list.getItemIndex(_local4);
};
};
return (list.setItemAt(_arg1, _local3));
}
mx_internal function reset():void{
var _local1:CollectionEvent;
internalRefresh(false);
_local1 = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
_local1.kind = CollectionEventKind.RESET;
dispatchEvent(_local1);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var index:int;
var n:Number;
var name = _arg1;
var value = _arg2;
if ((name is QName)){
name = name.localName;
};
index = -1;
try {
n = parseInt(String(name));
if (!isNaN(n)){
index = int(n);
};
} catch(e:Error) {
};
if (index == -1){
throw (new Error(StringUtil.substitute(resourceUnknownProperty, name)));
};
setItemAt(value, index);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
return (((_arg1 < length)) ? (_arg1 + 1) : 0);
}
public function set list(_arg1:IList):void{
var _local2:Boolean;
var _local3:Boolean;
if (_list != _arg1){
if (_list){
_list.removeEventListener(CollectionEvent.COLLECTION_CHANGE, listChangeHandler);
_local2 = (_list.length > 0);
};
_list = _arg1;
if (_list){
_list.addEventListener(CollectionEvent.COLLECTION_CHANGE, listChangeHandler, false, 0, true);
_local3 = (_list.length > 0);
};
if (((_local2) || (_local3))){
reset();
};
dispatchEvent(new Event("listChanged"));
};
}
public function toArray():Array{
var _local1:Array;
if (localIndex){
_local1 = localIndex.concat();
} else {
_local1 = list.toArray();
};
return (_local1);
}
private function internalRefresh(_arg1:Boolean):Boolean{
var tmp:Array;
var len:int;
var i:int;
var item:Object;
var refreshEvent:CollectionEvent;
var dispatch = _arg1;
if (((sort) || (!((filterFunction == null))))){
try {
populateLocalIndex();
} catch(pending:ItemPendingError) {
pending.addResponder(new ItemResponder(function (_arg1:Object, _arg2:Object=null):void{
internalRefresh(dispatch);
}, function (_arg1:Object, _arg2:Object=null):void{
}));
return (false);
};
if (filterFunction != null){
tmp = [];
len = localIndex.length;
i = 0;
while (i < len) {
item = localIndex[i];
if (filterFunction(item)){
tmp.push(item);
};
i = (i + 1);
};
localIndex = tmp;
};
if (sort){
sort.sort(localIndex);
dispatch = true;
};
} else {
if (localIndex){
localIndex = null;
};
};
revision++;
pendingUpdates = null;
if (dispatch){
refreshEvent = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
refreshEvent.kind = CollectionEventKind.REFRESH;
dispatchEvent(refreshEvent);
};
return (true);
}
public function disableAutoUpdate():void{
autoUpdateCounter++;
}
public function refresh():Boolean{
return (internalRefresh(true));
}
public function addItem(_arg1:Object):void{
addItemAt(_arg1, length);
}
public function get filterFunction():Function{
return (_filterFunction);
}
public function createCursor():IViewCursor{
return (new ListCollectionViewCursor(this));
}
public function hasEventListener(_arg1:String):Boolean{
return (eventDispatcher.hasEventListener(_arg1));
}
public function get length():int{
if (localIndex){
return (localIndex.length);
};
if (list){
return (list.length);
};
return (0);
}
public function toString():String{
if (localIndex){
return (ObjectUtil.toString(localIndex));
};
if (((list) && (Object(list).toString))){
return (Object(list).toString());
};
return (getQualifiedClassName(this));
}
private function listChangeHandler(_arg1:CollectionEvent):void{
if (autoUpdateCounter > 0){
if (!pendingUpdates){
pendingUpdates = [];
};
pendingUpdates.push(_arg1);
} else {
switch (_arg1.kind){
case CollectionEventKind.ADD:
addItemsToView(_arg1.items, _arg1.location);
break;
case CollectionEventKind.RESET:
reset();
break;
case CollectionEventKind.REMOVE:
removeItemsFromView(_arg1.items, _arg1.location);
break;
case CollectionEventKind.REPLACE:
replaceItemsInView(_arg1.items, _arg1.location);
break;
case CollectionEventKind.UPDATE:
handlePropertyChangeEvents(_arg1.items);
break;
default:
dispatchEvent(_arg1);
};
};
}
private static function loadResources():void{
resourceOutOfBounds = packageResources.getString("outOfBounds");
resourceInvalidIndex = packageResources.getString("invalidIndex");
resourceUnknownProperty = packageResources.getString("unknownProperty");
resourceIncorrectAddition = packageResources.getString("incorrectAddition");
resourceItemNotFound = packageResources.getString("itemNotFound");
resourceBookmarkNotFound = packageResources.getString("bookmarkNotFound");
}
loadResources();
}
}//package mx.collections
import flash.events.*;
import mx.resources.*;
import flash.system.*;
import mx.core.*;
import mx.events.*;
import mx.collections.errors.*;
class ListCollectionViewBookmark extends CursorBookmark {
mx_internal var viewRevision:int;
mx_internal var view:ListCollectionView;
mx_internal var index:int;
private function ListCollectionViewBookmark(_arg1:Object, _arg2:ListCollectionView, _arg3:int, _arg4:int){
super(_arg1);
this.view = _arg2;
this.viewRevision = _arg3;
this.index = _arg4;
}
override public function getViewIndex():int{
return (view.getBookmarkIndex(this));
}
}
class ListCollectionViewCursor extends EventDispatcher implements IViewCursor {
private var _view:ListCollectionView;
private var currentValue:Object;
private var currentIndex:int;
private var invalid:Boolean;
private static const BEFORE_FIRST_INDEX:int = -1;
private static const AFTER_LAST_INDEX:int = -2;
private static var resourceInvalidInsert:String;
private static var resourceInvalidRemove:String;
private static var resourceInvalidBookmark:String;
private static var resourceBookmarkInvalid:String;
private static var resourceInvalidCursor:String;
private static var packageResources:ResourceBundle = ResourceBundle.getResourceBundle("collections", ApplicationDomain.currentDomain);
private function ListCollectionViewCursor(_arg1:ListCollectionView){
var view = _arg1;
super();
_view = view;
_view.addEventListener(CollectionEvent.COLLECTION_CHANGE, collectionEventHandler, false, 0, true);
currentIndex = ((view.length > 0)) ? 0 : AFTER_LAST_INDEX;
if (currentIndex == 0){
try {
setCurrent(view.getItemAt(0), false);
} catch(e:ItemPendingError) {
currentIndex = BEFORE_FIRST_INDEX;
setCurrent(null, false);
};
};
}
public function movePrevious():Boolean{
var _local1:int;
if (beforeFirst){
return (false);
};
_local1 = (afterLast) ? (view.length - 1) : (currentIndex - 1);
if (_local1 == -1){
_local1 = BEFORE_FIRST_INDEX;
setCurrent(null);
} else {
setCurrent(ListCollectionView(view).getItemAt(_local1));
};
currentIndex = _local1;
return (!(beforeFirst));
}
public function get beforeFirst():Boolean{
checkValid();
return ((((currentIndex == BEFORE_FIRST_INDEX)) || ((view.length == 0))));
}
public function remove():Object{
var oldIndex:int;
var removed:Object;
if (((beforeFirst) || (afterLast))){
throw (new CursorError(resourceInvalidRemove));
};
oldIndex = currentIndex;
currentIndex++;
if (currentIndex >= view.length){
currentIndex = AFTER_LAST_INDEX;
setCurrent(null);
} else {
try {
setCurrent(ListCollectionView(view).getItemAt(currentIndex));
} catch(e:ItemPendingError) {
setCurrent(null, false);
ListCollectionView(view).removeItemAt(oldIndex);
throw (e);
};
};
removed = ListCollectionView(view).removeItemAt(oldIndex);
return (removed);
}
private function collectionEventHandler(_arg1:CollectionEvent):void{
var event = _arg1;
switch (event.kind){
case CollectionEventKind.ADD:
if (event.location <= currentIndex){
currentIndex = (currentIndex + event.items.length);
};
break;
case CollectionEventKind.REMOVE:
if (event.location < currentIndex){
currentIndex = (currentIndex - event.items.length);
} else {
if (event.location == currentIndex){
if (currentIndex < view.length){
try {
setCurrent(ListCollectionView(view).getItemAt(currentIndex));
} catch(error:ItemPendingError) {
setCurrent(null, false);
};
} else {
currentIndex = AFTER_LAST_INDEX;
setCurrent(null);
};
};
};
break;
case CollectionEventKind.MOVE:
if (event.oldLocation == currentIndex){
currentIndex = event.location;
} else {
if (event.oldLocation < currentIndex){
currentIndex = (currentIndex - event.items.length);
};
if (event.location <= currentIndex){
currentIndex = (currentIndex + event.items.length);
};
};
break;
case CollectionEventKind.REFRESH:
if (!((beforeFirst) || (afterLast))){
currentIndex = ListCollectionView(view).getItemIndex(currentValue);
if (currentIndex == -1){
setCurrent(null);
};
};
break;
case CollectionEventKind.REPLACE:
if (event.location == currentIndex){
try {
setCurrent(ListCollectionView(view).getItemAt(currentIndex));
} catch(error:ItemPendingError) {
setCurrent(null, false);
};
};
break;
case CollectionEventKind.RESET:
currentIndex = BEFORE_FIRST_INDEX;
setCurrent(null);
break;
};
}
public function get current():Object{
checkValid();
return (currentValue);
}
public function get afterLast():Boolean{
checkValid();
return ((((currentIndex == AFTER_LAST_INDEX)) || ((view.length == 0))));
}
public function findFirst(_arg1:Object):Boolean{
var lcView:ListCollectionView;
var index:int;
var values = _arg1;
checkValid();
lcView = ListCollectionView(view);
try {
index = lcView.findItem(values, Sort.FIRST_INDEX_MODE);
} catch(sortError:SortError) {
throw (new CursorError(sortError.message));
};
if (index > -1){
currentIndex = index;
setCurrent(lcView.getItemAt(currentIndex));
};
return ((index > -1));
}
public function get view():ICollectionView{
checkValid();
return (_view);
}
private function setCurrent(_arg1:Object, _arg2:Boolean=true):void{
currentValue = _arg1;
if (_arg2){
dispatchEvent(new FlexEvent(FlexEvent.CURSOR_UPDATE));
};
}
public function insert(_arg1:Object):void{
var _local2:int;
if (afterLast){
_local2 = view.length;
} else {
if (beforeFirst){
if (view.length > 0){
throw (new CursorError(resourceInvalidInsert));
};
_local2 = 0;
} else {
_local2 = currentIndex;
};
};
ListCollectionView(view).addItemAt(_arg1, _local2);
}
public function get bookmark():CursorBookmark{
checkValid();
if ((((view.length == 0)) || (beforeFirst))){
return (CursorBookmark.FIRST);
};
if (afterLast){
return (CursorBookmark.LAST);
};
return (ListCollectionView(view).getBookmark(currentIndex));
}
private function checkValid():void{
if (invalid){
throw (new CursorError(resourceInvalidCursor));
};
}
public function moveNext():Boolean{
var _local1:int;
if (afterLast){
return (false);
};
_local1 = (beforeFirst) ? 0 : (currentIndex + 1);
if (_local1 >= view.length){
_local1 = AFTER_LAST_INDEX;
setCurrent(null);
} else {
setCurrent(ListCollectionView(view).getItemAt(_local1));
};
currentIndex = _local1;
return (!(afterLast));
}
public function findLast(_arg1:Object):Boolean{
var lcView:ListCollectionView;
var index:int;
var values = _arg1;
checkValid();
lcView = ListCollectionView(view);
try {
index = lcView.findItem(values, Sort.LAST_INDEX_MODE);
} catch(sortError:SortError) {
throw (new CursorError(sortError.message));
};
if (index > -1){
currentIndex = index;
setCurrent(lcView.getItemAt(currentIndex));
};
return ((index > -1));
}
public function seek(_arg1:CursorBookmark, _arg2:int=0, _arg3:int=0):void{
var newIndex:int;
var newCurrent:Object;
var bookmark = _arg1;
var offset = _arg2;
var prefetch = _arg3;
checkValid();
if (view.length == 0){
currentIndex = AFTER_LAST_INDEX;
setCurrent(null, false);
return;
};
newIndex = currentIndex;
if (bookmark == CursorBookmark.FIRST){
newIndex = 0;
} else {
if (bookmark == CursorBookmark.LAST){
newIndex = (view.length - 1);
} else {
if (bookmark != CursorBookmark.CURRENT){
try {
newIndex = ListCollectionView(view).getBookmarkIndex(bookmark);
if (newIndex < 0){
setCurrent(null);
throw (new CursorError(resourceBookmarkInvalid));
};
} catch(bmError:CollectionViewError) {
throw (new CursorError(resourceInvalidBookmark));
};
};
};
};
newIndex = (newIndex + offset);
newCurrent = null;
if (newIndex >= view.length){
currentIndex = AFTER_LAST_INDEX;
} else {
if (newIndex < 0){
currentIndex = BEFORE_FIRST_INDEX;
} else {
newCurrent = ListCollectionView(view).getItemAt(newIndex, prefetch);
currentIndex = newIndex;
};
};
setCurrent(newCurrent);
}
public function findAny(_arg1:Object):Boolean{
var lcView:ListCollectionView;
var index:int;
var values = _arg1;
checkValid();
lcView = ListCollectionView(view);
try {
index = lcView.findItem(values, Sort.ANY_INDEX_MODE);
} catch(e:SortError) {
throw (new CursorError(e.message));
};
if (index > -1){
currentIndex = index;
setCurrent(lcView.getItemAt(currentIndex));
};
return ((index > -1));
}
private static function loadResources():void{
resourceInvalidInsert = packageResources.getString("invalidInsert");
resourceInvalidRemove = packageResources.getString("invalidRemove");
resourceBookmarkInvalid = packageResources.getString("bookmarkInvalid");
resourceInvalidBookmark = packageResources.getString("invalidBookmark");
resourceInvalidCursor = packageResources.getString("invalidCursor");
}
loadResources();
}
Section 14
//Sort (mx.collections.Sort)
package mx.collections {
import flash.events.*;
import mx.resources.*;
import flash.system.*;
import mx.core.*;
import mx.utils.*;
import mx.collections.errors.*;
public class Sort extends EventDispatcher {
private var usingCustomCompareFunction:Boolean;
private var _fields:Array;
private var _compareFunction:Function;
private var noFieldsDescending:Boolean;// = false
private var defaultEmptyField:SortField;
private var fieldList:Array;
private var _unique:Boolean;
public static const ANY_INDEX_MODE:String = "any";
public static const FIRST_INDEX_MODE:String = "first";
mx_internal static const VERSION:String = "2.0.1.0";
public static const LAST_INDEX_MODE:String = "last";
private static var resourceNoComparator:String;
private static var resourceFindRestriction:String;
private static var resourceNoItems:String;
private static var resourceFindCondition:String;
private static var resourceUnknownMode:String;
private static var resourceNonUnique:String;
private static var packageResources:ResourceBundle = ResourceBundle.getResourceBundle("collections", ApplicationDomain.currentDomain);
public function Sort(){
fieldList = [];
noFieldsDescending = false;
super();
}
public function findItem(_arg1:Array, _arg2:Object, _arg3:String, _arg4:Boolean=false, _arg5:Function=null):int{
var compareForFind:Function;
var fieldsForCompare:Array;
var found:Boolean;
var objFound:Boolean;
var index:int;
var lowerBound:int;
var upperBound:int;
var obj:Object;
var direction:int;
var fieldName:String;
var hadPreviousFieldName:Boolean;
var i:int;
var hasFieldName:Boolean;
var objIndex:int;
var match:Boolean;
var prevCompare:int;
var nextCompare:int;
var items = _arg1;
var values = _arg2;
var mode = _arg3;
var returnInsertionIndex = _arg4;
var compareFunction = _arg5;
if (!items){
throw (new SortError(resourceNoItems));
};
if (items.length == 0){
return ((returnInsertionIndex) ? 1 : -1);
};
if (compareFunction == null){
compareForFind = this.compareFunction;
if (((values) && ((fieldList.length > 0)))){
fieldsForCompare = [];
hadPreviousFieldName = true;
i = 0;
while (i < fieldList.length) {
fieldName = fieldList[i];
if (fieldName){
try {
hasFieldName = !((values[fieldName] === undefined));
} catch(e:Error) {
hasFieldName = false;
};
if (hasFieldName){
if (!hadPreviousFieldName){
throw (new SortError(StringUtil.substitute(resourceFindCondition, fieldName)));
};
fieldsForCompare.push(fieldName);
} else {
hadPreviousFieldName = false;
};
} else {
fieldsForCompare.push(null);
};
i = (i + 1);
};
if (fieldsForCompare.length == 0){
throw (new SortError(resourceFindRestriction));
};
try {
initSortFields(items[0]);
} catch(initSortError:SortError) {
};
};
} else {
compareForFind = compareFunction;
};
found = false;
objFound = false;
index = 0;
lowerBound = 0;
upperBound = (items.length - 1);
obj = null;
direction = 1;
while (((!(objFound)) && ((lowerBound <= upperBound)))) {
index = Math.round(((lowerBound + upperBound) / 2));
obj = items[index];
direction = (fieldsForCompare) ? compareForFind(values, obj, fieldsForCompare) : compareForFind(values, obj);
switch (direction){
case -1:
upperBound = (index - 1);
break;
case 0:
objFound = true;
switch (mode){
case ANY_INDEX_MODE:
found = true;
break;
case FIRST_INDEX_MODE:
found = (index == lowerBound);
objIndex = (index - 1);
match = true;
while (((((match) && (!(found)))) && ((objIndex >= lowerBound)))) {
obj = items[objIndex];
prevCompare = (fieldsForCompare) ? compareForFind(values, obj, fieldsForCompare) : compareForFind(values, obj);
match = (prevCompare == 0);
if (((!(match)) || (((match) && ((objIndex == lowerBound)))))){
found = true;
index = (objIndex + (match) ? 0 : 1);
};
objIndex = (objIndex - 1);
};
break;
case LAST_INDEX_MODE:
found = (index == upperBound);
objIndex = (index + 1);
match = true;
while (((((match) && (!(found)))) && ((objIndex <= upperBound)))) {
obj = items[objIndex];
nextCompare = (fieldsForCompare) ? compareForFind(values, obj, fieldsForCompare) : compareForFind(values, obj);
match = (nextCompare == 0);
if (((!(match)) || (((match) && ((objIndex == upperBound)))))){
found = true;
index = (objIndex - (match) ? 0 : 1);
};
objIndex = (objIndex + 1);
};
break;
default:
throw (new SortError(resourceUnknownMode));
};
break;
case 1:
lowerBound = (index + 1);
break;
};
};
if (((!(found)) && (!(returnInsertionIndex)))){
return (-1);
};
return (((direction)>0) ? (index + 1) : index);
}
public function get compareFunction():Function{
return ((usingCustomCompareFunction) ? _compareFunction : internalCompare);
}
public function set unique(_arg1:Boolean):void{
_unique = _arg1;
}
public function sort(_arg1:Array):void{
var fixedCompareFunction:Function;
var uniqueRet1:Object;
var fields:Array;
var i:int;
var sortArgs:Object;
var uniqueRet2:Object;
var items = _arg1;
if (((!(items)) || ((items.length <= 1)))){
return;
};
if (usingCustomCompareFunction){
fixedCompareFunction = function (_arg1:Object, _arg2:Object):int{
return (compareFunction(_arg1, _arg2, _fields));
};
if (unique){
uniqueRet1 = items.sort(fixedCompareFunction, Array.UNIQUESORT);
if (uniqueRet1 == 0){
throw (new SortError(resourceNonUnique));
};
} else {
items.sort(fixedCompareFunction);
};
} else {
fields = this.fields;
if (((fields) && ((fields.length > 0)))){
sortArgs = initSortFields(items[0], true);
if (unique){
if (((sortArgs) && ((fields.length == 1)))){
uniqueRet2 = items.sortOn(sortArgs.fields[0], (sortArgs.options[0] | Array.UNIQUESORT));
} else {
uniqueRet2 = items.sort(internalCompare, Array.UNIQUESORT);
};
if (uniqueRet2 == 0){
throw (new SortError(resourceNonUnique));
};
} else {
if (sortArgs){
items.sortOn(sortArgs.fields, sortArgs.options);
} else {
items.sort(internalCompare);
};
};
} else {
items.sort(internalCompare);
};
};
}
public function propertyAffectsSort(_arg1:String):Boolean{
var _local2:int;
var _local3:SortField;
if (((usingCustomCompareFunction) || (!(fields)))){
return (true);
};
_local2 = 0;
while (_local2 < fields.length) {
_local3 = fields[_local2];
if ((((_local3.name == _arg1)) || (_local3.usingCustomCompareFunction))){
return (true);
};
_local2++;
};
return (false);
}
private function internalCompare(_arg1:Object, _arg2:Object, _arg3:Array=null):int{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:SortField;
_local4 = 0;
if (!_fields){
_local4 = noFieldsCompare(_arg1, _arg2);
} else {
_local5 = 0;
_local6 = (_arg3) ? _arg3.length : _fields.length;
while ((((_local4 == 0)) && ((_local5 < _local6)))) {
_local7 = SortField(_fields[_local5]);
_local4 = _local7.internalCompare(_arg1, _arg2);
_local5++;
};
};
return (_local4);
}
public function get unique():Boolean{
return (_unique);
}
private function noFieldsCompare(_arg1:Object, _arg2:Object, _arg3:Array=null):int{
var result:int;
var a = _arg1;
var b = _arg2;
var fields = _arg3;
if (!defaultEmptyField){
defaultEmptyField = new SortField();
try {
defaultEmptyField.initCompare(a);
} catch(e:SortError) {
throw (new SortError(StringUtil.substitute(resourceNoComparator, a)));
};
};
result = defaultEmptyField.compareFunction(a, b);
if (noFieldsDescending){
result = (result * -1);
};
return (result);
}
override public function toString():String{
return (ObjectUtil.toString(this));
}
private function initSortFields(_arg1:Object, _arg2:Boolean=false):Object{
var _local3:Object;
var _local4:int;
var _local5:SortField;
var _local6:int;
_local3 = null;
_local4 = 0;
while (_local4 < fields.length) {
SortField(fields[_local4]).initCompare(_arg1);
_local4++;
};
if (_arg2){
_local3 = {fields:[], options:[]};
_local4 = 0;
while (_local4 < fields.length) {
_local5 = fields[_local4];
_local6 = _local5.getArraySortOnOptions();
if (_local6 == -1){
return (null);
};
_local3.fields.push(_local5.name);
_local3.options.push(_local6);
_local4++;
};
};
return (_local3);
}
public function reverse():void{
var _local1:int;
if (fields){
_local1 = 0;
while (_local1 < fields.length) {
SortField(fields[_local1]).reverse();
_local1++;
};
};
noFieldsDescending = !(noFieldsDescending);
}
public function set fields(_arg1:Array):void{
var _local2:SortField;
var _local3:int;
_fields = _arg1;
fieldList = [];
if (_fields){
_local3 = 0;
while (_local3 < _fields.length) {
_local2 = SortField(_fields[_local3]);
fieldList.push(_local2.name);
_local3++;
};
};
dispatchEvent(new Event("fieldsChanged"));
}
public function get fields():Array{
return (_fields);
}
public function set compareFunction(_arg1:Function):void{
_compareFunction = _arg1;
usingCustomCompareFunction = !((_compareFunction == null));
}
private static function loadResources():void{
resourceNoItems = packageResources.getString("noItems");
resourceFindCondition = packageResources.getString("findCondition");
resourceFindRestriction = packageResources.getString("findRestriction");
resourceUnknownMode = packageResources.getString("unknownMode");
resourceNonUnique = packageResources.getString("nonUnique");
resourceNoComparator = packageResources.getString("noComparator");
}
loadResources();
}
}//package mx.collections
Section 15
//SortField (mx.collections.SortField)
package mx.collections {
import flash.events.*;
import mx.resources.*;
import flash.system.*;
import mx.core.*;
import mx.utils.*;
import mx.collections.errors.*;
public class SortField extends EventDispatcher {
private var _caseInsensitive:Boolean;
private var _compareFunction:Function;
private var _numeric:Boolean;
private var _descending:Boolean;
private var _usingCustomCompareFunction:Boolean;
private var _name:String;
mx_internal static const VERSION:String = "2.0.1.0";
private static var resourceNoComparatorSortField:String;
private static var packageResources:ResourceBundle = ResourceBundle.getResourceBundle("collections", ApplicationDomain.currentDomain);
public function SortField(_arg1:String=null, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Boolean=false){
_name = _arg1;
_caseInsensitive = _arg2;
_descending = _arg3;
_numeric = _arg4;
_compareFunction = stringCompare;
}
public function get caseInsensitive():Boolean{
return (_caseInsensitive);
}
public function set caseInsensitive(_arg1:Boolean):void{
if (_arg1 != _caseInsensitive){
_caseInsensitive = _arg1;
dispatchEvent(new Event("caseInsensitiveChanged"));
};
}
public function get name():String{
return (_name);
}
public function set name(_arg1:String):void{
_name = _arg1;
dispatchEvent(new Event("nameChanged"));
}
mx_internal function get usingCustomCompareFunction():Boolean{
return (_usingCustomCompareFunction);
}
private function numericCompare(_arg1:Object, _arg2:Object):int{
var fa:Number;
var fb:Number;
var a = _arg1;
var b = _arg2;
try {
fa = ((_name == null)) ? Number(a) : Number(a[_name]);
} catch(error:Error) {
};
try {
fb = ((_name == null)) ? Number(b) : Number(b[_name]);
} catch(error:Error) {
};
return (ObjectUtil.numericCompare(fa, fb));
}
public function set numeric(_arg1:Boolean):void{
if (_numeric != _arg1){
_numeric = _arg1;
dispatchEvent(new Event("numericChanged"));
};
}
private function stringCompare(_arg1:Object, _arg2:Object):int{
var fa:String;
var fb:String;
var a = _arg1;
var b = _arg2;
try {
fa = ((_name == null)) ? String(a) : String(a[_name]);
} catch(error:Error) {
};
try {
fb = ((_name == null)) ? String(b) : String(b[_name]);
} catch(error:Error) {
};
return (ObjectUtil.stringCompare(fa, fb, _caseInsensitive));
}
public function get compareFunction():Function{
return (_compareFunction);
}
public function get numeric():Boolean{
return (_numeric);
}
mx_internal function internalCompare(_arg1:Object, _arg2:Object):int{
var _local3:int;
_local3 = compareFunction(_arg1, _arg2);
if (descending){
_local3 = (_local3 * -1);
};
return (_local3);
}
public function reverse():void{
descending = !(descending);
}
override public function toString():String{
return (ObjectUtil.toString(this));
}
mx_internal function getArraySortOnOptions():int{
var _local1:int;
if (((((((usingCustomCompareFunction) || ((name == null)))) || ((_compareFunction == xmlCompare)))) || ((_compareFunction == dateCompare)))){
return (-1);
};
_local1 = 0;
if (caseInsensitive){
_local1 = (_local1 | Array.CASEINSENSITIVE);
};
if (descending){
_local1 = (_local1 | Array.DESCENDING);
};
if (((numeric) || ((_compareFunction == numericCompare)))){
_local1 = (_local1 | Array.NUMERIC);
};
return (_local1);
}
private function dateCompare(_arg1:Object, _arg2:Object):int{
var fa:Date;
var fb:Date;
var a = _arg1;
var b = _arg2;
try {
fa = ((_name == null)) ? (a as Date) : (a[_name] as Date);
} catch(error:Error) {
};
try {
fb = ((_name == null)) ? (b as Date) : (b[_name] as Date);
} catch(error:Error) {
};
return (ObjectUtil.dateCompare(fa, fb));
}
public function set descending(_arg1:Boolean):void{
if (_descending != _arg1){
_descending = _arg1;
dispatchEvent(new Event("descendingChanged"));
};
}
private function xmlCompare(_arg1:Object, _arg2:Object):int{
var sa:String;
var sb:String;
var a = _arg1;
var b = _arg2;
try {
sa = ((_name == null)) ? a.toString() : a[_name].toString();
} catch(error:Error) {
};
try {
sb = ((_name == null)) ? b.toString() : b[_name].toString();
} catch(error:Error) {
};
if (numeric){
return (ObjectUtil.numericCompare(parseFloat(sa), parseFloat(sb)));
};
return (ObjectUtil.stringCompare(sa, sb, _caseInsensitive));
}
mx_internal function initCompare(_arg1:Object):void{
var value:Object;
var typ:String;
var test:String;
var obj = _arg1;
if (!usingCustomCompareFunction){
if (numeric){
_compareFunction = numericCompare;
} else {
if (caseInsensitive){
_compareFunction = stringCompare;
} else {
if (_name){
try {
value = obj[_name];
} catch(error:Error) {
};
};
if (value == null){
value = obj;
};
typ = typeof(value);
switch (typ){
case "string":
_compareFunction = stringCompare;
break;
case "object":
if ((value is Date)){
_compareFunction = dateCompare;
} else {
_compareFunction = stringCompare;
try {
test = value.toString();
} catch(error2:Error) {
};
if (((!(test)) || ((test == "[object Object]")))){
_compareFunction = nullCompare;
};
};
break;
case "xml":
_compareFunction = xmlCompare;
break;
case "boolean":
case "number":
_compareFunction = numericCompare;
break;
};
};
};
};
}
private function nullCompare(_arg1:Object, _arg2:Object):int{
var value:Object;
var left:Object;
var right:Object;
var found:Boolean;
var typeLeft:String;
var typeRight:String;
var a = _arg1;
var b = _arg2;
found = false;
if ((((a == null)) && ((b == null)))){
return (0);
};
if (_name){
try {
left = a[_name];
} catch(error:Error) {
};
try {
right = b[_name];
} catch(error:Error) {
};
};
if ((((left == null)) && ((right == null)))){
return (0);
};
if (left == null){
left = a;
};
if (right == null){
right = b;
};
typeLeft = typeof(left);
typeRight = typeof(right);
if ((((typeLeft == "string")) || ((typeRight == "string")))){
found = true;
_compareFunction = stringCompare;
} else {
if ((((typeLeft == "object")) || ((typeRight == "object")))){
if ((((typeLeft is Date)) || ((typeRight is Date)))){
found = true;
_compareFunction = dateCompare;
};
} else {
if ((((typeLeft == "xml")) || ((typeRight == "xml")))){
found = true;
_compareFunction = xmlCompare;
} else {
if ((((((((typeLeft == "number")) || ((typeRight == "number")))) || ((typeLeft == "boolean")))) || ((typeRight == "boolean")))){
found = true;
_compareFunction = numericCompare;
};
};
};
};
if (found){
return (_compareFunction(left, right));
};
throw (new SortError(StringUtil.substitute(resourceNoComparatorSortField, name)));
}
public function get descending():Boolean{
return (_descending);
}
public function set compareFunction(_arg1:Function):void{
_compareFunction = _arg1;
_usingCustomCompareFunction = !((_arg1 == null));
}
private static function loadResources():void{
resourceNoComparatorSortField = packageResources.getString("noComparatorSortField");
}
loadResources();
}
}//package mx.collections
Section 16
//ByteArrayAsset (mx.core.ByteArrayAsset)
package mx.core {
import flash.utils.*;
public class ByteArrayAsset extends ByteArray implements IFlexAsset {
mx_internal static const VERSION:String = "2.0.1.0";
}
}//package mx.core
Section 17
//IChildList (mx.core.IChildList)
package mx.core {
import flash.display.*;
import flash.geom.*;
public interface IChildList {
function get numChildren():int;
function contains(_arg1:DisplayObject):Boolean;
function getChildByName(_arg1:String):DisplayObject;
function removeChildAt(_arg1:int):DisplayObject;
function getChildIndex(_arg1:DisplayObject):int;
function addChildAt(_arg1:DisplayObject, _arg2:int):DisplayObject;
function getObjectsUnderPoint(_arg1:Point):Array;
function removeChild(_arg1:DisplayObject):DisplayObject;
function getChildAt(_arg1:int):DisplayObject;
function addChild(_arg1:DisplayObject):DisplayObject;
function setChildIndex(_arg1:DisplayObject, _arg2:int):void;
}
}//package mx.core
Section 18
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 19
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.display.*;
import flash.events.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get name():String;
function set width(_arg1:Number):void;
function get measuredHeight():Number;
function set height(_arg1:Number):void;
function get scaleY():Number;
function move(_arg1:Number, _arg2:Number):void;
function get scaleX():Number;
function set mask(_arg1:DisplayObject):void;
function set scaleX(_arg1:Number):void;
function set name(_arg1:String):void;
function set scaleY(_arg1:Number):void;
function get visible():Boolean;
function get measuredWidth():Number;
function set visible(_arg1:Boolean):void;
function get alpha():Number;
function get height():Number;
function get width():Number;
function get parent():DisplayObjectContainer;
function get mask():DisplayObject;
function set x(_arg1:Number):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set y(_arg1:Number):void;
function get x():Number;
function get y():Number;
function set alpha(_arg1:Number):void;
}
}//package mx.core
Section 20
//IFlexModuleFactory (mx.core.IFlexModuleFactory)
package mx.core {
public interface IFlexModuleFactory {
function create(... _args):Object;
function info():Object;
}
}//package mx.core
Section 21
//IMXMLObject (mx.core.IMXMLObject)
package mx.core {
public interface IMXMLObject {
function initialized(_arg1:Object, _arg2:String):void;
}
}//package mx.core
Section 22
//IPropertyChangeNotifier (mx.core.IPropertyChangeNotifier)
package mx.core {
import flash.events.*;
public interface IPropertyChangeNotifier extends IEventDispatcher, IUID {
}
}//package mx.core
Section 23
//IUIComponent (mx.core.IUIComponent)
package mx.core {
import flash.display.*;
import mx.managers.*;
import flash.geom.*;
public interface IUIComponent extends IFlexDisplayObject {
function set enabled(_arg1:Boolean):void;
function set measuredMinWidth(_arg1:Number):void;
function set isPopUp(_arg1:Boolean):void;
function get percentWidth():Number;
function set percentWidth(_arg1:Number):void;
function get baselinePosition():Number;
function initialize():void;
function getExplicitOrMeasuredWidth():Number;
function set percentHeight(_arg1:Number):void;
function get minHeight():Number;
function getExplicitOrMeasuredHeight():Number;
function get document():Object;
function get explicitMaxWidth():Number;
function set scrollRect(_arg1:Rectangle):void;
function get cacheAsBitmap():Boolean;
function get maxHeight():Number;
function get minWidth():Number;
function owns(_arg1:DisplayObject):Boolean;
function get opaqueBackground():Object;
function setVisible(_arg1:Boolean, _arg2:Boolean=false):void;
function get owner():DisplayObjectContainer;
function set document(_arg1:Object):void;
function get tweeningProperties():Array;
function get enabled():Boolean;
function get isPopUp():Boolean;
function get explicitMinHeight():Number;
function set focusPane(_arg1:Sprite):void;
function get maxWidth():Number;
function get percentHeight():Number;
function set tweeningProperties(_arg1:Array):void;
function get explicitMaxHeight():Number;
function get focusPane():Sprite;
function parentChanged(_arg1:DisplayObjectContainer):void;
function set opaqueBackground(_arg1:Object):void;
function set measuredMinHeight(_arg1:Number):void;
function set cacheAsBitmap(_arg1:Boolean):void;
function get scrollRect():Rectangle;
function set explicitWidth(_arg1:Number):void;
function set owner(_arg1:DisplayObjectContainer):void;
function set includeInLayout(_arg1:Boolean):void;
function get explicitMinWidth():Number;
function get explicitWidth():Number;
function get measuredMinHeight():Number;
function set explicitHeight(_arg1:Number):void;
function get includeInLayout():Boolean;
function get measuredMinWidth():Number;
function get explicitHeight():Number;
function set systemManager(_arg1:ISystemManager):void;
function get systemManager():ISystemManager;
}
}//package mx.core
Section 24
//IUID (mx.core.IUID)
package mx.core {
public interface IUID {
function get uid():String;
function set uid(_arg1:String):void;
}
}//package mx.core
Section 25
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 26
//SoundAsset (mx.core.SoundAsset)
package mx.core {
import flash.media.*;
public class SoundAsset extends Sound implements IFlexAsset {
mx_internal static const VERSION:String = "2.0.1.0";
}
}//package mx.core
Section 27
//CollectionEvent (mx.events.CollectionEvent)
package mx.events {
import flash.events.*;
import mx.core.*;
public class CollectionEvent extends Event {
public var items:Array;
public var kind:String;
public var location:int;
public var oldLocation:int;
mx_internal static const VERSION:String = "2.0.1.0";
public static const COLLECTION_CHANGE:String = "collectionChange";
public function CollectionEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:String=null, _arg5:int=-1, _arg6:int=-1, _arg7:Array=null){
super(_arg1, _arg2, _arg3);
this.kind = _arg4;
this.location = _arg5;
this.oldLocation = _arg6;
this.items = (_arg7) ? _arg7 : [];
}
override public function clone():Event{
return (new CollectionEvent(type, bubbles, cancelable, kind, location, oldLocation, items));
}
override public function toString():String{
return (formatToString("CollectionEvent", "kind", "location", "oldLocation", "type", "bubbles", "cancelable", "eventPhase"));
}
}
}//package mx.events
Section 28
//CollectionEventKind (mx.events.CollectionEventKind)
package mx.events {
import mx.core.*;
public final class CollectionEventKind {
public static const ADD:String = "add";
public static const REMOVE:String = "remove";
public static const UPDATE:String = "update";
public static const MOVE:String = "move";
mx_internal static const EXPAND:String = "expand";
public static const REPLACE:String = "replace";
mx_internal static const VERSION:String = "2.0.1.0";
public static const REFRESH:String = "refresh";
public static const RESET:String = "reset";
}
}//package mx.events
Section 29
//FlexEvent (mx.events.FlexEvent)
package mx.events {
import flash.events.*;
import mx.core.*;
public class FlexEvent extends Event {
public static const ADD:String = "add";
public static const TRANSFORM_CHANGE:String = "transformChange";
public static const INIT_COMPLETE:String = "initComplete";
public static const REMOVE:String = "remove";
public static const BUTTON_DOWN:String = "buttonDown";
public static const EXIT_STATE:String = "exitState";
public static const CREATION_COMPLETE:String = "creationComplete";
public static const REPEAT:String = "repeat";
public static const LOADING:String = "loading";
public static const REPEAT_START:String = "repeatStart";
public static const INITIALIZE:String = "initialize";
public static const ENTER_STATE:String = "enterState";
public static const URL_CHANGED:String = "urlChanged";
public static const REPEAT_END:String = "repeatEnd";
mx_internal static const VERSION:String = "2.0.1.0";
public static const HIDE:String = "hide";
public static const ENTER:String = "enter";
public static const PRELOADER_DONE:String = "preloaderDone";
public static const CURSOR_UPDATE:String = "cursorUpdate";
public static const PREINITIALIZE:String = "preinitialize";
public static const INVALID:String = "invalid";
public static const IDLE:String = "idle";
public static const VALID:String = "valid";
public static const DATA_CHANGE:String = "dataChange";
public static const APPLICATION_COMPLETE:String = "applicationComplete";
public static const VALUE_COMMIT:String = "valueCommit";
public static const UPDATE_COMPLETE:String = "updateComplete";
public static const INIT_PROGRESS:String = "initProgress";
public static const SHOW:String = "show";
public function FlexEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function clone():Event{
return (new FlexEvent(type, bubbles, cancelable));
}
}
}//package mx.events
Section 30
//PropertyChangeEvent (mx.events.PropertyChangeEvent)
package mx.events {
import flash.events.*;
import mx.core.*;
public class PropertyChangeEvent extends Event {
public var oldValue:Object;
public var property:Object;
public var source:Object;
public var kind:String;
public var newValue:Object;
mx_internal static const VERSION:String = "2.0.1.0";
public static const PROPERTY_CHANGE:String = "propertyChange";
public function PropertyChangeEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:String=null, _arg5:Object=null, _arg6:Object=null, _arg7:Object=null, _arg8:Object=null){
super(_arg1, _arg2, _arg3);
this.kind = _arg4;
this.property = _arg5;
this.oldValue = _arg6;
this.newValue = _arg7;
this.source = _arg8;
}
override public function clone():Event{
return (new PropertyChangeEvent(type, bubbles, cancelable, kind, property, oldValue, newValue, source));
}
public static function createUpdateEvent(_arg1:Object, _arg2:Object, _arg3:Object, _arg4:Object):PropertyChangeEvent{
var _local5:PropertyChangeEvent;
_local5 = new PropertyChangeEvent(PROPERTY_CHANGE);
_local5.kind = PropertyChangeEventKind.UPDATE;
_local5.oldValue = _arg3;
_local5.newValue = _arg4;
_local5.source = _arg1;
_local5.property = _arg2;
return (_local5);
}
}
}//package mx.events
Section 31
//PropertyChangeEventKind (mx.events.PropertyChangeEventKind)
package mx.events {
import mx.core.*;
public final class PropertyChangeEventKind {
mx_internal static const VERSION:String = "2.0.1.0";
public static const UPDATE:String = "update";
public static const DELETE:String = "delete";
}
}//package mx.events
Section 32
//GeneratedLocale (mx.generated.GeneratedLocale)
package mx.generated {
import mx.resources.*;
public class GeneratedLocale extends Locale {
public function GeneratedLocale(){
super("en_US");
}
}
}//package mx.generated
Section 33
//BitmapFill (mx.graphics.BitmapFill)
package mx.graphics {
import flash.display.*;
import flash.utils.*;
import mx.core.*;
import flash.geom.*;
public class BitmapFill implements IFill {
private var _bmp:BitmapData;
public var scaleX:Number;// = 1
public var scaleY:Number;// = 1
private var _matrix:Matrix;
public var repeat:Boolean;// = true
public var offsetX:Number;// = 0
public var offsetY:Number;// = 0
public var smooth:Boolean;// = false
public var originX:Number;// = 0
public var originY:Number;// = 0
public var rotation:Number;// = 0
mx_internal static const VERSION:String = "2.0.1.0";
public function BitmapFill(){
originX = 0;
originY = 0;
offsetX = 0;
offsetY = 0;
repeat = true;
rotation = 0;
scaleX = 1;
scaleY = 1;
smooth = false;
super();
}
public function get source():Object{
return (_bmp);
}
private function buildMatrix():void{
_matrix = new Matrix();
_matrix.translate(-(originX), -(originY));
_matrix.scale(scaleX, scaleY);
_matrix.rotate(rotation);
_matrix.translate(offsetX, offsetY);
}
public function begin(_arg1:Graphics, _arg2:Rectangle):void{
buildMatrix();
if (_bmp == null){
return;
};
_arg1.beginBitmapFill(_bmp, _matrix, repeat, smooth);
}
public function end(_arg1:Graphics):void{
_arg1.endFill();
}
public function set source(_arg1:Object):void{
var _local2:DisplayObject;
var _local3:Class;
var _local4:Class;
if ((_arg1 is BitmapData)){
_bmp = BitmapData(_arg1);
return;
};
if ((_arg1 is Class)){
_local3 = Class(_arg1);
_local2 = new (_local3);
} else {
if ((_arg1 is Bitmap)){
_bmp = _arg1.bitmapData;
} else {
if ((_arg1 is DisplayObject)){
} else {
if ((_arg1 is String)){
_local4 = Class(getDefinitionByName(String(_arg1)));
_local2 = new (_local4);
} else {
return;
};
};
};
};
if ((((_bmp == null)) && (!((_local2 == null))))){
_bmp = new BitmapData(_local2.width, _local2.height);
_bmp.draw(_local2, new Matrix());
};
}
}
}//package mx.graphics
Section 34
//IFill (mx.graphics.IFill)
package mx.graphics {
import flash.display.*;
import flash.geom.*;
public interface IFill {
function begin(_arg1:Graphics, _arg2:Rectangle):void;
function end(_arg1:Graphics):void;
}
}//package mx.graphics
Section 35
//IFocusManager (mx.managers.IFocusManager)
package mx.managers {
import flash.display.*;
import mx.core.*;
public interface IFocusManager {
function get focusPane():Sprite;
function getFocus():IFocusManagerComponent;
function deactivate():void;
function hideFocus():void;
function set defaultButton(_arg1:IUIComponent):void;
function set showFocusIndicator(_arg1:Boolean):void;
function get defaultButtonEnabled():Boolean;
function set focusPane(_arg1:Sprite):void;
function get nextTabIndex():int;
function get defaultButton():IUIComponent;
function get showFocusIndicator():Boolean;
function activate():void;
function showFocus():void;
function set defaultButtonEnabled(_arg1:Boolean):void;
function setFocus(_arg1:IFocusManagerComponent):void;
function findFocusManagerComponent(_arg1:InteractiveObject):IFocusManagerComponent;
function getNextFocusManagerComponent(_arg1:Boolean=false):IFocusManagerComponent;
}
}//package mx.managers
Section 36
//IFocusManagerComponent (mx.managers.IFocusManagerComponent)
package mx.managers {
public interface IFocusManagerComponent {
function set focusEnabled(_arg1:Boolean):void;
function drawFocus(_arg1:Boolean):void;
function setFocus():void;
function get focusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function get mouseFocusEnabled():Boolean;
}
}//package mx.managers
Section 37
//IFocusManagerContainer (mx.managers.IFocusManagerContainer)
package mx.managers {
import flash.display.*;
import flash.events.*;
public interface IFocusManagerContainer extends IEventDispatcher {
function set focusManager(_arg1:IFocusManager):void;
function get focusManager():IFocusManager;
function get systemManager():ISystemManager;
function contains(_arg1:DisplayObject):Boolean;
}
}//package mx.managers
Section 38
//ISystemManager (mx.managers.ISystemManager)
package mx.managers {
import flash.display.*;
import flash.events.*;
import mx.core.*;
import flash.geom.*;
import flash.text.*;
public interface ISystemManager extends IEventDispatcher, IChildList, IFlexModuleFactory {
function get toolTipChildren():IChildList;
function get numModalWindows():int;
function isTopLevel():Boolean;
function isFontFaceEmbedded(_arg1:TextFormat):Boolean;
function removeFocusManager(_arg1:IFocusManagerContainer):void;
function get document():Object;
function get topLevelSystemManager():ISystemManager;
function get focusPane():Sprite;
function get loaderInfo():LoaderInfo;
function set focusPane(_arg1:Sprite):void;
function get rawChildren():IChildList;
function get popUpChildren():IChildList;
function get screen():Rectangle;
function deactivate(_arg1:IFocusManagerContainer):void;
function getDefinitionByName(_arg1:String):Object;
function activate(_arg1:IFocusManagerContainer):void;
function get cursorChildren():IChildList;
function set document(_arg1:Object):void;
function get embeddedFontList():Object;
function addFocusManager(_arg1:IFocusManagerContainer):void;
function get stage():Stage;
function set numModalWindows(_arg1:int):void;
}
}//package mx.managers
Section 39
//Locale (mx.resources.Locale)
package mx.resources {
import mx.managers.*;
import mx.core.*;
public class Locale {
private var _language:String;
private var _variant:String;
private var _country:String;
private var localeStr:String;
mx_internal static const VERSION:String = "2.0.1.0";
private static var currentLocale:Locale;
public function Locale(_arg1:String){
var _local2:Array;
super();
this.localeStr = _arg1;
_local2 = _arg1.split("_");
if (_local2.length > 0){
_language = _local2[0];
};
if (_local2.length > 1){
_country = _local2[1];
};
if (_local2.length > 2){
_variant = _local2[2];
};
}
public function get variant():String{
return (_variant);
}
public function get country():String{
return (_country);
}
public function get language():String{
return (_language);
}
public function toString():String{
return (localeStr);
}
public static function getCurrent(_arg1:ISystemManager):Locale{
var _local2:Class;
if (!currentLocale){
_local2 = Class(_arg1.getDefinitionByName("mx.generated.GeneratedLocale"));
if (_local2){
currentLocale = new (_local2);
};
};
return (currentLocale);
}
}
}//package mx.resources
Section 40
//ResourceBundle (mx.resources.ResourceBundle)
package mx.resources {
import flash.system.*;
import mx.core.*;
import mx.utils.*;
public class ResourceBundle {
private var content:Object;
private var bundleName:String;
mx_internal static const VERSION:String = "2.0.1.0";
protected function getContent():Object{
return (null);
}
public function getStringArray(_arg1:String):Array{
var _local2:Array;
var _local3:int;
var _local4:int;
_local2 = getObject(_arg1).split(",");
_local3 = _local2.length;
_local4 = 0;
while (_local4 < _local3) {
_local2[_local4] = StringUtil.trim(_local2[_local4]);
_local4++;
};
return (_local2);
}
public function getString(_arg1:String):String{
return (String(getObject(_arg1)));
}
private function initialize(_arg1:String):void{
bundleName = _arg1;
content = getContent();
if (!content){
throw (new Error(("No content found in resource bundle " + bundleName)));
};
}
public function getObject(_arg1:String):Object{
var _local2:Object;
_local2 = content[_arg1];
if (!_local2){
throw (new Error(((("Key " + _arg1) + " was not found in resource bundle ") + bundleName)));
};
return (_local2);
}
public function getBoolean(_arg1:String, _arg2:Boolean=true):Boolean{
var _local3:String;
_local3 = getObject(_arg1).toLowerCase();
if (_local3 == "false"){
return (false);
};
if (_local3 == "true"){
return (true);
};
return (_arg2);
}
public function getNumber(_arg1:String):Number{
return (Number(getObject(_arg1)));
}
private static function getDefinitionByName(_arg1:String, _arg2:ApplicationDomain):Object{
var _local3:Object;
if (_arg2.hasDefinition(_arg1)){
_local3 = _arg2.getDefinition(_arg1);
};
return (_local3);
}
public static function getResourceBundle(_arg1:String, _arg2:ApplicationDomain=null):ResourceBundle{
var _local3:Class;
var _local4:Object;
var _local5:ResourceBundle;
if (_arg2 == null){
_arg2 = ApplicationDomain.currentDomain;
};
_local3 = Class(getDefinitionByName((_arg1 + "_properties"), _arg2));
if (!_local3){
_local3 = Class(getDefinitionByName(String(_arg1), _arg2));
};
if (_local3){
_local4 = new (_local3);
if ((_local4 is ResourceBundle)){
_local5 = ResourceBundle(_local4);
_local5.initialize(String(_arg1));
return (_local5);
};
};
throw (new Error(("Could not find resource bundle " + _arg1)));
}
}
}//package mx.resources
Section 41
//IResponder (mx.rpc.IResponder)
package mx.rpc {
public interface IResponder {
function fault(_arg1:Object):void;
function result(_arg1:Object):void;
}
}//package mx.rpc
Section 42
//ArrayUtil (mx.utils.ArrayUtil)
package mx.utils {
import mx.core.*;
public class ArrayUtil {
mx_internal static const VERSION:String = "2.0.1.0";
public static function getItemIndex(_arg1:Object, _arg2:Array):int{
var _local3:int;
var _local4:int;
_local3 = _arg2.length;
_local4 = 0;
while (_local4 < _local3) {
if (_arg2[_local4] === _arg1){
return (_local4);
};
_local4++;
};
return (-1);
}
public static function toArray(_arg1:Object):Array{
if (!_arg1){
return ([]);
};
if ((_arg1 is Array)){
return ((_arg1 as Array));
};
return ([_arg1]);
}
}
}//package mx.utils
Section 43
//DescribeTypeCache (mx.utils.DescribeTypeCache)
package mx.utils {
import flash.utils.*;
import mx.core.*;
import mx.binding.*;
public class DescribeTypeCache {
mx_internal static const VERSION:String = "2.0.1.0";
private static var cacheHandlers:Object = {};
private static var typeCache:Object = {};
public static function describeType(_arg1):DescribeTypeCacheRecord{
var _local2:String;
var _local3:XML;
var _local4:DescribeTypeCacheRecord;
if ((_arg1 is String)){
_local2 = _arg1;
} else {
_local2 = getQualifiedClassName(_arg1);
};
if ((_local2 in typeCache)){
return (typeCache[_local2]);
};
if ((_arg1 is String)){
_arg1 = getDefinitionByName(_arg1);
};
_local3 = describeType(_arg1);
_local4 = new DescribeTypeCacheRecord();
_local4.typeDescription = _local3;
_local4.typeName = _local2;
typeCache[_local2] = _local4;
return (_local4);
}
public static function registerCacheHandler(_arg1:String, _arg2:Function):void{
cacheHandlers[_arg1] = _arg2;
}
static function extractValue(_arg1:String, _arg2:DescribeTypeCacheRecord){
if ((_arg1 in cacheHandlers)){
return (cacheHandlers[_arg1](_arg2));
};
return (undefined);
}
private static function bindabilityInfoHandler(_arg1:DescribeTypeCacheRecord){
return (new BindabilityInfo(_arg1.typeDescription));
}
registerCacheHandler("bindabilityInfo", bindabilityInfoHandler);
}
}//package mx.utils
Section 44
//DescribeTypeCacheRecord (mx.utils.DescribeTypeCacheRecord)
package mx.utils {
import flash.utils.*;
public dynamic class DescribeTypeCacheRecord extends Proxy {
private var cache:Object;
public var typeDescription:XML;
public var typeName:String;
public function DescribeTypeCacheRecord(){
cache = {};
super();
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
var _local2:*;
_local2 = cache[_arg1];
if (_local2 === undefined){
_local2 = DescribeTypeCache.extractValue(_arg1, this);
cache[_arg1] = _local2;
};
return (_local2);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
var _local2:*;
if ((_arg1 in cache)){
return (true);
};
_local2 = DescribeTypeCache.extractValue(_arg1, this);
if (_local2 === undefined){
return (false);
};
cache[_arg1] = _local2;
return (true);
}
}
}//package mx.utils
Section 45
//IXMLNotifiable (mx.utils.IXMLNotifiable)
package mx.utils {
public interface IXMLNotifiable {
function xmlNotification(_arg1:Object, _arg2:String, _arg3:Object, _arg4:Object, _arg5:Object):void;
}
}//package mx.utils
Section 46
//object_proxy (mx.utils.object_proxy)
package mx.utils {
public namespace object_proxy = "http://www.adobe.com/2006/actionscript/flash/objectproxy";
}//package mx.utils
Section 47
//ObjectProxy (mx.utils.ObjectProxy)
package mx.utils {
import flash.events.*;
import flash.utils.*;
import mx.core.*;
import mx.events.*;
public dynamic class ObjectProxy extends Proxy implements IExternalizable, IPropertyChangeNotifier {
protected var notifiers:Object;
protected var propertyList:Array;
private var _proxyLevel:int;
protected var dispatcher:EventDispatcher;
protected var proxyClass:Class;
private var _item:Object;
private var _id:String;
public function ObjectProxy(_arg1:Object=null, _arg2:String=null, _arg3:int=-1){
proxyClass = ObjectProxy;
super();
if (!_arg1){
_arg1 = {};
};
_item = _arg1;
_proxyLevel = _arg3;
notifiers = {};
dispatcher = new EventDispatcher(this);
if (_arg2){
_id = _arg2;
} else {
_id = UIDUtil.createUID();
};
}
public function dispatchEvent(_arg1:Event):Boolean{
return (dispatcher.dispatchEvent(_arg1));
}
public function willTrigger(_arg1:String):Boolean{
return (dispatcher.willTrigger(_arg1));
}
public function readExternal(_arg1:IDataInput):void{
var _local2:Object;
_local2 = _arg1.readObject();
_item = _local2;
}
public function writeExternal(_arg1:IDataOutput):void{
_arg1.writeObject(_item);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
var _local2:Object;
_local2 = null;
if (notifiers[_arg1.toString()]){
return (notifiers[_arg1]);
};
_local2 = _item[_arg1];
if (_local2){
if ((((_proxyLevel == 0)) || (ObjectUtil.isSimple(_local2)))){
return (_local2);
};
_local2 = getComplexProperty(_arg1, _local2);
};
return (_local2);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
return ((_arg1 in _item));
}
public function get uid():String{
return (_id);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
if (_arg1 == 0){
setupPropertyList();
};
if (_arg1 < propertyList.length){
return ((_arg1 + 1));
};
return (0);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:*;
var _local4:IPropertyChangeNotifier;
var _local5:PropertyChangeEvent;
_local3 = _item[_arg1];
if (_local3 !== _arg2){
_item[_arg1] = _arg2;
_local4 = IPropertyChangeNotifier(notifiers[_arg1]);
if (_local4){
_local4.removeEventListener(PropertyChangeEvent.PROPERTY_CHANGE, propertyChangeHandler);
delete notifiers[_arg1];
};
if (dispatcher.hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE)){
if ((_arg1 is QName)){
_arg1 = QName(_arg1).localName;
};
_local5 = PropertyChangeEvent.createUpdateEvent(this, _arg1.toString(), _local3, _arg2);
dispatcher.dispatchEvent(_local5);
};
};
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
dispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return (propertyList[(_arg1 - 1)]);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{
var _local2:IPropertyChangeNotifier;
var _local3:Object;
var _local4:Boolean;
var _local5:PropertyChangeEvent;
_local2 = IPropertyChangeNotifier(notifiers[_arg1]);
if (_local2){
_local2.removeEventListener(PropertyChangeEvent.PROPERTY_CHANGE, propertyChangeHandler);
delete notifiers[_arg1];
};
_local3 = _item[_arg1];
_local4 = delete _item[_arg1];
if (dispatcher.hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE)){
_local5 = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
_local5.kind = PropertyChangeEventKind.DELETE;
_local5.property = _arg1;
_local5.oldValue = _local3;
_local5.source = this;
dispatcher.dispatchEvent(_local5);
};
return (_local4);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function callProperty(_arg1, ... _args){
return (_item[_arg1].apply(_item, _args));
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
dispatcher.removeEventListener(_arg1, _arg2, _arg3);
}
protected function setupPropertyList():void{
var _local1:String;
if (getQualifiedClassName(_item) == "Object"){
propertyList = [];
for (_local1 in _item) {
propertyList.push(_local1);
};
} else {
propertyList = ObjectUtil.getClassInfo(_item, null, {includeReadOnly:true, uris:["*"]}).properties;
};
}
object_proxy function getComplexProperty(_arg1, _arg2){
if ((_arg2 is IPropertyChangeNotifier)){
_arg2.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, propertyChangeHandler);
notifiers[_arg1] = _arg2;
return (_arg2);
};
if (getQualifiedClassName(_arg2) == "Object"){
_arg2 = new proxyClass(_item[_arg1], null, ((_proxyLevel > 0)) ? (_proxyLevel - 1) : _proxyLevel);
_arg2.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, propertyChangeHandler);
notifiers[_arg1] = _arg2;
return (_arg2);
};
return (_arg2);
}
public function set uid(_arg1:String):void{
_id = _arg1;
}
public function hasEventListener(_arg1:String):Boolean{
return (dispatcher.hasEventListener(_arg1));
}
public function propertyChangeHandler(_arg1:PropertyChangeEvent):void{
dispatcher.dispatchEvent(_arg1);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextValue(_arg1:int){
return (_item[propertyList[(_arg1 - 1)]]);
}
object_proxy function get object():Object{
return (_item);
}
}
}//package mx.utils
Section 48
//ObjectUtil (mx.utils.ObjectUtil)
package mx.utils {
import flash.utils.*;
import mx.core.*;
import mx.collections.*;
import flash.xml.*;
public class ObjectUtil {
mx_internal static const VERSION:String = "2.0.1.0";
private static var refCount:int = 0;
private static var CLASS_INFO_CACHE:Object = {};
private static function recordMetadata(_arg1:XMLList):Object{
var result:Object;
var prop:XML;
var propName:String;
var metadataList:XMLList;
var metadata:Object;
var md:XML;
var mdName:String;
var argsList:XMLList;
var value:Object;
var arg:XML;
var existing:Object;
var argKey:String;
var argValue:String;
var existingArray:Array;
var properties = _arg1;
result = null;
try {
for each (prop in properties) {
propName = prop.attribute("name").toString();
metadataList = prop.metadata;
if (metadataList.length() > 0){
if (result == null){
result = {};
};
metadata = {};
result[propName] = metadata;
for each (md in metadataList) {
mdName = md.attribute("name").toString();
argsList = md.arg;
value = {};
for each (arg in argsList) {
argKey = arg.attribute("key").toString();
if (argKey != null){
argValue = arg.attribute("value").toString();
value[argKey] = argValue;
};
};
existing = metadata[mdName];
if (existing != null){
if ((existing is Array)){
existingArray = (existing as Array);
} else {
existingArray = [];
};
existingArray.push(value);
existing = existingArray;
} else {
existing = value;
};
metadata[mdName] = existing;
};
};
};
} catch(e:Error) {
};
return (result);
}
public static function hasMetadata(_arg1:Object, _arg2:String, _arg3:String, _arg4:Array=null, _arg5:Object=null):Boolean{
var _local6:Object;
var _local7:Object;
_local6 = getClassInfo(_arg1, _arg4, _arg5);
_local7 = _local6["metadata"];
return (internalHasMetadata(_local7, _arg2, _arg3));
}
private static function byteArrayCompare(_arg1:ByteArray, _arg2:ByteArray):int{
var _local3:int;
var _local4:int;
_local3 = 0;
if (_arg1.length != _arg2.length){
if (_arg1.length < _arg2.length){
_local3 = -1;
} else {
_local3 = 1;
};
} else {
_arg1.position = 0;
_arg2.position = 0;
_local4 = 0;
while (_local4 < _arg1.length) {
_local3 = numericCompare(_arg1.readByte(), _arg2.readByte());
if (_local3 != 0){
_local4 = _arg1.length;
};
_local4++;
};
};
return (_local3);
}
private static function arrayCompare(_arg1:Array, _arg2:Array, _arg3:int, _arg4:int, _arg5:Dictionary):int{
var _local6:int;
var _local7:int;
_local6 = 0;
if (_arg1.length != _arg2.length){
if (_arg1.length < _arg2.length){
_local6 = -1;
} else {
_local6 = 1;
};
} else {
_local7 = 0;
while (_local7 < _arg1.length) {
_local6 = internalCompare(_arg1[_local7], _arg2[_local7], _arg3, _arg4, _arg5);
if (_local6 != 0){
_local7 = _arg1.length;
};
_local7++;
};
};
return (_local6);
}
public static function compare(_arg1:Object, _arg2:Object, _arg3:int=-1):int{
return (internalCompare(_arg1, _arg2, 0, _arg3, new Dictionary(true)));
}
private static function listCompare(_arg1:IList, _arg2:IList, _arg3:int, _arg4:int, _arg5:Dictionary):int{
var _local6:int;
var _local7:int;
_local6 = 0;
if (_arg1.length != _arg2.length){
if (_arg1.length < _arg2.length){
_local6 = -1;
} else {
_local6 = 1;
};
} else {
_local7 = 0;
while (_local7 < _arg1.length) {
_local6 = internalCompare(_arg1.getItemAt(_local7), _arg2.getItemAt(_local7), (_arg3 + 1), _arg4, _arg5);
if (_local6 != 0){
_local7 = _arg1.length;
};
_local7++;
};
};
return (_local6);
}
private static function internalCompare(_arg1:Object, _arg2:Object, _arg3:int, _arg4:int, _arg5:Dictionary):int{
var _local6:String;
var _local7:String;
var _local8:int;
var _local9:int;
var _local10:Boolean;
var _local11:Boolean;
var _local12:Array;
var _local13:Array;
var _local14:QName;
var _local15:Object;
var _local16:Object;
var _local17:int;
if ((((_arg1 == null)) && ((_arg2 == null)))){
return (0);
};
if (_arg1 == null){
return (1);
};
if (_arg2 == null){
return (-1);
};
if ((_arg1 is ObjectProxy)){
_arg1 = ObjectProxy(_arg1).object_proxy::object;
};
if ((_arg2 is ObjectProxy)){
_arg2 = ObjectProxy(_arg2).object_proxy::object;
};
_local6 = typeof(_arg1);
_local7 = typeof(_arg2);
_local8 = 0;
if (_local6 == _local7){
switch (_local6){
case "boolean":
_local8 = numericCompare(Number(_arg1), Number(_arg2));
break;
case "number":
_local8 = numericCompare((_arg1 as Number), (_arg2 as Number));
break;
case "string":
_local8 = stringCompare((_arg1 as String), (_arg2 as String));
break;
case "object":
_local9 = ((_arg4 > 0)) ? (_arg4 - 1) : _arg4;
_local10 = _arg5[_arg1];
_local11 = _arg5[_arg2];
if (((_local10) && (!(_local11)))){
return (1);
};
if (((_local11) && (!(_local10)))){
return (-1);
};
if (((_local11) && (_local10))){
return (0);
};
_arg5[_arg1] = true;
_arg5[_arg2] = true;
if (((!((_arg4 == -1))) && ((_arg3 > _arg4)))){
_local8 = stringCompare(_arg1.toString(), _arg2.toString());
} else {
if ((((_arg1 is Array)) && ((_arg2 is Array)))){
_local8 = arrayCompare((_arg1 as Array), (_arg2 as Array), _arg3, _arg4, _arg5);
} else {
if ((((_arg1 is Date)) && ((_arg2 is Date)))){
_local8 = dateCompare((_arg1 as Date), (_arg2 as Date));
} else {
if ((((_arg1 is IList)) && ((_arg2 is IList)))){
_local8 = listCompare((_arg1 as IList), (_arg2 as IList), _arg3, _arg4, _arg5);
} else {
if ((((_arg1 is ByteArray)) && ((_arg2 is ByteArray)))){
_local8 = byteArrayCompare((_arg1 as ByteArray), (_arg2 as ByteArray));
} else {
if (getQualifiedClassName(_arg1) == getQualifiedClassName(_arg2)){
_local12 = getClassInfo(_arg1).properties;
if (getQualifiedClassName(_arg1) == "Object"){
_local13 = getClassInfo(_arg2).properties;
_local8 = arrayCompare(_local12, _local13, _arg3, _local9, _arg5);
};
if (_local8 != 0){
return (_local8);
};
_local17 = 0;
while (_local17 < _local12.length) {
_local14 = _local12[_local17];
_local15 = _arg1[_local14];
_local16 = _arg2[_local14];
_local8 = internalCompare(_local15, _local16, (_arg3 + 1), _local9, _arg5);
if (_local8 != 0){
_local17 = _local12.length;
};
_local17++;
};
} else {
return (1);
};
};
};
};
};
};
break;
};
} else {
return (stringCompare(_local6, _local7));
};
return (_local8);
}
private static function internalToString(_arg1:Object, _arg2:int=0, _arg3:Dictionary=null, _arg4:Array=null, _arg5:Array=null):String{
var _local6:String;
var _local7:String;
var _local8:Object;
var _local9:Array;
var _local10:Object;
var _local11:Boolean;
var _local12:*;
var _local13:int;
_local7 = ((_arg1 == null)) ? "null" : typeof(_arg1);
switch (_local7){
case "boolean":
case "number":
return (_arg1.toString());
case "string":
return ((("\"" + _arg1.toString()) + "\""));
case "object":
if ((_arg1 is Date)){
return (_arg1.toString());
};
if ((_arg1 is XMLNode)){
return (_arg1.toString());
};
if ((_arg1 is Class)){
return ((("(" + getQualifiedClassName(_arg1)) + ")"));
};
_local8 = getClassInfo(_arg1, _arg5, {includeReadOnly:true, uris:_arg4});
_local9 = _local8.properties;
_local6 = (("(" + _local8.name) + ")");
if (_arg3 == null){
_arg3 = new Dictionary(true);
};
_local10 = _arg3[_arg1];
if (_local10 != null){
_local6 = (_local6 + ("#" + int(_local10)));
return (_local6);
};
if (_arg1 != null){
_local6 = (_local6 + ("#" + refCount.toString()));
_arg3[_arg1] = refCount;
refCount++;
};
_local11 = (_arg1 is Array);
_arg2 = (_arg2 + 2);
_local13 = 0;
while (_local13 < _local9.length) {
_local6 = newline(_local6, _arg2);
_local12 = _local9[_local13];
if (_local11){
_local6 = (_local6 + "[");
};
_local6 = (_local6 + _local12.toString());
if (_local11){
_local6 = (_local6 + "] ");
} else {
_local6 = (_local6 + " = ");
};
_local6 = (_local6 + internalToString(_arg1[_local12], _arg2, _arg3, _arg4, _arg5));
_local13++;
};
_arg2 = (_arg2 - 2);
return (_local6);
case "xml":
return (_arg1.toString());
default:
return ((("(" + _local7) + ")"));
};
}
public static function toString(_arg1:Object, _arg2:Array=null, _arg3:Array=null):String{
refCount = 0;
return (internalToString(_arg1, 0, null, _arg2, _arg3));
}
public static function getClassInfo(_arg1:Object, _arg2:Array=null, _arg3:Object=null):Object{
var n:int;
var i:int;
var result:Object;
var propertyNames:Array;
var cacheKey:String;
var className:String;
var classAlias:String;
var properties:XMLList;
var prop:XML;
var dynamic:Boolean;
var metadataInfo:Object;
var excludeObject:Object;
var isArray:Boolean;
var classInfo:XML;
var numericIndex:Boolean;
var p:String;
var pi:Number;
var uris:Array;
var uri:String;
var qName:QName;
var j:int;
var obj = _arg1;
var excludes = _arg2;
var options = _arg3;
if ((obj is ObjectProxy)){
obj = ObjectProxy(obj).object_proxy::object;
};
if (options == null){
options = {includeReadOnly:true, uris:null, includeTransient:true};
};
propertyNames = [];
dynamic = false;
if (typeof(obj) == "xml"){
className = "XML";
properties = obj.text();
if (properties.length()){
propertyNames.push("*");
};
properties = obj.attributes();
} else {
classInfo = DescribeTypeCache.describeType(obj).typeDescription;
className = classInfo.@name.toString();
classAlias = classInfo.@alias.toString();
dynamic = (classInfo.@isDynamic.toString() == "true");
if (options.includeReadOnly){
properties = (classInfo..accessor.(@access != "writeonly") + classInfo..variable);
} else {
properties = (classInfo..accessor.(@access == "readwrite") + classInfo..variable);
};
numericIndex = false;
};
if (!dynamic){
cacheKey = getCacheKey(obj, excludes, options);
result = CLASS_INFO_CACHE[cacheKey];
if (result != null){
return (result);
};
};
result = {};
result["name"] = className;
result["alias"] = classAlias;
result["properties"] = propertyNames;
result["dynamic"] = dynamic;
var _local5 = recordMetadata(properties);
metadataInfo = _local5;
result["metadata"] = _local5;
excludeObject = {};
if (excludes){
n = excludes.length;
i = 0;
while (i < n) {
excludeObject[excludes[i]] = 1;
i = (i + 1);
};
};
isArray = (className == "Array");
if (dynamic){
for (p in obj) {
if (excludeObject[p] != 1){
if (isArray){
pi = parseInt(p);
if (isNaN(pi)){
propertyNames.push(new QName("", p));
} else {
propertyNames.push(pi);
};
} else {
propertyNames.push(new QName("", p));
};
};
};
numericIndex = ((isArray) && (!(isNaN(Number(p)))));
};
if ((((className == "Object")) || (isArray))){
} else {
if (className == "XML"){
n = properties.length();
i = 0;
while (i < n) {
p = properties[i].name();
if (excludeObject[p] != 1){
propertyNames.push(new QName("", ("@" + p)));
};
i = (i + 1);
};
} else {
n = properties.length();
uris = options.uris;
i = 0;
while (i < n) {
prop = properties[i];
p = prop.@name.toString();
uri = prop.@uri.toString();
if (excludeObject[p] == 1){
} else {
if (((!(options.includeTransient)) && (internalHasMetadata(metadataInfo, p, "Transient")))){
} else {
if (uris != null){
if ((((uris.length == 1)) && ((uris[0] == "*")))){
qName = new QName(uri, p);
try {
obj[qName];
propertyNames.push();
} catch(e:Error) {
};
} else {
j = 0;
while (j < uris.length) {
uri = uris[j];
if (prop.@uri.toString() == uri){
qName = new QName(uri, p);
try {
obj[qName];
propertyNames.push(qName);
} catch(e:Error) {
};
};
j = (j + 1);
};
};
} else {
if (uri.length == 0){
qName = new QName(uri, p);
try {
obj[qName];
propertyNames.push(qName);
} catch(e:Error) {
};
};
};
};
};
i = (i + 1);
};
};
};
propertyNames.sort((Array.CASEINSENSITIVE | (numericIndex) ? Array.NUMERIC : 0));
i = 0;
while (i < (propertyNames.length - 1)) {
if (propertyNames[i].toString() == propertyNames[(i + 1)].toString()){
propertyNames.splice(i, 1);
i = (i - 1);
};
i = (i + 1);
};
if (!dynamic){
cacheKey = getCacheKey(obj, excludes, options);
CLASS_INFO_CACHE[cacheKey] = result;
};
return (result);
}
private static function internalHasMetadata(_arg1:Object, _arg2:String, _arg3:String):Boolean{
var _local4:Object;
if (_arg1 != null){
_local4 = _arg1[_arg2];
if (_local4 != null){
if (_local4[_arg3] != null){
return (true);
};
};
};
return (false);
}
private static function newline(_arg1:String, _arg2:int=0):String{
var _local3:String;
var _local4:int;
_local3 = _arg1;
_local3 = (_local3 + "\n");
_local4 = 0;
while (_local4 < _arg2) {
_local3 = (_local3 + " ");
_local4++;
};
return (_local3);
}
public static function copy(_arg1:Object):Object{
var _local2:ByteArray;
var _local3:Object;
_local2 = new ByteArray();
_local2.writeObject(_arg1);
_local2.position = 0;
_local3 = _local2.readObject();
return (_local3);
}
public static function dateCompare(_arg1:Date, _arg2:Date):int{
var _local3:Number;
var _local4:Number;
if ((((_arg1 == null)) && ((_arg2 == null)))){
return (0);
};
if (_arg1 == null){
return (1);
};
if (_arg2 == null){
return (-1);
};
_local3 = _arg1.getTime();
_local4 = _arg2.getTime();
if (_local3 < _local4){
return (-1);
};
if (_local3 > _local4){
return (1);
};
return (0);
}
private static function getCacheKey(_arg1:Object, _arg2:Array=null, _arg3:Object=null):String{
var _local4:String;
var _local5:uint;
var _local6:String;
var _local7:String;
var _local8:String;
_local4 = getQualifiedClassName(_arg1);
if (_arg2 != null){
_local5 = 0;
while (_local5 < _arg2.length) {
_local6 = (_arg2[_local5] as String);
if (_local6 != null){
_local4 = (_local4 + _local6);
};
_local5++;
};
};
if (_arg3 != null){
for (_local7 in _arg3) {
_local4 = (_local4 + _local7);
_local8 = (_arg3[_local7] as String);
if (_local8 != null){
_local4 = (_local4 + _local8);
};
};
};
return (_local4);
}
public static function stringCompare(_arg1:String, _arg2:String, _arg3:Boolean=false):int{
var _local4:int;
if ((((_arg1 == null)) && ((_arg2 == null)))){
return (0);
};
if (_arg1 == null){
return (1);
};
if (_arg2 == null){
return (-1);
};
if (_arg3){
_arg1 = _arg1.toLocaleLowerCase();
_arg2 = _arg2.toLocaleLowerCase();
};
_local4 = _arg1.localeCompare(_arg2);
if (_local4 < -1){
_local4 = -1;
} else {
if (_local4 > 1){
_local4 = 1;
};
};
return (_local4);
}
public static function isSimple(_arg1:Object):Boolean{
var _local2:String;
_local2 = typeof(_arg1);
switch (_local2){
case "number":
case "string":
case "boolean":
return (true);
case "object":
return ((((_arg1 is Date)) || ((_arg1 is Array))));
};
return (false);
}
public static function numericCompare(_arg1:Number, _arg2:Number):int{
if (((isNaN(_arg1)) && (isNaN(_arg2)))){
return (0);
};
if (isNaN(_arg1)){
return (1);
};
if (isNaN(_arg2)){
return (-1);
};
if (_arg1 < _arg2){
return (-1);
};
if (_arg1 > _arg2){
return (1);
};
return (0);
}
}
}//package mx.utils
Section 49
//StringUtil (mx.utils.StringUtil)
package mx.utils {
import mx.core.*;
public class StringUtil {
mx_internal static const VERSION:String = "2.0.1.0";
public static function trim(_arg1:String):String{
var _local2:int;
var _local3:int;
_local2 = 0;
while (isWhitespace(_arg1.charAt(_local2))) {
_local2++;
};
_local3 = (_arg1.length - 1);
while (isWhitespace(_arg1.charAt(_local3))) {
_local3--;
};
if (_local3 >= _local2){
return (_arg1.slice(_local2, (_local3 + 1)));
};
return ("");
}
public static function isWhitespace(_arg1:String):Boolean{
switch (_arg1){
case " ":
case "\t":
case "\r":
case "\n":
case "\f":
return (true);
default:
return (false);
};
}
public static function substitute(_arg1:String, ... _args):String{
var _local3:uint;
var _local4:Array;
var _local5:int;
_local3 = _args.length;
if ((((_local3 == 1)) && ((_args[0] is Array)))){
_local4 = (_args[0] as Array);
_local3 = _local4.length;
} else {
_local4 = _args;
};
_local5 = 0;
while (_local5 < _local3) {
_arg1 = _arg1.replace(new RegExp((("\\{" + _local5) + "\\}"), "g"), _local4[_local5]);
_local5++;
};
return (_arg1);
}
public static function trimArrayElements(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:int;
var _local5:int;
if (((!((_arg1 == ""))) && (!((_arg1 == null))))){
_local3 = _arg1.split(_arg2);
_local4 = _local3.length;
_local5 = 0;
while (_local5 < _local4) {
_local3[_local5] = StringUtil.trim(_local3[_local5]);
_local5++;
};
if (_local4 > 0){
_arg1 = _local3.join(_arg2);
};
};
return (_arg1);
}
}
}//package mx.utils
Section 50
//UIDUtil (mx.utils.UIDUtil)
package mx.utils {
import flash.utils.*;
import mx.core.*;
public class UIDUtil {
mx_internal static const VERSION:String = "2.0.1.0";
private static const ALPHA_CHARS:String = "0123456789ABCDEF";
private static var uidDictionary:Dictionary = new Dictionary(true);
public static function createUID():String{
var _local1:String;
var _local2:int;
var _local3:int;
var _local4:Number;
_local1 = "";
_local2 = 0;
while (_local2 < 8) {
_local1 = (_local1 + ALPHA_CHARS.charAt(Math.round((Math.random() * 15))));
_local2++;
};
_local2 = 0;
while (_local2 < 3) {
_local1 = (_local1 + "-");
_local3 = 0;
while (_local3 < 4) {
_local1 = (_local1 + ALPHA_CHARS.charAt(Math.round((Math.random() * 15))));
_local3++;
};
_local2++;
};
_local1 = (_local1 + "-");
_local4 = new Date().getTime();
_local1 = (_local1 + ("0000000" + _local4.toString(16).toUpperCase()).substr(-8));
_local2 = 0;
while (_local2 < 4) {
_local1 = (_local1 + ALPHA_CHARS.charAt(Math.round((Math.random() * 15))));
_local2++;
};
return (_local1);
}
public static function getUID(_arg1:Object):String{
var result:String;
var xitem:XML;
var nodeKind:String;
var notificationFunction:Function;
var item = _arg1;
result = null;
if (item == null){
return (result);
};
if ((item is IUID)){
result = IUID(item).uid;
if ((((result == null)) || ((result.length == 0)))){
result = createUID();
IUID(item).uid = result;
};
} else {
if ((((item is IPropertyChangeNotifier)) && (!((item is IUIComponent))))){
result = IPropertyChangeNotifier(item).uid;
if ((((result == null)) || ((result.length == 0)))){
result = createUID();
IPropertyChangeNotifier(item).uid = result;
};
} else {
if ((item is String)){
return ((item as String));
};
try {
if ((((item is XMLList)) && ((item.length == 1)))){
item = item[0];
};
if ((item is XML)){
xitem = XML(item);
nodeKind = xitem.nodeKind();
if ((((nodeKind == "text")) || ((nodeKind == "attribute")))){
return (xitem.toString());
};
notificationFunction = xitem.notification();
if (!(notificationFunction is Function)){
notificationFunction = XMLNotifier.initializeXMLForNotification(xitem);
};
if (notificationFunction["uid"] == undefined){
result = (notificationFunction["uid"] = createUID());
};
result = notificationFunction["uid"];
} else {
if (("mx_internal_uid" in item)){
return (item.mx_internal_uid);
};
if (("uid" in item)){
return (item.uid);
};
result = uidDictionary[item];
if (!result){
result = createUID();
try {
item.mx_internal_uid = result;
} catch(e:Error) {
uidDictionary[item] = result;
};
};
};
} catch(e:Error) {
result = item.toString();
};
};
};
return (result);
}
}
}//package mx.utils
Section 51
//XMLNotifier (mx.utils.XMLNotifier)
package mx.utils {
import flash.utils.*;
import mx.core.*;
public class XMLNotifier {
mx_internal static const VERSION:String = "2.0.1.0";
private static var instance:XMLNotifier;
public function XMLNotifier(_arg1:XMLNotifierSingleton){
}
public function watchXML(_arg1:Object, _arg2:IXMLNotifiable):void{
var _local3:XML;
var _local4:Object;
var _local5:Dictionary;
_local3 = XML(_arg1);
_local4 = _local3.notification();
if (!(_local4 is Function)){
_local4 = initializeXMLForNotification(_local3);
};
if (_local4["watched"] == undefined){
_local5 = new Dictionary(true);
_local4["watched"] = _local5;
} else {
_local5 = _local4["watched"];
};
_local5[_arg2] = true;
}
public function unwatchXML(_arg1:Object, _arg2:IXMLNotifiable):void{
var _local3:XML;
var _local4:Object;
var _local5:Dictionary;
_local3 = XML(_arg1);
_local4 = _local3.notification();
if (!(_local4 is Function)){
_local4 = initializeXMLForNotification(_local3);
};
if (_local4["watched"] != undefined){
_local5 = _local4["watched"];
delete _local5[_arg2];
};
}
public static function getInstance():XMLNotifier{
if (!instance){
instance = new XMLNotifier(new XMLNotifierSingleton());
};
return (instance);
}
mx_internal static function initializeXMLForNotification(_arg1:XML):Function{
var notificationFunction:Function;
var node = _arg1;
notificationFunction = function (_arg1:Object, _arg2:String, _arg3:Object, _arg4:Object, _arg5:Object):void{
var _local7:Dictionary;
var _local8:Object;
_local7 = arguments.callee.watched;
if (_local7 != null){
for (_local8 in _local7) {
IXMLNotifiable(_local8).xmlNotification(_arg1, _arg2, _arg3, _arg4, _arg5);
};
};
};
node.setNotification(notificationFunction);
return (notificationFunction);
}
}
}//package mx.utils
class XMLNotifierSingleton {
private function XMLNotifierSingleton(){
}
}
Section 52
//AtemiS_Player_LITE (AtemiS_Player_LITE)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import mx.core.*;
import flash.geom.*;
import mx.collections.*;
import flash.media.*;
import mx.graphics.*;
public class AtemiS_Player_LITE extends Sprite {
private const DIFF:uint = 1;
private const DIV_MOD:uint = 64;
private const GRAPH_LG:uint = 400;
private const BITMAP_MAX:uint = 2880;
private const SMP_MOD:uint = 15;
private const SIG_MOD:uint = 1080;
private const BPM_MOD:uint = 125;
public const CHANNEL_CHOICE:Array;
private const CHL_PAN:Array;
public const SAMPLE_RATE_CHOICE:Array;
private const CHL_MOD:uint = 4;
private const BUFF_I:uint = 10;
private const TPD_MOD:uint = 6;
public const BIT_RATE_CHOICE:Array;
private const CHL_MAX:uint = 32;
public const MACHINE_RATE_CHOICE:Array;
public var currentSONG:uint;
public var multTPD:Number;
public var snd_channel:Array;
private var jump:Boolean;
public var playing:Boolean;
private var CH_sync:uint;
public var OVolume:Number;
public var title:String;
public var currentTIM:uint;
private var sn:SoundChannel;
public var Wav_Channel:uint;
public var timePOS:uint;
public var buffz:uint;
private var SWFsample:uint;
public var multBPM:Number;
public var Wav_Rate:Number;
private var swf_buffer:Object;
private var volume_info:Array;
public var nChannel:uint;
private var note_length2:uint;
private var SWFpos:uint;
private var note_length3:uint;
private var dJump:int;
private var swf_play:Array;
public var note_list:Array;
public var OOctave:int;
private var load:Loader;
public var length:uint;
public var currentPER:Array;
private var sstop:Boolean;
private var channel_play:Array;
public var Wav_Bit:uint;
public var mod:ByteArrayAsset;
public var channel:Array;
private var volume_buffer:Array;
public var OVolume2:Number;
private var channel_buffer:Array;
public var note_load:Loader;
public var song:Array;
private var NOTEpos:uint;
public var smpPos:uint;
private var songSWF:ByteArray;
public var currentTPD:uint;
private var posDivision:uint;
private var lstCur:int;
private var mVol:uint;
private var sn2:SoundChannel;
public var sLength:uint;
public var nDivision:uint;
private var noteSWF:ByteArray;
private var sJump:int;
public var nPattern:uint;
private var SwfBin:Class;
private var note_PER:uint;
private var volume_play:Array;
public var loop_info:loopC;
private var volumePlay:Boolean;
public var currentSWFpos:Array;
public var tpd:uint;
private var note_SMP:uint;
public var dpm:uint;
private var next_sm_stop:Boolean;
private var posSong:uint;
public var pattern:Array;
private var paletteFix:Object;
public var smpTimer:uint;
public var currentROW:uint;
public var sample:ArrayCollection;
public var currentBPM:uint;
public var Wav_Machine:uint;
private var nn:Boolean;
public var nSample:uint;
private var nBit:uint;
private var SWFnotLoad:Boolean;
public var note_ch:SoundChannel;
private var note_length:uint;
public var channel_mute:Array;
private var paletteFix2:Object;
public var playing2:Boolean;
public var bpm:uint;
public var INITchannel:ArrayCollection;
public var format:String;
private var SWFvolume:Array;
private var lstPeriod:Array;
public function AtemiS_Player_LITE(_arg1:Class){
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:uint;
var _local7:Array;
var _local8:uint;
var _local9:uint;
var _local10:ByteArray;
SwfBin = AtemiS_Player_LITE_SwfBin;
MACHINE_RATE_CHOICE = [{label:7159090.5}, {label:7093789.2}];
SAMPLE_RATE_CHOICE = [{label:44100}, {label:22050}, {label:11025}, {label:5512.5}];
BIT_RATE_CHOICE = [{label:16}, {label:8}];
CHANNEL_CHOICE = [{label:2}, {label:1}];
CHL_PAN = [64, 192, 192, 64];
super();
load = new Loader();
initSWF();
fixPalette();
timePOS = 0;
multBPM = 1;
multTPD = 1;
mod = new (_arg1);
length = mod.length;
volumePlay = false;
nn = false;
sstop = false;
buffz = BUFF_I;
CH_sync = 0;
OVolume = 1;
OOctave = 0;
SWFnotLoad = true;
lstCur = 0;
currentROW = 0;
currentSONG = 0;
playing = false;
posDivision = 0;
posSong = 0;
currentSWFpos = new Array();
Wav_Bit = BIT_RATE_CHOICE[0].label;
Wav_Rate = SAMPLE_RATE_CHOICE[0].label;
Wav_Channel = CHANNEL_CHOICE[0].label;
Wav_Machine = MACHINE_RATE_CHOICE[0].label;
bpm = BPM_MOD;
tpd = TPD_MOD;
dpm = ((24 * bpm) / tpd);
currentBPM = bpm;
currentTPD = tpd;
currentTIM = 0;
note_length = ((60 / dpm) * Wav_Rate);
nBit = (Math.pow(2, (Wav_Bit - 1)) - 1);
_local7 = readFormat(mod);
format = _local7[0];
nSample = _local7[1];
nDivision = _local7[2];
nChannel = _local7[3];
init_channel();
channel_mute = new Array(nChannel);
_local2 = 0;
while (_local2 < nChannel) {
channel_mute[_local2] = false;
_local2++;
};
title = readTitle(mod);
sample = new ArrayCollection(new Array(nSample));
_local2 = 0;
while (_local2 < nSample) {
sample.setItemAt(new sampleC(), _local2);
sample.getItemAt(_local2).num = _local2;
sample.getItemAt(_local2).label = mod.readUTFBytes(22);
if (sample[_local2].label == ""){
sample.getItemAt(_local2).label = " ";
};
sample.getItemAt(_local2).length = (mod.readUnsignedShort() * 2);
sample.getItemAt(_local2).finetune = mod.readByte();
sample.getItemAt(_local2).volume = mod.readUnsignedByte();
sample.getItemAt(_local2).repeatPosition = (mod.readUnsignedShort() * 2);
sample.getItemAt(_local2).repeatLength = (mod.readUnsignedShort() * 2);
_local2++;
};
sLength = mod.readUnsignedByte();
mod.position++;
nPattern = 0;
song = new Array(128);
_local2 = 0;
while (_local2 < 128) {
if (_local2 < sLength){
song[_local2] = {label:mod.readUnsignedByte()};
if (song[_local2].label > nPattern){
nPattern = song[_local2].label;
};
} else {
song[_local2] = {label:"- - -"};
mod.position++;
};
_local2++;
};
nPattern++;
pattern = new Array(nPattern);
if (format != ""){
mod.position = (mod.position + 4);
};
_local2 = 0;
while (_local2 < nPattern) {
pattern[_local2] = new Array(nChannel);
_local3 = 0;
while (_local3 < nChannel) {
pattern[_local2][_local3] = new Array(nDivision);
_local3++;
};
_local4 = 0;
while (_local4 < nDivision) {
_local3 = 0;
while (_local3 < nChannel) {
_local6 = mod.readUnsignedInt();
pattern[_local2][_local3][_local4] = {instrument:uint, period:uint, effect:uint, volume:uint};
pattern[_local2][_local3][_local4].volume = 0;
pattern[_local2][_local3][_local4].instrument = (((_local6 & 4026531840) >> 24) + ((_local6 & 0xF000) >> 12));
pattern[_local2][_local3][_local4].period = ((_local6 & 268369920) >> 16);
pattern[_local2][_local3][_local4].effect = (_local6 & 4095);
_local3++;
};
_local4++;
};
_local2++;
};
_local2 = 0;
while (_local2 < nSample) {
if (sample.getItemAt(_local2).length > 0){
_local10 = new ByteArray();
_local10.writeBytes(mod, mod.position, sample.getItemAt(_local2).length);
_local10 = sampleTo32Bit(_local10, _local2);
sample.getItemAt(_local2).data = _local10;
mod.position = (mod.position + sample.getItemAt(_local2).length);
};
_local2++;
};
SWFsample = ((0x0800 * buffz) - 1);
songSWF = initBuffer(SWFsample, nChannel);
noteSWF = initBuffer(SWFsample, 1);
SWFpos = 0;
}
public function stop():void{
if (playing){
addEventListener(Event.ENTER_FRAME, volume_down);
removeEventListener(Event.ENTER_FRAME, volume_up);
};
}
private function playBuffer2(_arg1:Event):void{
if (((SWFnotLoad) && (playing))){
playBuffer(_arg1);
};
}
private function defineSound(_arg1:uint, _arg2:uint):ByteArray{
var _local3:ByteArray;
_local3 = new ByteArray();
_local3.endian = "littleEndian";
_local3.writeShort(959);
_local3.writeUnsignedInt(((_arg1 * 4) + 7));
_local3.writeShort(_arg2);
switch ((44100 / Wav_Rate)){
case 1:
_local3.writeByte(63);
break;
case 2:
_local3.writeByte(47);
break;
case 4:
_local3.writeByte(31);
break;
case 8:
_local3.writeByte(15);
break;
default:
_local3.writeByte(63);
break;
};
_local3.writeUnsignedInt(_arg1);
return (_local3);
}
private function enterFrameHandler(_arg1:Event):void{
if (!sstop){
if (!nn){
nextDivision_1();
};
nextDivision_2();
if (!nn){
nextDivision_3();
};
if (SWFpos < SWFsample){
};
};
}
private function compile(_arg1:Object, _arg2:Number, _arg3:uint, _arg4:uint, _arg5:uint, _arg6:Number):ByteArray{
var _local7:ByteArray;
var _local8:ByteArray;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:ByteArray;
_local7 = new ByteArray();
_local7.length = (_arg3 * 4);
if (_arg1.repeatLength <= 2){
_local9 = Math.floor((_arg1.length * _arg2));
if (_arg4 < _local9){
channel_buffer[_arg5] = true;
_local8 = new ByteArray();
if ((_local9 - _arg4) < _arg3){
_local8.writeBytes(_arg1.data, (Math.floor((_arg4 / _arg2)) * 4));
_local8 = resample(_local8, _arg2, _arg6);
_local7.writeBytes(_local8);
} else {
_local8.writeBytes(_arg1.data, (Math.floor((_arg4 / _arg2)) * 4), (Math.ceil((_arg3 / _arg2)) * 4));
_local8 = resample(_local8, _arg2, _arg6);
_local7.writeBytes(_local8, 0, (_arg3 * 4));
};
} else {
_local7.length = 0;
return (_local7);
};
} else {
channel_buffer[_arg5] = true;
_local11 = Math.floor((_arg1.repeatPosition * _arg2));
if (_arg4 < _local11){
_local8 = new ByteArray();
if ((_local11 - _arg4) < _arg3){
_local8.writeBytes(_arg1.data, (Math.floor((_arg4 / _arg2)) * 4), (Math.ceil(((_local11 - _arg4) / _arg2)) * 4));
_local8 = resample(_local8, _arg2, _arg6);
_local7.writeBytes(_local8, 0, ((_local11 - _arg4) * 4));
_arg3 = (_arg3 - (_local11 - _arg4));
_arg4 = _local11;
} else {
_local8.writeBytes(_arg1.data, (Math.floor((_arg4 / _arg2)) * 4), (Math.ceil((_arg3 / _arg2)) * 4));
_local8 = resample(_local8, _arg2, _arg6);
_local7.writeBytes(_local8, 0, (_arg3 * 4));
};
};
if (_arg4 >= _local11){
_local12 = Math.floor((_arg1.repeatLength * _arg2));
_arg4 = ((_arg4 - _local11) % _local12);
if (_arg3 < _local12){
if ((_arg4 + _arg3) > _local12){
_local8 = new ByteArray();
_local8.writeBytes(_arg1.data, (Math.floor(((_local11 + _arg4) / _arg2)) * 4), (Math.ceil(((_local12 - _arg4) / _arg2)) * 4));
_local8 = resample(_local8, _arg2, _arg6);
_local7.writeBytes(_local8, 0, ((_local12 - _arg4) * 4));
_arg3 = (_arg3 - (_local12 - _arg4));
_arg4 = 0;
};
_local8 = new ByteArray();
_local8.writeBytes(_arg1.data, (Math.floor(((_local11 + _arg4) / _arg2)) * 4), (Math.ceil((_arg3 / _arg2)) * 4));
_local8 = resample(_local8, _arg2, _arg6);
_local7.writeBytes(_local8, 0, (_arg3 * 4));
} else {
_local13 = new ByteArray();
_local8 = new ByteArray();
_local8.writeBytes(_arg1.data, (_arg1.repeatPosition * 4), (_arg1.repeatLength * 4));
_local8 = resample(_local8, _arg2, _arg6);
_local8 = repeat(_local8, Math.ceil(((_arg3 + _arg4) / _local12)));
_local7.writeBytes(_local8, (_arg4 * 4), (_arg3 * 4));
};
};
};
return (_local7);
}
private function nextDivision_2():void{
var _local1:ByteArray;
var _local2:uint;
var _local3:ByteArray;
var _local4:int;
var _local5:Boolean;
var _local6:Number;
var _local7:ByteArray;
var _local8:uint;
_local5 = false;
if (nn){
note_length = note_length2;
_local5 = true;
nn = false;
};
if (!nn){
if ((SWFpos + note_length) > SWFsample){
if (!_local5){
note_length3 = note_length;
};
_local2 = note_length;
note_length = (SWFsample - SWFpos);
note_length2 = (_local2 - note_length);
nn = true;
_local5 = false;
};
};
_local4 = 0;
while (_local4 < nChannel) {
songSWF.position = (((swf_buffer.header.length + (13 * (_local4 + 1))) + ((SWFsample * 4) * _local4)) + (SWFpos * 4));
if (((((!((channel[_local4].sample == -1))) && (!((channel[_local4].volume == 0))))) && ((channel[_local4].period > 0)))){
if (channel[_local4].cutNote == -1){
_local8 = 0;
} else {
_local8 = (((tpd - channel[_local4].cutNote) / (tpd * multTPD)) * note_length);
};
_local6 = (Wav_Rate / (Wav_Machine / (channel[_local4].period * 2)));
_local3 = compile(sample.getItemAt((channel[_local4].sample - 1)), _local6, (note_length - _local8), channel[_local4].pos, _local4, ((channel[_local4].volume / 64) * (sample.getItemAt((channel[_local4].sample - 1)).volume / 64)));
if (_local3.length == 0){
_local3 = new ByteArray();
_local3.length = ((note_length - _local8) * 4);
channel[_local4].period = -1;
lstPeriod[_local4] = -1;
};
songSWF.writeBytes(_local3);
if (_local8 != 0){
_local1 = new ByteArray();
_local1.length = (_local8 * 4);
songSWF.writeBytes(_local1);
};
channel[_local4].pos = (channel[_local4].pos + (note_length - _local8));
} else {
_local1 = new ByteArray();
_local1.length = (note_length * 4);
songSWF.writeBytes(_local1);
};
_local4++;
};
SWFpos = (SWFpos + note_length);
if (_local5){
note_length = note_length3;
_local5 = false;
};
if (SWFpos >= SWFsample){
sstop = true;
SWFpos = 0;
volumePlay = false;
load.loadBytes(songSWF);
load.contentLoaderInfo.addEventListener(Event.COMPLETE, playBuffer2);
};
}
private function nextDivision_3():void{
if (jump){
jump = false;
if (dJump != -1){
posDivision = (nDivision - 1);
next();
posDivision = dJump;
dJump = -1;
} else {
if (sJump != -1){
posSong = sJump;
posDivision = 0;
sJump = -1;
};
};
} else {
next();
};
}
public function update_buffer():void{
SWFsample = ((0x0800 * buffz) - 1);
songSWF = initBuffer(SWFsample, nChannel);
noteSWF = initBuffer(SWFsample, 1);
SWFpos = 0;
}
private function playBuffer(_arg1:Event):void{
var _local2:Boolean;
var _local3:uint;
sstop = false;
if (((!((load.content == null))) && (playing))){
SWFnotLoad = false;
lstCur = getTimer();
_local2 = true;
_local3 = 0;
while (_local3 < nChannel) {
channel_play[_local3] = channel_buffer[_local3];
channel_buffer[_local3] = false;
if (channel_play[_local3]){
if (_local2){
_local2 = false;
CH_sync = _local3;
};
if (!channel_mute[_local3]){
snd_channel[_local3] = Object(load.content).sound[_local3].play(0, 0, new SoundTransform((0.5 * OVolume), channel[_local3].pan));
} else {
snd_channel[_local3] = Object(load.content).sound[_local3].play(0, 0, new SoundTransform(0, channel[_local3].pan));
};
};
if (_local2){
_local2 = false;
CH_sync = 0;
snd_channel[0] = Object(load.content).sound[0].play(0, 0, new SoundTransform(0, 0));
};
_local3++;
};
load.unload();
load = new Loader();
snd_channel[CH_sync].addEventListener(Event.SOUND_COMPLETE, playBuffer);
} else {
SWFnotLoad = true;
};
}
private function fixPalette():void{
var _local1:uint;
var _local2:uint;
paletteFix = {red:Array, green:Array, blue:Array, alpha:Array};
paletteFix.red = new Array(0x0100);
paletteFix.green = new Array(0x0100);
paletteFix.blue = new Array(0x0100);
paletteFix.alpha = new Array(0x0100);
_local2 = 0;
while (_local2 < 0x0100) {
if (_local2 < 128){
_local1 = (_local2 + 128);
paletteFix.red[_local2] = (_local1 << 16);
paletteFix.green[_local2] = (_local1 << 8);
paletteFix.blue[_local2] = _local1;
paletteFix.alpha[_local2] = (_local1 << 24);
} else {
_local1 = (_local2 - 128);
paletteFix.red[_local2] = (_local1 << 16);
paletteFix.green[_local2] = (_local1 << 8);
paletteFix.blue[_local2] = _local1;
paletteFix.alpha[_local2] = (_local1 << 24);
};
_local2++;
};
}
private function volume_down(_arg1:Event):void{
var _local2:uint;
if (OVolume <= 0){
OVolume = 0;
playing = false;
sstop = false;
currentSWFpos = new Array();
SWFnotLoad = true;
nn = false;
SWFpos = 0;
volumePlay = false;
_local2 = 0;
while (_local2 < nChannel) {
snd_channel[_local2].stop();
_local2++;
};
init_channel();
removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
removeEventListener(Event.ENTER_FRAME, volume_down);
} else {
OVolume = (OVolume - 0.01);
_local2 = 0;
while (_local2 < nChannel) {
SoundChannel(snd_channel[_local2]).soundTransform.volume = (OVolume * 0.5);
_local2++;
};
};
}
private function nextDivision_1():void{
var _local1:int;
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:uint;
var _local7:uint;
jump = false;
sJump = -1;
dJump = -1;
_local1 = 0;
while (_local1 < nChannel) {
if (((!((pattern[song[posSong].label][_local1][posDivision].instrument == 0))) || (!((pattern[song[posSong].label][_local1][posDivision].period == 0))))){
if (pattern[song[posSong].label][_local1][posDivision].instrument != 0){
channel[_local1].sample = pattern[song[posSong].label][_local1][posDivision].instrument;
channel[_local1].volume = 64;
};
if (pattern[song[posSong].label][_local1][posDivision].period != 0){
channel[_local1].period = pattern[song[posSong].label][_local1][posDivision].period;
lstPeriod[_local1] = channel[_local1].period;
};
channel[_local1].pos = 0;
};
channel[_local1].effect = pattern[song[posSong].label][_local1][posDivision].effect;
_local4 = ((channel[_local1].effect & 0x0F00) >> 8);
_local5 = ((channel[_local1].effect & 240) >> 4);
_local6 = (channel[_local1].effect & 15);
if (_local4 == 14){
switch (_local5){
case 12:
channel[_local1].cutNote = _local6;
break;
};
} else {
switch (_local4){
case 10:
if (_local5 != 0){
channel[_local1].volume = (channel[_local1].volume + (_local5 * (tpd - 1)));
} else {
if (_local6 != 0){
channel[_local1].volume = (channel[_local1].volume - (_local6 * (tpd - 1)));
};
};
if (channel[_local1].volume > 64){
channel[_local1].volume = 64;
} else {
if (channel[_local1].volume < 0){
channel[_local1].volume = 0;
};
};
break;
case 11:
sJump = ((_local5 << 4) + _local6);
jump = true;
break;
case 12:
channel[_local1].volume = ((_local5 << 4) + _local6);
break;
case 13:
dJump = ((_local5 * 10) + _local6);
jump = true;
break;
case 15:
_local7 = ((_local5 * 16) + _local6);
if (_local7 == 0){
_local7 = 1;
};
if (_local7 <= 32){
tpd = _local7;
} else {
bpm = _local7;
};
break;
};
};
_local1++;
};
update_dpm();
timePOS = (timePOS + note_length);
}
private function fixPalette2(_arg1:Number):void{
var _local2:uint;
var _local3:uint;
paletteFix2 = {red:Array, green:Array, blue:Array, alpha:Array};
paletteFix2.red = new Array(0x0100);
paletteFix2.green = new Array(0x0100);
paletteFix2.blue = new Array(0x0100);
paletteFix2.alpha = new Array(0x0100);
_local3 = 0;
while (_local3 < 0x0100) {
if (_local3 < 128){
_local2 = (0x0100 - ((128 - _local3) * _arg1));
paletteFix2.red[_local3] = (_local2 << 16);
paletteFix2.green[_local3] = (_local2 << 8);
paletteFix2.blue[_local3] = _local2;
paletteFix2.alpha[_local3] = (_local2 << 24);
} else {
_local2 = ((_local3 - 128) * _arg1);
paletteFix2.red[_local3] = (_local2 << 16);
paletteFix2.green[_local3] = (_local2 << 8);
paletteFix2.blue[_local3] = _local2;
paletteFix2.alpha[_local3] = (_local2 << 24);
};
_local3++;
};
}
private function init_channel():void{
var _local1:uint;
INITchannel = new ArrayCollection(new Array(nChannel));
channel = new Array(nChannel);
snd_channel = new Array(nChannel);
channel_buffer = new Array(nChannel);
channel_play = new Array(nChannel);
currentPER = new Array(nChannel);
lstPeriod = new Array(nChannel);
_local1 = 0;
while (_local1 < nChannel) {
channel[_local1] = {volume:int, pan:Number, sample:int, period:int, pos:uint, cutNote:int};
channel[_local1].volume = 64;
channel[_local1].pan = ((CHL_PAN[(_local1 % CHL_PAN.length)] - 128) / 128);
channel[_local1].sample = -1;
channel[_local1].cutNote = -1;
channel[_local1].period = -1;
channel[_local1].pos = 0;
lstPeriod[_local1] = -1;
snd_channel[_local1] = new SoundChannel();
channel_buffer[_local1] = false;
INITchannel.setItemAt(new channelC2(channel[_local1].volume, channel[_local1].pan), _local1);
_local1++;
};
}
public function readTitle(_arg1:ByteArrayAsset):String{
_arg1.position = 0;
return (_arg1.readUTFBytes(20));
}
public function update_dpm():void{
var _local1:Number;
var _local2:Number;
_local1 = multBPM;
_local2 = multTPD;
if ((tpd * _local2) < 1){
_local2 = (1 / tpd);
} else {
if ((tpd * _local2) > 32){
_local2 = (32 / tpd);
};
};
dpm = ((24 * uint((bpm * _local1))) / uint((tpd * _local2)));
note_length = ((60 / dpm) * Wav_Rate);
note_length3 = note_length;
}
private function next():void{
var _local1:uint;
_local1 = 0;
while (_local1 < nChannel) {
if (channel[_local1].cutNote >= 0){
channel[_local1].cutNote = -1;
channel[_local1].period = -1;
lstPeriod[_local1] = -1;
};
_local1++;
};
if (posDivision++ >= (nDivision - 1)){
posDivision = 0;
if (posSong++ >= (sLength - 1)){
posSong = 0;
};
};
}
public function readFormat(_arg1:ByteArrayAsset):Array{
var _local2:Array;
var _local3:String;
_local2 = new Array(4);
_arg1.position = SIG_MOD;
switch (_local3){
case "M.K.":
_local2[1] = 31;
_local2[2] = DIV_MOD;
_local2[3] = CHL_MOD;
break;
case "5CHN":
_local2[1] = 31;
_local2[2] = DIV_MOD;
_local2[3] = 5;
break;
case "6CHN":
_local2[1] = 31;
_local2[2] = DIV_MOD;
_local2[3] = 6;
break;
case "7CHN":
_local2[1] = 31;
_local2[2] = DIV_MOD;
_local2[3] = 7;
break;
case "8CHN":
_local2[1] = 31;
_local2[2] = DIV_MOD;
_local2[3] = 8;
break;
case "9CHN":
_local2[1] = 31;
_local2[2] = DIV_MOD;
_local2[3] = 9;
break;
default:
_local3 = "";
_local2[1] = SMP_MOD;
_local2[2] = DIV_MOD;
_local2[3] = CHL_MOD;
};
_local2[0] = _local3;
return (_local2);
}
public function play(_arg1:uint, _arg2:uint):void{
var _local3:uint;
if (!playing){
posDivision = _arg1;
posSong = _arg2;
currentROW = _arg1;
currentSONG = _arg2;
_local3 = 0;
while (_local3 < nChannel) {
currentPER[_local3] = pattern[song[_arg2].label][_local3][_arg1].period;
_local3++;
};
playing = true;
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
OVolume2 = OVolume;
OVolume = 0;
addEventListener(Event.ENTER_FRAME, volume_up);
removeEventListener(Event.ENTER_FRAME, volume_down);
};
}
private function initSWF():void{
var _local1:ByteArrayAsset;
swf_buffer = {header:new ByteArray(), footer:new ByteArray()};
_local1 = new SwfBin();
swf_buffer.header.writeBytes(_local1, 0, 85);
swf_buffer.footer.writeBytes(_local1, 85);
swf_buffer.header.endian = "littleEndian";
}
private function initBuffer(_arg1:uint, _arg2:uint):ByteArray{
var _local3:ByteArray;
var _local4:uint;
_local3 = new ByteArray();
_local3.endian = "littleEndian";
if (_arg2 > CHL_MAX){
_arg2 = CHL_MAX;
};
_local3.length = (((swf_buffer.header.length + (CHL_MAX * 13)) + ((_arg2 * _arg1) * 4)) + swf_buffer.footer.length);
_local3.writeBytes(swf_buffer.header);
_local4 = 0;
while (_local4 < CHL_MAX) {
if (_local4 < _arg2){
_local3.writeBytes(defineSound(_arg1, (_local4 + 1)));
_local3.position = (_local3.position + (_arg1 * 4));
} else {
_local3.writeBytes(defineSound(0, (_local4 + 1)));
};
_local4++;
};
_local3.writeBytes(swf_buffer.footer);
_local3.position = 4;
_local3.writeUnsignedInt(_local3.length);
return (_local3);
}
private function sampleTo32Bit(_arg1:ByteArray, _arg2:uint):ByteArray{
var _local3:uint;
var _local4:int;
var _local5:ByteArray;
_local5 = new ByteArray();
_local5.endian = "littleEndian";
_arg1.position = 0;
_local5.length = (_arg1.length * 4);
_local3 = 0;
while (_local3 < (_arg1.length - 1)) {
_local4 = ((_arg1.readByte() / 128) * nBit);
_local5.writeShort(_local4);
_local5.writeShort(_local4);
_local3++;
};
return (_local5);
}
private function resample(_arg1:ByteArray, _arg2:Number, _arg3:Number):ByteArray{
var _local4:ByteArray;
var _local5:BitmapData;
var _local6:BitmapData;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:Matrix;
var _local11:Number;
_local4 = new ByteArray();
_local4.writeBytes(_arg1);
_local10 = new Matrix();
_local7 = (_arg1.length / 4);
if (_arg2 < 1){
if (_local7 < BITMAP_MAX){
_local8 = _local7;
_local9 = 1;
} else {
_local8 = BITMAP_MAX;
_local9 = Math.ceil((_local7 / BITMAP_MAX));
};
} else {
_local8 = Math.floor((BITMAP_MAX / _arg2));
if (_local7 < _local8){
_local8 = _local7;
_local9 = 1;
} else {
_local9 = Math.ceil((_local7 / _local8));
};
};
_local11 = (Math.ceil((_local8 * _arg2)) / _local8);
_local4.length = ((_local8 * _local9) * 4);
_local5 = new BitmapData(_local8, _local9, false, 0);
_local6 = new BitmapData(Math.ceil((_local8 * _local11)), _local9, false, 0);
_local4.position = 0;
_local4.endian = "bigEndian";
_local5.setPixels(new Rectangle(0, 0, _local8, _local9), _local4);
fixPalette();
_local5.paletteMap(_local5, new Rectangle(0, 0, _local8, _local9), new Point(0, 0), paletteFix.red, paletteFix.green, paletteFix.blue, paletteFix.alpha);
_local10.scale(_local11, 1);
_local6.draw(new Bitmap(_local5, "auto", true), _local10);
fixPalette2(_arg3);
_local6.paletteMap(_local6, new Rectangle(0, 0, _local6.width, _local9), new Point(0, 0), paletteFix2.red, paletteFix2.green, paletteFix2.blue, paletteFix2.alpha);
_local4 = _local6.getPixels(new Rectangle(0, 0, _local6.width, _local9));
_local4.endian = "littleEndian";
if ((_local7 % _local8) != 0){
_local4.length = ((Math.floor(((_local7 % _local8) * _arg2)) + ((_local9 - 1) * _local6.width)) * 4);
} else {
if (_local7 == _local8){
_local4.length = (Math.floor((_local7 * _arg2)) * 4);
};
};
return (_local4);
}
private function repeat(_arg1:ByteArray, _arg2:uint):ByteArray{
var _local3:uint;
var _local4:ByteArray;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:Shape;
var _local11:BitmapFill;
var _local12:BitmapData;
var _local13:BitmapData;
_local4 = new ByteArray();
_local4.writeBytes(_arg1);
_local5 = (_arg1.length / 4);
if (_local5 < BITMAP_MAX){
_local6 = _local5;
_local7 = 1;
_local3 = Math.floor((BITMAP_MAX / _local6));
if (_local3 > _arg2){
_local3 = _arg2;
};
_local8 = (_local3 * _local6);
_local9 = Math.ceil((_arg2 / _local3));
} else {
_local7 = Math.ceil((_local5 / BITMAP_MAX));
_local6 = (_local5 / _local7);
_local8 = _local6;
_local9 = (_local7 * _arg2);
};
_local10 = new Shape();
_local11 = new BitmapFill();
_local12 = new BitmapData(_local6, _local7, true, 0);
_local13 = new BitmapData(_local8, _local9, true, 0);
_local4.length = ((_local6 * _local7) * 4);
_local4.position = 0;
_local12.setPixels(new Rectangle(0, 0, _local6, _local7), _local4);
_local11.source = _local12;
_local11.begin(_local10.graphics, new Rectangle(0, 0, _local8, _local9));
_local10.graphics.lineTo(_local8, 0);
_local10.graphics.lineTo(_local8, _local9);
_local10.graphics.lineTo(0, _local9);
_local10.graphics.lineTo(0, 0);
_local11.end(_local10.graphics);
_local13.draw(_local10);
return (_local13.getPixels(new Rectangle(0, 0, _local8, _local9)));
}
private function volume_up(_arg1:Event):void{
var _local2:uint;
if (OVolume >= OVolume2){
OVolume = OVolume2;
removeEventListener(Event.ENTER_FRAME, volume_up);
} else {
OVolume = (OVolume + 0.01);
_local2 = 0;
while (_local2 < nChannel) {
SoundChannel(snd_channel[_local2]).soundTransform.volume = (OVolume * 0.5);
_local2++;
};
};
}
}
}//package
Section 53
//AtemiS_Player_LITE_SwfBin (AtemiS_Player_LITE_SwfBin)
package {
import mx.core.*;
public class AtemiS_Player_LITE_SwfBin extends ByteArrayAsset {
}
}//package
Section 54
//channelC2 (channelC2)
package {
import flash.events.*;
import mx.events.*;
public class channelC2 implements IEventDispatcher {
private var _bindingEventDispatcher:EventDispatcher;
private var _110749pan:Number;
private var _810883302volume:uint;
public function channelC2(_arg1:uint, _arg2:Number){
_bindingEventDispatcher = new EventDispatcher(IEventDispatcher(this));
super();
volume = _arg1;
pan = _arg2;
}
public function dispatchEvent(_arg1:Event):Boolean{
return (_bindingEventDispatcher.dispatchEvent(_arg1));
}
public function hasEventListener(_arg1:String):Boolean{
return (_bindingEventDispatcher.hasEventListener(_arg1));
}
public function willTrigger(_arg1:String):Boolean{
return (_bindingEventDispatcher.willTrigger(_arg1));
}
public function get volume():uint{
return (this._810883302volume);
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
_bindingEventDispatcher.removeEventListener(_arg1, _arg2, _arg3);
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
_bindingEventDispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public function set pan(_arg1:Number):void{
var _local2:Object;
_local2 = this._110749pan;
if (_local2 !== _arg1){
this._110749pan = _arg1;
dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "pan", _local2, _arg1));
};
}
public function set volume(_arg1:uint):void{
var _local2:Object;
_local2 = this._810883302volume;
if (_local2 !== _arg1){
this._810883302volume = _arg1;
dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "volume", _local2, _arg1));
};
}
public function get pan():Number{
return (this._110749pan);
}
}
}//package
Section 55
//collections_properties (collections_properties)
package {
import mx.resources.*;
public class collections_properties extends ResourceBundle {
override protected function getContent():Object{
var _local1:Object;
_local1 = {};
_local1["findCondition"] = "Find criteria must contain all sort fields leading up to ''{0}''.";
_local1["noComparatorSortField"] = "Cannot determine comparator for SortField with name ''{0}''.";
_local1["outOfBounds"] = "Index '{0}' specified is out of bounds.";
_local1["invalidBookmark"] = "Invalid bookmark.";
_local1["nonUnique"] = "Non-unique values in items.";
_local1["incorrectAddition"] = "Attempt to add an item already in the view.";
_local1["findRestriction"] = "Find criteria must contain at least one sort field value.";
_local1["invalidType"] = "Incorrect type. Must be of type XML or a XMLList that contains one XML object. ";
_local1["unknownMode"] = "Unknown find mode.";
_local1["invalidIndex"] = "Invalid index: '{0}'.";
_local1["invalidRemove"] = "Cannot remove when current is beforeFirst or afterLast.";
_local1["unknownProperty"] = "Unknown Property: '{0}'.";
_local1["invalidInsert"] = "Cannot insert when current is beforeFirst.";
_local1["itemNotFound"] = "Cannot find when view is not sorted.";
_local1["bookmarkInvalid"] = "Bookmark no longer valid.";
_local1["noComparator"] = "Cannot determine comparator for '{0}'.";
_local1["invalidCursor"] = "Cursor no longer valid.";
_local1["noItems"] = "No items to search.";
_local1["bookmarkNotFound"] = "Bookmark is not from this view.";
return (_local1);
}
}
}//package
Section 56
//loopC (loopC)
package {
import flash.events.*;
import mx.events.*;
public class loopC implements IEventDispatcher {
public var endDIV:uint;
private var _1106363674length:uint;
public var startDIV:uint;
public var start:uint;
public var endSG:uint;
public var startSG:uint;
private var _bindingEventDispatcher:EventDispatcher;
public function loopC(){
_bindingEventDispatcher = new EventDispatcher(IEventDispatcher(this));
super();
}
public function dispatchEvent(_arg1:Event):Boolean{
return (_bindingEventDispatcher.dispatchEvent(_arg1));
}
public function willTrigger(_arg1:String):Boolean{
return (_bindingEventDispatcher.willTrigger(_arg1));
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
_bindingEventDispatcher.removeEventListener(_arg1, _arg2, _arg3);
}
public function set length(_arg1:uint):void{
var _local2:Object;
_local2 = this._1106363674length;
if (_local2 !== _arg1){
this._1106363674length = _arg1;
dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "length", _local2, _arg1));
};
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
_bindingEventDispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public function get length():uint{
return (this._1106363674length);
}
public function hasEventListener(_arg1:String):Boolean{
return (_bindingEventDispatcher.hasEventListener(_arg1));
}
}
}//package
Section 57
//sampleC (sampleC)
package {
import flash.events.*;
import flash.utils.*;
import mx.events.*;
public class sampleC implements IEventDispatcher {
public var num:uint;
private var _677312334finetune:int;
private var _810883302volume:uint;
private var _1106363674length:uint;
private var _1720677473repeatLength:uint;
private var _1179951132repeatPosition:uint;
public var data:ByteArray;
private var _bindingEventDispatcher:EventDispatcher;
private var _102727412label:String;
private var _1237882716graph2:Array;
private var _98615630graph:Array;
public function sampleC(){
_bindingEventDispatcher = new EventDispatcher(IEventDispatcher(this));
super();
}
public function get label():String{
return (this._102727412label);
}
public function get volume():uint{
return (this._810883302volume);
}
public function set graph(_arg1:Array):void{
var _local2:Object;
_local2 = this._98615630graph;
if (_local2 !== _arg1){
this._98615630graph = _arg1;
dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "graph", _local2, _arg1));
};
}
public function get graph2():Array{
return (this._1237882716graph2);
}
public function get finetune():int{
return (this._677312334finetune);
}
public function willTrigger(_arg1:String):Boolean{
return (_bindingEventDispatcher.willTrigger(_arg1));
}
public function set volume(_arg1:uint):void{
var _local2:Object;
_local2 = this._810883302volume;
if (_local2 !== _arg1){
this._810883302volume = _arg1;
dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "volume", _local2, _arg1));
};
}
public function set repeatLength(_arg1:uint):void{
var _local2:Object;
_local2 = this._1720677473repeatLength;
if (_local2 !== _arg1){
this._1720677473repeatLength = _arg1;
dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "repeatLength", _local2, _arg1));
};
}
public function set repeatPosition(_arg1:uint):void{
var _local2:Object;
_local2 = this._1179951132repeatPosition;
if (_local2 !== _arg1){
this._1179951132repeatPosition = _arg1;
dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "repeatPosition", _local2, _arg1));
};
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
_bindingEventDispatcher.removeEventListener(_arg1, _arg2, _arg3);
}
public function set length(_arg1:uint):void{
var _local2:Object;
_local2 = this._1106363674length;
if (_local2 !== _arg1){
this._1106363674length = _arg1;
dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "length", _local2, _arg1));
};
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
_bindingEventDispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public function get graph():Array{
return (this._98615630graph);
}
public function set graph2(_arg1:Array):void{
var _local2:Object;
_local2 = this._1237882716graph2;
if (_local2 !== _arg1){
this._1237882716graph2 = _arg1;
dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "graph2", _local2, _arg1));
};
}
public function dispatchEvent(_arg1:Event):Boolean{
return (_bindingEventDispatcher.dispatchEvent(_arg1));
}
public function get repeatLength():uint{
return (this._1720677473repeatLength);
}
public function get length():uint{
return (this._1106363674length);
}
public function set label(_arg1:String):void{
var _local2:Object;
_local2 = this._102727412label;
if (_local2 !== _arg1){
this._102727412label = _arg1;
dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "label", _local2, _arg1));
};
}
public function set finetune(_arg1:int):void{
var _local2:Object;
_local2 = this._677312334finetune;
if (_local2 !== _arg1){
this._677312334finetune = _arg1;
dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "finetune", _local2, _arg1));
};
}
public function get repeatPosition():uint{
return (this._1179951132repeatPosition);
}
public function hasEventListener(_arg1:String):Boolean{
return (_bindingEventDispatcher.hasEventListener(_arg1));
}
}
}//package
Section 58
//TetrisJD2 (TetrisJD2)
package {
import flash.display.*;
import flash.events.*;
import flash.system.*;
import flash.utils.*;
import flash.geom.*;
import flash.text.*;
import flash.media.*;
import flash.filters.*;
import flash.net.*;
import flash.ui.*;
public class TetrisJD2 extends MovieClip {
private const BLOCK_PIXEL:uint = 14;
private const SPEED:Array;
private const BLOCK_T_0:uint;
private const DEATH_MUSIC:Class;
private const BLOCK:Array;
private const BLOCK_L_90:uint;
private const BLOCK_S_0:uint;
private const TUNNEL_COLOR:Array;
private const NES_FRAME:Number = 60.0988;
private const BLOCK_I:Array;
private const BLOCK_L:Array;
private const BLOCK_O:Array;
private const BLOCK_J:Array;
private const BLOCK_S:Array;
private const BLOCK_Z:Array;
private const BLOCK_T:Array;
private const HIGH_MUSIC:Class;
private const BLOCK_HEIGHT:uint = 4;
private const BLOCK_J_COLOR:uint = 0xFF;
private const BLOCK_Z_COLOR:uint = 0xFF0000;
private const DEGREE_MAX:uint = 4;
private const BLOCK_O_0:uint;
private const ARENA_HEIGHT:uint = 22;
private const BLOCK_O_COLOR:uint = 0xFFFF00;
private const ARENA_HEIGHT_L:uint = 2;
private const BLOCK_Z_90:uint;
private const TUNNEL_GAMEOVER:uint = 0xFF00;
private const BLOCK_T_COLOR:uint = 0xFF00FF;
private const BLOCK_T_270:uint;
private const BLOCK_L_270:uint;
private const MENU_CREDIT:Class;
private const BLOCK_I_COLOR:uint = 0xFFFF;
private const MUSIC:Array;
private const LINE_CLEAR:uint = 20;
private const BLOCK_L_180:uint;
private const BLOCK_L_0:uint;
private const BLOCK_T_180:uint;
private const ARE:uint = 10;
private const LEVEL_T:uint = 1300;
private const ARENA_WIDTH:uint = 10;
private const BLOCK_RECT:Rectangle;
private const BLOCK_S_COLOR:uint = 0xFF00;
private const BLOCK_J_0:uint;
private const TUNNEL_CREDIT:uint = 0xFFFFFF;
private const BLOCK_Z_0:uint;
private const BLOCK_J_270:uint;
private const TUNNEL_MENU:uint = 0xFF0000;
private const BLOCK_I_0:uint;
private const BLOCK_S_90:uint;
private const TUNNEL_HIGH:uint = 0xFF;
private const BLOCK_J_180:uint;
private const MENU_MUSIC:Class;
private const COLOR:Array;
private const BLOCK_WIDTH:uint = 4;
private const BLOCK_I_90:uint;
private const DAS1:uint = 16;
private const DAS2:uint = 6;
private const START_X:uint;
private const START_Y:int;
private const BLOCK_T_90:uint;
private const MAX_T_LEVEL:uint = 29;
private const BLOCK_L_COLOR:uint = 0xFF8800;
private const TIMER_DELAY:uint = 3;
private const BLOCK_J_90:uint;
private var blockLST:uint;
private var GameOver:Sprite;
private var left:Boolean;
private var highscoreI:Number;
private var playing:Boolean;
private var tinytune2:Class;
private var ba:ByteArray;
private var press:Class;
private var credit2:Sprite;
private var a:Number;// = 0
private var arkanoid:Class;
private var tunnel:Tunnel;
private var creditI:Number;
private var option:Sprite;
private var statsBMP:Bitmap;
private var rotate_snd:Sound;
private var backt:Boolean;
private var stats:Sprite;
private var down:Boolean;
private var simply_short:Class;
private var optionBMP:Bitmap;
private var over:Class;
private var points:uint;
private var back:Boolean;
private var fps:uint;
private var lineBMP:BitmapData;
private var arenaBMP:Bitmap;
private var pauseI:Number;
private var txtName:TextField;
private var sound:Boolean;
private var GameOverI:Number;
private var cardiaxx:Class;
private var fifiou:Class;
private var background:MovieClip;
private var the_church:Class;
private var highscoreBMP:Bitmap;
private var iceCap:Class;
private var helpI:Number;
private var rotate:Class;
private var control:Boolean;
private var menu:Sprite;
private var txtPause:TextField;
private var upTimer:Timer;
private var frame:TextField;
private var down_timer:Timer;
private var txtCredit:Array;
private var my_little_hero:Class;
private var nextBMP:Bitmap;
private var txtHighscore:TextField;
private var blockDegree:int;
private var blockBMP:Bitmap;
private var bubble_toast_win:Class;
private var txtHelp:TextField;
private var frame_timer:Timer;
private var pause:Sprite;
private var musicBtn:Array;
private var line_test:Array;
private var right:Boolean;
private var tetris:Class;
private var music:Boolean;
private var highscore:Sprite;
private var array:Array;
private var ecrase:Class;
private var blockID:uint;
private var txtLines:TextField;
private var optionI:Number;
private var txtHighs:Array;
private var helpBMP:Bitmap;
private var rightTimer:Timer;
private var spectreTimer:Timer;
private var up:Boolean;
private var line_snd:Sound;
private var txtGameOver:Array;
private var menuI:Number;
private var player:AtemiS_Player_LITE;
private var arenaBMP2:Bitmap;
private var credit:Sprite;
private var txtLevel:TextField;
private var lines:uint;
private var txtOption:TextField;
private var arenaMSK:Bitmap;
private var arena:Sprite;
private var musict:Boolean;
private var currMusic:Class;
private var tempo:Boolean;
private var blockPTS:Point;
private var help:Sprite;
private var nextID:uint;
private var ove:SoundChannel;
private var sel_level:uint;
private var press_snd:Sound;
private var txtPoints:TextField;
private var dark:BitmapData;
private var level:uint;
private var over_snd:Sound;
private var ecrase_snd:Sound;
private var play2:Boolean;
private var maxy:uint;
private var GameOverBMP:Bitmap;
private var leftTimer:Timer;
private var menuBMP:Bitmap;
private var pauseBMP:Bitmap;
private var lstLevel:uint;
private var downTimer:Timer;
private var creditBMP:Bitmap;
private var fifiou_snd:Sound;
private var txtMenu:Array;
private var line:Class;
private var txt_sendHighscore:TextField;
private var backBtn:Array;
private var txtLevels:Array;
public function TetrisJD2(){
tetris = TetrisJD2_tetris;
tinytune2 = TetrisJD2_tinytune2;
arkanoid = TetrisJD2_arkanoid;
iceCap = TetrisJD2_iceCap;
simply_short = TetrisJD2_simply_short;
bubble_toast_win = TetrisJD2_bubble_toast_win;
the_church = TetrisJD2_the_church;
cardiaxx = TetrisJD2_cardiaxx;
my_little_hero = TetrisJD2_my_little_hero;
over = TetrisJD2_over;
over_snd = (new over() as Sound);
press = TetrisJD2_press;
press_snd = (new press() as Sound);
ecrase = TetrisJD2_ecrase;
ecrase_snd = (new ecrase() as Sound);
line = TetrisJD2_line;
line_snd = (new line() as Sound);
rotate = TetrisJD2_rotate;
rotate_snd = (new rotate() as Sound);
fifiou = TetrisJD2_fifiou;
fifiou_snd = (new fifiou() as Sound);
MUSIC = [tetris, tinytune2, arkanoid, iceCap, simply_short];
DEATH_MUSIC = the_church;
MENU_MUSIC = bubble_toast_win;
MENU_CREDIT = cardiaxx;
HIGH_MUSIC = my_little_hero;
BLOCK_RECT = new Rectangle(0, 0, (BLOCK_WIDTH * BLOCK_PIXEL), (BLOCK_HEIGHT * BLOCK_PIXEL));
START_X = (uint((((ARENA_WIDTH - BLOCK_WIDTH) / 2) + 1)) * BLOCK_PIXEL);
START_Y = (-((BLOCK_HEIGHT * BLOCK_PIXEL)) + (ARENA_HEIGHT_L * BLOCK_PIXEL));
SPEED = [48, 43, 38, 33, 28, 23, 18, 13, 8, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1];
BLOCK_I_0 = parseInt(((("0000" + "0000") + "1111") + "0000"), 2);
BLOCK_I_90 = parseInt(((("0010" + "0010") + "0010") + "0010"), 2);
BLOCK_O_0 = parseInt(((("0000" + "0110") + "0110") + "0000"), 2);
BLOCK_T_0 = parseInt(((("0000" + "0000") + "1110") + "0100"), 2);
BLOCK_T_90 = parseInt(((("0000" + "0100") + "1100") + "0100"), 2);
BLOCK_T_180 = parseInt(((("0000" + "0100") + "1110") + "0000"), 2);
BLOCK_T_270 = parseInt(((("0000" + "0100") + "0110") + "0100"), 2);
BLOCK_S_0 = parseInt(((("0000" + "0000") + "0110") + "1100"), 2);
BLOCK_S_90 = parseInt(((("0000" + "0100") + "0110") + "0010"), 2);
BLOCK_Z_0 = parseInt(((("0000" + "0000") + "1100") + "0110"), 2);
BLOCK_Z_90 = parseInt(((("0000" + "0010") + "0110") + "0100"), 2);
BLOCK_J_0 = parseInt(((("0000" + "0000") + "1110") + "0010"), 2);
BLOCK_J_90 = parseInt(((("0000" + "0100") + "0100") + "1100"), 2);
BLOCK_J_180 = parseInt(((("0000" + "1000") + "1110") + "0000"), 2);
BLOCK_J_270 = parseInt(((("0000" + "0110") + "0100") + "0100"), 2);
BLOCK_L_0 = parseInt(((("0000" + "0000") + "1110") + "1000"), 2);
BLOCK_L_90 = parseInt(((("0000" + "1100") + "0100") + "0100"), 2);
BLOCK_L_180 = parseInt(((("0000" + "0010") + "1110") + "0000"), 2);
BLOCK_L_270 = parseInt(((("0000" + "0100") + "0100") + "0110"), 2);
TUNNEL_COLOR = [39423, 65433, 0xFF3300, 10070783, 0xFF0099];
BLOCK_I = [BLOCK_I_0, BLOCK_I_90, BLOCK_I_0, BLOCK_I_90];
BLOCK_O = [BLOCK_O_0, BLOCK_O_0, BLOCK_O_0, BLOCK_O_0];
BLOCK_T = [BLOCK_T_0, BLOCK_T_90, BLOCK_T_180, BLOCK_T_270];
BLOCK_S = [BLOCK_S_0, BLOCK_S_90, BLOCK_S_0, BLOCK_S_90];
BLOCK_Z = [BLOCK_Z_0, BLOCK_Z_90, BLOCK_Z_0, BLOCK_Z_90];
BLOCK_J = [BLOCK_J_0, BLOCK_J_90, BLOCK_J_180, BLOCK_J_270];
BLOCK_L = [BLOCK_L_0, BLOCK_L_90, BLOCK_L_180, BLOCK_L_270];
COLOR = [BLOCK_I_COLOR, BLOCK_O_COLOR, BLOCK_T_COLOR, BLOCK_S_COLOR, BLOCK_Z_COLOR, BLOCK_J_COLOR, BLOCK_L_COLOR];
BLOCK = [[BLOCK_I, BLOCK_I_COLOR], [BLOCK_O, BLOCK_O_COLOR], [BLOCK_T, BLOCK_T_COLOR], [BLOCK_S, BLOCK_S_COLOR], [BLOCK_Z, BLOCK_Z_COLOR], [BLOCK_J, BLOCK_J_COLOR], [BLOCK_L, BLOCK_L_COLOR]];
highscore = new Sprite();
highscoreBMP = new Bitmap();
help = new Sprite();
helpBMP = new Bitmap();
option = new Sprite();
optionBMP = new Bitmap();
pause = new Sprite();
pauseBMP = new Bitmap();
credit = new Sprite();
creditBMP = new Bitmap();
credit2 = new Sprite();
background = new MovieClip();
arena = new Sprite();
menu = new Sprite();
GameOver = new Sprite();
menuBMP = new Bitmap();
GameOverBMP = new Bitmap();
arenaBMP = new Bitmap();
arenaBMP2 = new Bitmap();
statsBMP = new Bitmap(new BitmapData(100, ((ARENA_HEIGHT + 1) * BLOCK_PIXEL), false, 0x151515));
blockBMP = new Bitmap();
nextBMP = new Bitmap();
lineBMP = new BitmapData(BLOCK_PIXEL, BLOCK_PIXEL, true, 4278190080);
arenaMSK = new Bitmap(new BitmapData(((ARENA_WIDTH + 2) * BLOCK_PIXEL), ((ARENA_HEIGHT + 1) * BLOCK_PIXEL), true, 0));
ba = new ByteArray();
a = 0;
super();
frame = new TextField();
frame.textColor = 0xFFFFFF;
frame.selectable = false;
frame.filters = [new DropShadowFilter(0)];
frame.width = ((ARENA_WIDTH + 1) * BLOCK_PIXEL);
frame.autoSize = TextFieldAutoSize.RIGHT;
frame.text = "30 FPS";
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
frame_timer = new Timer(1000);
frame_timer.addEventListener("timer", frameHandler);
frame_timer.start();
init();
addChild(frame);
frame.visible = false;
init_menu();
__com_mochibot__("2fa71b6b", this, 10301, true);
}
private function afficheGameOver(_arg1:Event):void{
GameOver.alpha = (GameOver.alpha + 0.02);
if (GameOver.alpha >= 1){
GameOver.alpha = 1;
removeEventListener(Event.ENTER_FRAME, afficheGameOver);
};
}
private function update_lines():void{
txtLines.text = "";
if (lines < 100){
txtLines.appendText("0");
};
if (lines < 10){
txtLines.appendText("0");
};
txtLines.appendText(String(lines));
update_points();
}
private function drawPiece(_arg1:Array, _arg2:uint):BitmapData{
var _local3:BitmapData;
var _local4:uint;
var _local5:uint;
var _local6:uint;
var _local7:uint;
_local3 = new BitmapData((BLOCK_WIDTH * BLOCK_PIXEL), (BLOCK_HEIGHT * BLOCK_PIXEL), true, 0);
_local6 = 0;
while (_local6 < BLOCK_WIDTH) {
_local4 = (((BLOCK_WIDTH - _local6) - 1) * 4);
_local5 = ((_arg1[0][_arg2] & (15 << _local4)) >> _local4);
_local7 = 0;
while (_local7 < BLOCK_HEIGHT) {
_local4 = ((BLOCK_HEIGHT - _local7) - 1);
if (((_local5 & (1 << _local4)) >> _local4)){
_local3.fillRect(new Rectangle((_local7 * BLOCK_PIXEL), (_local6 * BLOCK_PIXEL), BLOCK_PIXEL, BLOCK_PIXEL), (_arg1[1] + 4278190080));
};
_local7++;
};
_local6++;
};
return (_local3);
}
private function animeHighscore(_arg1:Event):void{
highscoreI = (highscoreI + 0.35);
txtHighscore.x = (((Math.cos(highscoreI) * 17) + BLOCK_PIXEL) + (((ARENA_WIDTH * BLOCK_PIXEL) - txtHighscore.textWidth) / 2));
}
private function afficheGame(_arg1:Event):void{
blockBMP.alpha = (blockBMP.alpha + 0.02);
if (blockBMP.alpha >= 1){
blockBMP.alpha = 1;
removeEventListener(Event.ENTER_FRAME, afficheGame);
};
arenaBMP.alpha = blockBMP.alpha;
}
private function drawArena():void{
arenaMSK.bitmapData.fillRect(new Rectangle(0, 0, BLOCK_PIXEL, (arenaMSK.height - BLOCK_PIXEL)), 4281545523);
arenaMSK.bitmapData.fillRect(new Rectangle((arenaMSK.width - BLOCK_PIXEL), 0, BLOCK_PIXEL, (arenaMSK.height - BLOCK_PIXEL)), 4281545523);
arenaMSK.bitmapData.fillRect(new Rectangle(0, (arenaMSK.height - BLOCK_PIXEL), arenaMSK.width, BLOCK_PIXEL), 4281545523);
}
private function key_control_down(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == Keyboard.LEFT)) || ((_arg1.keyCode == 65)))){
if (!left){
left = true;
leftTimer = new Timer(((DAS1 / NES_FRAME) * 1000));
leftTimer.addEventListener(TimerEvent.TIMER, blockLEFT2);
leftTimer.start();
blockLEFT();
};
};
if ((((_arg1.keyCode == Keyboard.RIGHT)) || ((_arg1.keyCode == 68)))){
if (!right){
right = true;
rightTimer = new Timer(((DAS1 / NES_FRAME) * 1000));
rightTimer.addEventListener(TimerEvent.TIMER, blockRIGHT2);
rightTimer.start();
blockRIGHT();
};
};
if ((((((((_arg1.keyCode == Keyboard.UP)) || ((_arg1.keyCode == 88)))) || ((_arg1.keyCode == 87)))) || ((_arg1.keyCode == 191)))){
if (!up){
up = true;
upTimer = new Timer(((DAS1 / NES_FRAME) * 1000));
upTimer.addEventListener(TimerEvent.TIMER, blockUP2);
upTimer.start();
blockUP();
};
};
if ((((((_arg1.keyCode == 90)) || ((_arg1.keyCode == Keyboard.SPACE)))) || ((_arg1.keyCode == 190)))){
if (!up){
up = true;
upTimer = new Timer(((DAS1 / NES_FRAME) * 1000));
upTimer.addEventListener(TimerEvent.TIMER, blockUPA2);
upTimer.start();
blockUPA();
};
};
if ((((_arg1.keyCode == Keyboard.DOWN)) || ((_arg1.keyCode == 83)))){
if (!down){
down = true;
downTimer = new Timer((25 * TIMER_DELAY));
downTimer.addEventListener(TimerEvent.TIMER, blockDOWN2);
downTimer.start();
down_timer.stop();
points++;
blockDOWN();
};
};
if ((((_arg1.keyCode == Keyboard.ESCAPE)) || ((_arg1.keyCode == 80)))){
init_pause(null);
};
}
private function enterFrameHandler(_arg1:Event):void{
fps++;
}
private function check_music(_arg1:uint):void{
if (_arg1 > 1){
change_music2(MUSIC[_arg1], 0.5);
} else {
change_music2(MUSIC[_arg1], 1);
};
clear_music();
musicBtn[_arg1].textColor = 0x888888;
}
private function option_backt(_arg1:Event):void{
if (sound){
press_snd.play(100);
};
if (TextField(_arg1.target).textColor == 0x888888){
TextField(_arg1.target).textColor = 0xFFFFFF;
backt = false;
} else {
TextField(_arg1.target).textColor = 0x888888;
backt = true;
};
}
private function backOption(_arg1:Event):void{
if (sound){
press_snd.play(100);
};
kill_Option();
if (play2){
init_pause2();
} else {
init_menu2();
};
}
private function launch_help(_arg1:Event):void{
kill_menu();
initHelp();
}
private function DIE():void{
killGame();
change_music2(DEATH_MUSIC, 0.5);
player.multBPM = 1;
initGameOver();
clear_back();
clear_music();
}
private function initHelp():void{
help.visible = true;
help.alpha = 0;
helpI = 0;
addEventListener(Event.ENTER_FRAME, afficheHelp);
addEventListener(Event.ENTER_FRAME, animeHelp);
}
private function killGame():void{
var _local1:Timer;
press_snd.play(100);
arenaBMP2.bitmapData = arenaBMP.bitmapData.clone();
arenaBMP2.bitmapData.copyPixels(blockBMP.bitmapData, blockBMP.bitmapData.rect, blockPTS, null, null, true);
arenaBMP.visible = false;
arenaBMP2.visible = true;
stage.removeEventListener(KeyboardEvent.KEY_DOWN, key_control_down);
stage.removeEventListener(KeyboardEvent.KEY_UP, key_control_up);
if (leftTimer != null){
leftTimer.stop();
};
if (rightTimer != null){
rightTimer.stop();
};
if (upTimer != null){
upTimer.stop();
};
if (downTimer != null){
downTimer.stop();
};
_local1 = new Timer(75);
_local1.addEventListener("timer", effaceBackground);
_local1.start();
blockBMP.visible = false;
nextBMP.visible = false;
down_timer.stop();
playing = false;
}
private function roll(_arg1:Event):void{
if (play2){
if (sound){
ove.soundTransform.volume = 0;
ove = over_snd.play(100);
};
TextField(_arg1.currentTarget).filters = [new DropShadowFilter(0, 45, 0xFF, 1, 6, 6, 2)];
if (TextField(_arg1.currentTarget).textColor != 0x888888){
TextField(_arg1.currentTarget).textColor = 0xFF00;
};
};
}
private function blockRIGHT2(_arg1:TimerEvent):void{
if (Timer(_arg1.target).currentCount == 1){
Timer(_arg1.target).delay = ((DAS2 / NES_FRAME) * 1000);
};
blockRIGHT();
}
private function pauseMenu(_arg1:Event):void{
nextBMP.visible = false;
clear_back();
clear_music();
kill_Pause();
player.stop();
init_menu();
}
private function animeGameOver(_arg1:Event):void{
var _local2:uint;
GameOverI = (GameOverI + 0.35);
if (GameOverI > 99){
_local2 = 0;
while (_local2 < txtGameOver.length) {
TextField(txtGameOver[_local2]).appendText("");
txtGameOver[_local2].y = (BLOCK_PIXEL * 2);
_local2++;
};
removeEventListener(Event.ENTER_FRAME, animeGameOver);
} else {
_local2 = 0;
while (_local2 < txtGameOver.length) {
txtGameOver[_local2].y = ((Math.cos((GameOverI + (0.35 * _local2))) * (((100 - GameOverI) / 100) * 25)) + (BLOCK_PIXEL * 2));
_local2++;
};
};
}
private function effaceGameOver(_arg1:TimerEvent):void{
efface(_arg1, GameOverBMP);
}
private function update_level():void{
if (lstLevel != uint((lines / 10))){
lstLevel = uint((lines / 10));
if (backt){
check_background((uint((lines / 10)) % 5));
};
if (musict){
check_music((uint((lines / 10)) % 5));
};
};
if (level < uint((lines / 10))){
level = uint((lines / 10));
};
if (tempo){
updateTPD();
};
txtLevel.text = "";
if (level < 10){
txtLevel.appendText("0");
};
txtLevel.appendText(String(level));
}
private function effaceOption(_arg1:TimerEvent):void{
efface(_arg1, optionBMP);
}
private function kill_Option():void{
var _local1:Timer;
if (sound){
press_snd.play(100);
};
optionBMP.bitmapData = arenaMSK.bitmapData.clone();
optionBMP.bitmapData.draw(option, null, null, "normal");
removeEventListener(Event.ENTER_FRAME, animeOption);
option.visible = false;
_local1 = new Timer(75);
_local1.addEventListener("timer", effaceOption);
_local1.start();
}
private function launch_highscore(_arg1:Event):void{
kill_menu();
player.stop();
init_highscore();
}
private function animeCredit(_arg1:Event):void{
var _local2:uint;
creditI = (creditI + 0.35);
_local2 = 0;
while (_local2 < txtCredit.length) {
txtCredit[_local2].y = ((Math.cos((creditI + (0.8 * _local2))) * 20) + (BLOCK_PIXEL * 2));
_local2++;
};
credit2.y = (credit2.y - 1);
if (credit2.y < -((credit2.height + 15))){
credit2.y = arena.height;
};
}
private function arrange_line():void{
var _local1:BitmapData;
var _local2:uint;
_local1 = new BitmapData((ARENA_WIDTH * BLOCK_PIXEL), BLOCK_PIXEL, true, 0);
_local2 = 0;
while (_local2 < line_test.length) {
_local1.copyPixels(arenaBMP.bitmapData, new Rectangle(BLOCK_PIXEL, ((line_test[_local2] - BLOCK_PIXEL) + (BLOCK_PIXEL * _local2)), _local1.width, _local1.height), new Point(0, 0));
removeBEVEL(_local1, (BLOCK_PIXEL - 5));
_local1.applyFilter(_local1, _local1.rect, new Point(0, 0), new BevelFilter(2));
arenaBMP.bitmapData.copyPixels(_local1, new Rectangle(0, (_local1.height - 3), _local1.width, 3), new Point(BLOCK_PIXEL, ((line_test[_local2] - 3) + (BLOCK_PIXEL * _local2))), null, null, true);
if (line_test[_local2] < (ARENA_HEIGHT * BLOCK_PIXEL)){
_local1.copyPixels(arenaBMP.bitmapData, new Rectangle(BLOCK_PIXEL, ((line_test[_local2] + BLOCK_PIXEL) + (BLOCK_PIXEL * _local2)), _local1.width, _local1.height), new Point(0, 0));
removeBEVEL(_local1, 0);
_local1.applyFilter(_local1, _local1.rect, new Point(0, 0), new BevelFilter(2));
arenaBMP.bitmapData.copyPixels(_local1, new Rectangle(0, 0, _local1.width, 3), new Point(BLOCK_PIXEL, ((line_test[_local2] + BLOCK_PIXEL) + (BLOCK_PIXEL * _local2))), null, null, true);
};
arenaBMP.bitmapData.copyPixels(arenaBMP.bitmapData, new Rectangle(BLOCK_PIXEL, 0, (ARENA_WIDTH * BLOCK_PIXEL), (line_test[_local2] + (_local2 * BLOCK_PIXEL))), new Point(BLOCK_PIXEL, BLOCK_PIXEL));
_local2++;
};
arenaBMP.bitmapData.fillRect(new Rectangle(BLOCK_PIXEL, 0, (ARENA_WIDTH * BLOCK_PIXEL), (BLOCK_PIXEL * _local2)), 0);
lines = (lines + _local2);
switch (_local2){
case 1:
points = (points + ((level + 1) * 40));
break;
case 2:
points = (points + ((level + 1) * 100));
break;
case 3:
points = (points + ((level + 1) * 300));
break;
case 4:
points = (points + ((level + 1) * 1200));
break;
};
if (_local2 > 0){
update_level();
};
update_lines();
}
private function blockLEFT2(_arg1:TimerEvent):void{
if (Timer(_arg1.target).currentCount == 1){
Timer(_arg1.target).delay = ((DAS2 / NES_FRAME) * 1000);
};
blockLEFT();
}
private function check_background(_arg1:uint):void{
tunnel.color = TUNNEL_COLOR[_arg1];
clear_back();
backBtn[_arg1].textColor = 0x888888;
}
private function check_line():void{
var _local1:Boolean;
var _local2:uint;
var _local3:uint;
var _local4:Timer;
if (sound){
ecrase_snd.play(100);
};
line_test = new Array();
_local2 = 0;
while (_local2 < BLOCK_HEIGHT) {
if ((blockBMP.y + (((BLOCK_HEIGHT - _local2) - 2) * BLOCK_PIXEL)) < (arenaBMP.height - BLOCK_PIXEL)){
_local1 = true;
_local3 = 0;
while (_local3 < ARENA_WIDTH) {
if (!arenaBMP.bitmapData.hitTest(new Point(0, 0), 0xFF, lineBMP, new Point((BLOCK_PIXEL + (_local3 * BLOCK_PIXEL)), (blockBMP.y + (((BLOCK_HEIGHT - _local2) - 2) * BLOCK_PIXEL))))){
_local1 = false;
break;
};
_local3++;
};
if (_local1){
line_test.push((blockBMP.y + (((BLOCK_HEIGHT - _local2) - 2) * BLOCK_PIXEL)));
};
};
_local2++;
};
if (line_test.length > 0){
_local4 = new Timer((((LINE_CLEAR / NES_FRAME) * 1000) / 5));
_local4.addEventListener(TimerEvent.TIMER, erase_line);
_local4.start();
control = false;
if (line_test.length == 4){
if (sound){
fifiou_snd.play();
};
} else {
if (sound){
line_snd.play(100);
};
};
};
}
private function drawMenu():void{
var _local1:uint;
var _local2:uint;
var _local3:TextField;
var _local4:String;
var _local5:TextFormat;
var _local6:Sprite;
_local4 = "MENU";
_local5 = new TextFormat();
_local5.color = 0xFFFFFF;
_local5.bold = true;
_local5.size = 18;
txtMenu = new Array(_local4.length);
_local1 = 0;
while (_local1 < _local4.length) {
_local3 = new TextField();
_local3.text = _local4.charAt(_local1);
_local3.selectable = false;
_local3.x = ((BLOCK_PIXEL + ((ARENA_WIDTH * BLOCK_PIXEL) * (_local1 / _local4.length))) + 5);
_local3.setTextFormat(_local5);
_local3.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local3.width = (_local3.textWidth + 3);
_local3.height = (_local3.textHeight + 3);
menu.addChild(_local3);
txtMenu[_local1] = _local3;
_local1++;
};
_local6 = new Sprite();
_local6.filters = [new BevelFilter(2)];
_local6.graphics.lineStyle(2, 0xFFFFFF);
txtLevels = new Array(10);
_local5.size = 14;
_local5.align = "center";
_local6.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - (20 * 5)) / 2));
_local6.y = 130;
_local1 = 0;
while (_local1 < 2) {
_local2 = 0;
while (_local2 < 5) {
_local6.graphics.drawRect((_local2 * 20), (_local1 * 20), 20, 20);
_local3 = new TextField();
_local3.text = String((_local2 + (5 * _local1)));
_local3.selectable = false;
_local3.setTextFormat(_local5);
_local3.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local3.width = 20;
_local3.height = (_local3.textHeight + 3);
_local3.x = (((_local2 * 20) + _local6.x) + 1);
_local3.y = (((_local1 * 20) + _local6.y) - 1);
_local3.addEventListener(MouseEvent.CLICK, change_level);
_local3.addEventListener(MouseEvent.ROLL_OVER, roll3);
_local3.addEventListener(MouseEvent.ROLL_OUT, out);
txtLevels[(_local2 + (5 * _local1))] = _local3;
menu.addChild(_local3);
_local2++;
};
_local1++;
};
menu.addChild(_local6);
_local5.size = 16;
_local5.align = "left";
_local3 = new TextField();
_local3.text = "Level";
_local3.selectable = false;
_local3.setTextFormat(_local5);
_local3.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local3.x = (BLOCK_PIXEL + 2);
_local3.y = 100;
_local3.width = (_local3.textWidth + 3);
_local3.height = (_local3.textHeight + 3);
menu.addChild(_local3);
_local3 = new TextField();
_local3.text = "Start Game";
_local3.selectable = false;
_local3.setTextFormat(_local5);
_local3.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local3.width = (_local3.textWidth + 5);
_local3.height = (_local3.textHeight + 5);
_local3.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local3.textWidth) / 2));
_local3.y = 185;
_local3.addEventListener(MouseEvent.CLICK, launch_game);
_local3.addEventListener(MouseEvent.ROLL_OVER, roll2);
_local3.addEventListener(MouseEvent.ROLL_OUT, out2);
menu.addChild(_local3);
_local3 = new TextField();
_local3.text = "Highscores";
_local3.selectable = false;
_local3.setTextFormat(_local5);
_local3.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local3.width = (_local3.textWidth + 5);
_local3.height = (_local3.textHeight + 5);
_local3.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local3.textWidth) / 2));
_local3.y = (200 + 7);
_local3.addEventListener(MouseEvent.CLICK, launch_highscore);
_local3.addEventListener(MouseEvent.ROLL_OVER, roll2);
_local3.addEventListener(MouseEvent.ROLL_OUT, out2);
menu.addChild(_local3);
_local3 = new TextField();
_local3.text = "Options";
_local3.selectable = false;
_local3.setTextFormat(_local5);
_local3.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local3.width = (_local3.textWidth + 5);
_local3.height = (_local3.textHeight + 5);
_local3.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local3.textWidth) / 2));
_local3.y = (210 + 19);
_local3.addEventListener(MouseEvent.CLICK, launch_option);
_local3.addEventListener(MouseEvent.ROLL_OVER, roll2);
_local3.addEventListener(MouseEvent.ROLL_OUT, out2);
menu.addChild(_local3);
_local3 = new TextField();
_local3.text = "Credits";
_local3.selectable = false;
_local3.setTextFormat(_local5);
_local3.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local3.width = (_local3.textWidth + 5);
_local3.height = (_local3.textHeight + 5);
_local3.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local3.textWidth) / 2));
_local3.y = (210 + 41);
_local3.addEventListener(MouseEvent.CLICK, launch_credit);
_local3.addEventListener(MouseEvent.ROLL_OVER, roll2);
_local3.addEventListener(MouseEvent.ROLL_OUT, out2);
menu.addChild(_local3);
_local3 = new TextField();
_local3.text = "Help";
_local3.selectable = false;
_local3.setTextFormat(_local5);
_local3.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local3.width = (_local3.textWidth + 5);
_local3.height = (_local3.textHeight + 5);
_local3.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local3.textWidth) / 2));
_local3.y = (210 + 63);
_local3.addEventListener(MouseEvent.CLICK, launch_help);
_local3.addEventListener(MouseEvent.ROLL_OVER, roll2);
_local3.addEventListener(MouseEvent.ROLL_OUT, out2);
menu.addChild(_local3);
}
private function gameHigh(_arg1:Event):void{
kill_GameOver();
init_highscore();
}
private function option_sound(_arg1:Event):void{
if (sound){
press_snd.play(100);
};
if (TextField(_arg1.target).textColor == 0x888888){
TextField(_arg1.target).textColor = 0xFFFFFF;
sound = false;
} else {
TextField(_arg1.target).textColor = 0x888888;
sound = true;
};
}
private function change_music(_arg1:Event):void{
if (play2){
clear_music();
TextField(_arg1.currentTarget).textColor = 0x888888;
check_music((uint(TextField(_arg1.target).text) - 1));
};
}
private function affichePause(_arg1:Event):void{
pause.alpha = (pause.alpha + 0.02);
if (pause.alpha >= 1){
pause.alpha = 1;
removeEventListener(Event.ENTER_FRAME, affichePause);
};
}
private function effaceMenu(_arg1:TimerEvent):void{
efface(_arg1, menuBMP);
}
private function launch_game(_arg1:Event):void{
kill_menu();
player.stop();
init_game();
}
private function init():void{
var _local1:TextFormat;
var _local2:TextField;
stage.frameRate = 40;
drawArena();
statsBMP.x = arenaMSK.width;
stats = drawStats();
stats.x = arenaMSK.width;
dark = new BitmapData(arenaMSK.width, arenaMSK.height, true, 0);
background.x = BLOCK_PIXEL;
tunnel = new Tunnel(background, (ARENA_WIDTH * BLOCK_PIXEL), (ARENA_HEIGHT * BLOCK_PIXEL));
addChild(background);
addChild(arena);
drawGameOver();
drawMenu();
drawCredit();
drawPause();
drawOption();
drawHelp();
drawHighscore();
addChild(GameOver);
addChild(menu);
addChild(credit);
addChild(pause);
addChild(option);
addChild(help);
addChild(highscore);
addChild(GameOverBMP);
addChild(menuBMP);
addChild(creditBMP);
addChild(pauseBMP);
addChild(optionBMP);
addChild(helpBMP);
addChild(highscoreBMP);
arena.addChild(arenaBMP);
arena.addChild(arenaBMP2);
arena.addChild(statsBMP);
arena.addChild(blockBMP);
addChild(stats);
addChild(arenaMSK);
_local1 = new TextFormat();
_local1.color = 0xFFFFFF;
_local1.size = 9;
_local1.bold = false;
_local2 = new TextField();
_local2.text = "PAUSE";
_local2.height = (_local2.textHeight + 5);
_local2.width = (_local2.textWidth + 5);
_local2.selectable = false;
_local2.textColor = 0xFFFFFF;
_local2.filters = [new DropShadowFilter(0)];
_local2.setTextFormat(_local1);
_local2.x = ((arenaMSK.width - _local2.textWidth) / 2);
_local2.y = ((arenaMSK.height - 4) - _local2.textHeight);
_local2.addEventListener(MouseEvent.CLICK, init_pause);
_local2.addEventListener(MouseEvent.ROLL_OVER, roll);
_local2.addEventListener(MouseEvent.ROLL_OUT, out);
addChild(_local2);
arenaBMP.filters = [new BevelFilter(2)];
arenaMSK.filters = [new BevelFilter(2)];
statsBMP.filters = [new BevelFilter(2)];
menu.visible = false;
GameOver.visible = false;
credit.visible = false;
pause.visible = false;
option.visible = false;
help.visible = false;
highscore.visible = false;
play2 = false;
music = true;
musict = true;
back = true;
backt = true;
tempo = true;
sound = true;
ove = new SoundChannel();
down_timer = new Timer(0);
down_timer.addEventListener(TimerEvent.TIMER, main_loop);
}
private function launch_credit(_arg1:Event):void{
kill_menu();
player.stop();
init_credit();
}
private function init_credit():void{
tunnel.color = TUNNEL_CREDIT;
credit.visible = true;
credit.alpha = 0;
creditI = 0;
credit2.y = 100;
currMusic = MENU_CREDIT;
if (music){
player = new AtemiS_Player_LITE(MENU_CREDIT);
player.play(0, 0);
};
tunnel.vitesse = 0.02;
addEventListener(Event.ENTER_FRAME, afficheCredit);
addEventListener(Event.ENTER_FRAME, animeCredit);
}
private function afficheHighscore(_arg1:Event):void{
highscore.alpha = (highscore.alpha + 0.02);
if (highscore.alpha >= 1){
highscore.alpha = 1;
removeEventListener(Event.ENTER_FRAME, afficheHighscore);
};
}
private function putPiece():void{
arenaBMP.bitmapData.copyPixels(blockBMP.bitmapData, blockBMP.bitmapData.rect, blockPTS, null, null, true);
}
private function update_points():void{
txtPoints.text = "";
if (points < 10000000){
txtPoints.appendText("0");
};
if (points < 1000000){
txtPoints.appendText("0");
};
if (points < 100000){
txtPoints.appendText("0");
};
if (points < 10000){
txtPoints.appendText("0");
};
if (points < 1000){
txtPoints.appendText("0");
};
if (points < 100){
txtPoints.appendText("0");
};
if (points < 10){
txtPoints.appendText("0");
};
txtPoints.appendText(String(points));
}
private function change_background(_arg1:Event):void{
if (play2){
check_background((uint(TextField(_arg1.target).text) - 1));
};
}
private function afficheCredit(_arg1:Event):void{
credit.alpha = (credit.alpha + 0.02);
if (credit.alpha >= 1){
credit.alpha = 1;
removeEventListener(Event.ENTER_FRAME, afficheCredit);
};
}
private function send_highscore2(_arg1:Event):void{
var _local2:XML;
var _local3:Boolean;
var _local4:uint;
var _local5:XML;
var _local6:URLVariables;
var _local7:URLRequest;
var _local8:URLLoader;
_local2 = XML(_arg1.target.data);
_local3 = false;
_local4 = 0;
while (_local4 < 10) {
if (points > uint(_local2.top[_local4].@score)){
_local5 = new XML((((((("<top name=\"" + ??esc_xattr
) + "\" score=\"") + ??esc_xattr
) + "\" level=\"") + ??esc_xattr
) + "\"/>"));
_local2 = _local2.insertChildBefore(_local2.top[_local4], _local5);
_local3 = true;
break;
};
_local4++;
};
if (_local3){
_local6 = new URLVariables(("score=" + _local2.toXMLString()));
_local7 = new URLRequest();
_local7.url = "http://www.clubdubeau.com/team-atemis/tetris64k/save_highscore.php";
_local7.method = URLRequestMethod.POST;
_local7.data = _local6;
_local8 = new URLLoader();
_local8.load(_local7);
_local8.addEventListener(Event.COMPLETE, gameHigh);
} else {
kill_GameOver();
init_highscore();
};
}
private function initGameOver():void{
var _local1:TextFormat;
tunnel.color = TUNNEL_GAMEOVER;
GameOver.visible = true;
GameOver.alpha = 0;
play2 = false;
GameOverI = 0;
tunnel.vitesse = 0.02;
_local1 = new TextFormat();
_local1.color = 0xFFFFFF;
_local1.bold = true;
_local1.align = "center";
_local1.size = 12;
txt_sendHighscore.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
txt_sendHighscore.addEventListener(MouseEvent.CLICK, send_highscore);
txt_sendHighscore.addEventListener(MouseEvent.ROLL_OVER, roll2);
txt_sendHighscore.addEventListener(MouseEvent.ROLL_OUT, out2);
txt_sendHighscore.text = "Send Highscore";
txt_sendHighscore.setTextFormat(_local1);
txtName.type = TextFieldType.INPUT;
addEventListener(Event.ENTER_FRAME, afficheGameOver);
addEventListener(Event.ENTER_FRAME, animeGameOver);
}
private function frameHandler(_arg1:TimerEvent):void{
frame.text = (fps + " FPS");
fps = 0;
}
private function effaceHighscore(_arg1:TimerEvent):void{
efface(_arg1, highscoreBMP);
}
private function drawGameOver():void{
var _local1:TextField;
var _local2:String;
var _local3:TextFormat;
var _local4:uint;
_local2 = "Game Over";
_local3 = new TextFormat();
_local3.color = 0xFFFFFF;
_local3.bold = true;
_local3.size = 18;
txtGameOver = new Array(_local2.length);
_local4 = 0;
while (_local4 < _local2.length) {
_local1 = new TextField();
_local1.text = _local2.charAt(_local4);
_local1.selectable = false;
_local1.x = (BLOCK_PIXEL + ((ARENA_WIDTH * BLOCK_PIXEL) * (_local4 / _local2.length)));
_local1.setTextFormat(_local3);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.height = 20;
GameOver.addChild(_local1);
txtGameOver[_local4] = _local1;
_local4++;
};
_local3.align = "center";
_local3.size = 12;
_local1 = new TextField();
_local1.text = "Insert your Name";
_local1.selectable = true;
_local1.border = true;
_local1.borderColor = 0xFFFFFF;
_local1.setTextFormat(_local3);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.maxChars = 22;
_local1.textColor = 0xFFFFFF;
_local1.width = 110;
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.width) / 2));
_local1.y = 90;
_local1.height = (_local1.textHeight + 5);
txtName = _local1;
GameOver.addChild(_local1);
_local1 = new TextField();
_local1.text = "Send HighScore";
_local1.selectable = false;
_local1.setTextFormat(_local3);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = 115;
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
txt_sendHighscore = _local1;
GameOver.addChild(_local1);
_local3.align = "left";
_local1 = new TextField();
_local1.text = "Restart";
_local1.selectable = false;
_local1.setTextFormat(_local3);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = 180;
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.addEventListener(MouseEvent.CLICK, restartGame);
_local1.addEventListener(MouseEvent.ROLL_OVER, roll2);
_local1.addEventListener(MouseEvent.ROLL_OUT, out2);
GameOver.addChild(_local1);
_local1 = new TextField();
_local1.text = "Back to Menu";
_local1.selectable = false;
_local1.setTextFormat(_local3);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = 200;
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.addEventListener(MouseEvent.CLICK, gameover_menu);
_local1.addEventListener(MouseEvent.ROLL_OVER, roll2);
_local1.addEventListener(MouseEvent.ROLL_OUT, out2);
GameOver.addChild(_local1);
}
private function drawHighscore():void{
var _local1:TextField;
var _local2:uint;
var _local3:TextFormat;
var _local4:uint;
var _local5:uint;
var _local6:Sprite;
var _local7:Sprite;
_local3 = new TextFormat();
_local3.color = 0xFFFFFF;
_local3.bold = true;
_local3.size = 16;
_local1 = new TextField();
_local1.text = "HIGHSCORE";
_local1.selectable = false;
_local1.setTextFormat(_local3);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = 3;
txtHighscore = _local1;
highscore.addChild(_local1);
_local4 = 120;
_local5 = 23;
_local6 = new Sprite();
_local7 = new Sprite();
txtHighs = new Array(10);
_local2 = 0;
while (_local2 < 11) {
_local6.graphics.lineStyle(2, 0xFFFFFF);
_local6.graphics.moveTo(0, (_local2 * _local5));
_local6.graphics.lineTo(_local4, (_local2 * _local5));
_local6.graphics.lineTo(_local4, ((_local2 + 1) * _local5));
_local6.graphics.lineTo(0, ((_local2 + 1) * _local5));
_local6.graphics.lineTo(0, (_local2 * _local5));
_local6.graphics.moveTo(17, (_local2 * _local5));
_local6.graphics.lineTo(17, ((_local2 + 1) * _local5));
_local3.size = 11;
_local3.bold = true;
_local3.align = "center";
_local1 = new TextField();
if (_local2 > 0){
_local1.text = String(_local2);
txtHighs[(_local2 - 1)] = {name:TextField, score:TextField, lvl:TextField};
} else {
_local1.text = "#";
};
_local1.selectable = false;
_local1.setTextFormat(_local3);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = 17;
_local1.height = _local5;
_local1.x = 1;
_local1.y = ((_local2 * _local5) + 3);
_local7.addChild(_local1);
_local6.graphics.lineStyle(1, 0xBBBBBB);
_local6.graphics.moveTo(17, ((_local2 * _local5) + (_local5 / 2)));
_local6.graphics.lineTo(_local4, ((_local2 * _local5) + (_local5 / 2)));
_local3.size = 10;
_local3.bold = false;
_local3.align = "left";
_local1 = new TextField();
if (_local2 > 0){
_local1.text = "";
txtHighs[(_local2 - 1)].name = _local1;
} else {
_local1.text = "NAME";
};
_local1.selectable = false;
_local1.setTextFormat(_local3);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.textColor = 0xFFFFFF;
_local1.width = (_local4 - 17);
_local1.height = _local5;
_local1.x = 18;
_local1.y = ((_local2 * _local5) - 2);
_local7.addChild(_local1);
_local3.align = "center";
_local1 = new TextField();
if (_local2 > 0){
_local1.text = "";
txtHighs[(_local2 - 1)].score = _local1;
} else {
_local1.text = "SCORE";
};
_local1.selectable = false;
_local1.setTextFormat(_local3);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.textColor = 0xFFFFFF;
_local1.width = ((_local4 - 17) - 20);
_local1.height = _local5;
_local1.x = 17;
_local1.y = (((_local2 * _local5) - 3) + (_local5 / 2));
_local7.addChild(_local1);
_local1 = new TextField();
if (_local2 > 0){
_local1.text = "";
txtHighs[(_local2 - 1)].lvl = _local1;
} else {
_local1.text = "LV";
};
_local1.selectable = false;
_local1.setTextFormat(_local3);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.textColor = 0xFFFFFF;
_local1.width = 20;
_local1.height = _local5;
_local1.x = (_local4 - 19);
_local1.y = (((_local2 * _local5) - 3) + (_local5 / 2));
_local7.addChild(_local1);
_local6.graphics.moveTo((_local4 - 20), ((_local2 * _local5) + (_local5 / 2)));
_local6.graphics.lineTo((_local4 - 20), ((_local2 * _local5) + _local5));
_local2++;
};
_local6.filters = [new BevelFilter(2)];
_local7.addChild(_local6);
_local7.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local6.width) / 2));
_local7.y = 32;
highscore.addChild(_local7);
_local3.size = 14;
_local3.bold = true;
_local1 = new TextField();
_local1.text = "Back to Menu";
_local1.selectable = false;
_local1.setTextFormat(_local3);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = (((ARENA_HEIGHT * BLOCK_PIXEL) - _local1.textHeight) - 5);
_local1.addEventListener(MouseEvent.CLICK, highMenu);
_local1.addEventListener(MouseEvent.ROLL_OVER, roll2);
_local1.addEventListener(MouseEvent.ROLL_OUT, out2);
highscore.addChild(_local1);
}
private function drawCredit():void{
var _local1:uint;
var _local2:uint;
var _local3:TextField;
var _local4:String;
var _local5:TextFormat;
_local4 = "CREDITS";
_local5 = new TextFormat();
_local5.color = 0xFFFFFF;
_local5.bold = true;
_local5.size = 18;
txtCredit = new Array(_local4.length);
_local1 = 0;
while (_local1 < _local4.length) {
_local3 = new TextField();
_local3.text = _local4.charAt(_local1);
_local3.selectable = false;
_local3.x = ((BLOCK_PIXEL + ((ARENA_WIDTH * BLOCK_PIXEL) * (_local1 / _local4.length))) + 5);
_local3.setTextFormat(_local5);
_local3.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local3.width = (_local3.textWidth + 3);
_local3.height = (_local3.textHeight + 3);
credit2.addChild(_local3);
txtCredit[_local1] = _local3;
_local1++;
};
_local5.bold = false;
_local5.size = 12;
_local3 = new TextField();
_local3.text = "Programming\n& Graphics by\n Jean-Denus Boivin\n\nBackground by\n Antti Kupila\n www.anttikupila.com\n\n\nMusic :\nPowered by AtemiS-Player\n\nMenu\nBubble toast Win by Rez\n\nGameOver\nThe Church by Hydra\n\nCredit\nCardiaxx Pause by 4mat\n\nHighScores\nMy little hero by Pink\n\nMusic 1\nTetris by Jean-Denis Boivin\n\nMusic 2\nTinytune 2 by Rez\n\nMusic 3\nArkanoid by Dreamfish\n\nMusic 4\nIce Cap by R2\n\nMusic 5\nSimply Short by Rez\n\n\nSound Effect by\n FlashKit.com\n\n\nStats by\n MochiBot.com\n\n\nSpecial Thanks\n Pier-jean Lizotte\n Jean-Bastien Laflamme\n\n\n\n jeandenis.boivin@gmail\n www.Team-AtemiS.com/\n\n\n (c) 2007 Team AtemiS ";
_local3.selectable = false;
_local3.x = (BLOCK_PIXEL + 1);
_local3.y = 115;
_local3.setTextFormat(_local5);
_local3.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local3.width = (ARENA_WIDTH * BLOCK_PIXEL);
_local3.height = (_local3.textHeight + 5);
credit2.addChild(_local3);
credit.addChild(credit2);
_local5.size = 14;
_local5.bold = true;
_local3 = new TextField();
_local3.text = "Back to Menu";
_local3.selectable = false;
_local3.setTextFormat(_local5);
_local3.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local3.width = (_local3.textWidth + 5);
_local3.height = (_local3.textHeight + 5);
_local3.x = (BLOCK_PIXEL + 1);
_local3.y = 1;
_local3.addEventListener(MouseEvent.CLICK, creditMenu);
_local3.addEventListener(MouseEvent.ROLL_OVER, roll2);
_local3.addEventListener(MouseEvent.ROLL_OUT, out2);
credit.addChild(_local3);
}
private function blockUPA():void{
if (control){
if (sound){
rotate_snd.play(100);
};
blockLST = blockDegree;
blockDegree--;
if (blockDegree < 0){
blockDegree = (DEGREE_MAX - 1);
};
showPiece();
checkCollision(false);
blockLST = blockDegree;
};
}
private function main_loop(_arg1:Event):void{
var _local2:uint;
_local2 = level;
if (_local2 > MAX_T_LEVEL){
_local2 = MAX_T_LEVEL;
};
blockDOWN();
Timer(_arg1.target).delay = ((SPEED[_local2] / NES_FRAME) * 1000);
}
private function afficheMenu(_arg1:Event):void{
menu.alpha = (menu.alpha + 0.02);
if (menu.alpha >= 1){
menu.alpha = 1;
removeEventListener(Event.ENTER_FRAME, afficheMenu);
};
}
private function blockUP2(_arg1:TimerEvent):void{
if (Timer(_arg1.target).currentCount == 1){
Timer(_arg1.target).delay = ((DAS2 / NES_FRAME) * 1000);
};
blockUP();
}
private function blockRIGHT():void{
if (control){
blockBMP.x = (blockBMP.x + BLOCK_PIXEL);
checkCollision(false);
};
}
private function kill_menu():void{
var _local1:Timer;
if (sound){
press_snd.play(100);
};
menuBMP.bitmapData = arenaMSK.bitmapData.clone();
menuBMP.bitmapData.draw(menu, null, null, "normal");
removeEventListener(Event.ENTER_FRAME, animeMenu);
menu.visible = false;
_local1 = new Timer(75);
_local1.addEventListener("timer", effaceMenu);
_local1.start();
}
private function clear_music():void{
var _local1:uint;
_local1 = 0;
while (_local1 < musicBtn.length) {
musicBtn[_local1].textColor = 0xFFFFFF;
_local1++;
};
}
private function kill_Pause():void{
var _local1:Timer;
if (sound){
press_snd.play(100);
};
pauseBMP.bitmapData = arenaMSK.bitmapData.clone();
pauseBMP.bitmapData.draw(pause, null, null, "normal");
removeEventListener(Event.ENTER_FRAME, animePause);
pause.visible = false;
_local1 = new Timer(75);
_local1.addEventListener("timer", effacePause);
_local1.start();
}
private function gotoAtemiS(_arg1:Event):void{
navigateToURL(new URLRequest("http://www.team-atemis.com/"), "_blank");
}
private function drawStats():Sprite{
var _local1:Sprite;
var _local2:TextField;
var _local3:uint;
var _local4:Rectangle;
var _local5:TextFormat;
_local1 = new Sprite();
_local5 = new TextFormat();
_local5.bold = true;
_local5.size = 14;
_local1.filters = [new DropShadowFilter(0)];
_local2 = new TextField();
_local2.text = "Tetris 64k";
_local2.height = (_local2.textHeight + 5);
_local2.selectable = false;
_local2.textColor = 0xFFFFFF;
_local2.filters = [new DropShadowFilter(0)];
_local2.setTextFormat(_local5);
_local2.x = ((statsBMP.width - _local2.textWidth) - 5);
_local1.addChild(_local2);
_local5.size = 12;
_local2 = new TextField();
_local2.text = "Next :";
_local2.height = (_local2.textHeight + 5);
_local2.selectable = false;
_local2.textColor = 0xFFFFFF;
_local2.setTextFormat(_local5);
_local2.x = 5;
_local2.y = 30;
_local1.addChild(_local2);
_local4 = new Rectangle(((statsBMP.width / 2) - ((BLOCK_PIXEL * BLOCK_WIDTH) / 2)), ((30 + _local2.textHeight) + 5), ((BLOCK_PIXEL * BLOCK_WIDTH) + 2), ((BLOCK_PIXEL * BLOCK_HEIGHT) + 2));
_local1.graphics.lineStyle(2, 0xFFFFFF);
_local1.graphics.drawRect((_local4.x - 1), _local4.y, _local4.width, _local4.height);
nextBMP.x = _local4.x;
nextBMP.y = _local4.y;
_local1.addChild(nextBMP);
_local2 = new TextField();
_local2.text = "Level";
_local2.height = (_local2.textHeight + 5);
_local2.selectable = false;
_local2.textColor = 0xFFFFFF;
_local2.setTextFormat(_local5);
_local2.x = 5;
_local2.y = (((BLOCK_PIXEL * BLOCK_HEIGHT) + 45) + _local2.textHeight);
_local1.addChild(_local2);
txtLevel = new TextField();
txtLevel.text = "00";
txtLevel.height = (_local2.textHeight + 5);
txtLevel.selectable = false;
txtLevel.textColor = 0xFFFFFF;
txtLevel.setTextFormat(_local5);
txtLevel.x = ((statsBMP.width - 5) - txtLevel.textWidth);
txtLevel.y = (((BLOCK_PIXEL * BLOCK_HEIGHT) + 45) + (_local2.textHeight * 2));
_local1.addChild(txtLevel);
_local2 = new TextField();
_local2.text = "Lines";
_local2.height = (_local2.textHeight + 5);
_local2.selectable = false;
_local2.textColor = 0xFFFFFF;
_local2.setTextFormat(_local5);
_local2.x = 5;
_local2.y = (((BLOCK_PIXEL * BLOCK_HEIGHT) + 45) + (_local2.textHeight * 3));
_local1.addChild(_local2);
txtLines = new TextField();
txtLines.text = "000";
txtLines.height = (_local2.textHeight + 5);
txtLines.selectable = false;
txtLines.textColor = 0xFFFFFF;
txtLines.setTextFormat(_local5);
txtLines.x = ((statsBMP.width - 5) - txtLines.textWidth);
txtLines.y = (((BLOCK_PIXEL * BLOCK_HEIGHT) + 45) + (_local2.textHeight * 4));
_local1.addChild(txtLines);
_local2 = new TextField();
_local2.text = "Points";
_local2.height = (_local2.textHeight + 5);
_local2.selectable = false;
_local2.textColor = 0xFFFFFF;
_local2.setTextFormat(_local5);
_local2.x = 5;
_local2.y = (((BLOCK_PIXEL * BLOCK_HEIGHT) + 45) + (_local2.textHeight * 5));
_local1.addChild(_local2);
txtPoints = new TextField();
txtPoints.text = "00000000";
txtPoints.height = (_local2.textHeight + 5);
txtPoints.selectable = false;
txtPoints.textColor = 0xFFFFFF;
txtPoints.setTextFormat(_local5);
txtPoints.x = ((statsBMP.width - 5) - txtPoints.textWidth);
txtPoints.y = (((BLOCK_PIXEL * BLOCK_HEIGHT) + 45) + (_local2.textHeight * 6));
_local1.addChild(txtPoints);
_local2 = new TextField();
_local2.text = "Background";
_local2.height = (_local2.textHeight + 5);
_local2.selectable = false;
_local2.textColor = 0xFFFFFF;
_local2.setTextFormat(_local5);
_local2.x = 5;
_local2.y = (((statsBMP.height - 5) - (_local2.textHeight * 3)) - 11);
_local1.addChild(_local2);
_local1.graphics.lineStyle(1, 0x888888);
_local1.graphics.moveTo(7, (_local2.y - 1));
_local1.graphics.lineTo((statsBMP.width - 7), (_local2.y - 1));
backBtn = new Array(5);
_local3 = 0;
while (_local3 < 5) {
_local2 = new TextField();
_local2.text = String((_local3 + 1));
_local2.width = (_local2.textWidth + 5);
_local2.height = (_local2.textHeight + 5);
_local2.selectable = false;
_local2.textColor = 0xFFFFFF;
_local2.filters = [new DropShadowFilter(0)];
_local2.setTextFormat(_local5);
_local2.x = (5 + (_local3 * (statsBMP.width / 5)));
_local2.y = (((statsBMP.height - 5) - (_local2.textHeight * 2)) - 10);
_local2.addEventListener(MouseEvent.CLICK, change_background);
_local2.addEventListener(MouseEvent.ROLL_OVER, roll);
_local2.addEventListener(MouseEvent.ROLL_OUT, out);
backBtn[_local3] = _local2;
_local1.addChild(_local2);
_local3++;
};
_local5.size = 12;
_local2 = new TextField();
_local2.text = "Music";
_local2.height = (_local2.textHeight + 5);
_local2.selectable = false;
_local2.textColor = 0xFFFFFF;
_local2.setTextFormat(_local5);
_local2.x = 5;
_local2.y = (((statsBMP.height - 5) - (_local2.textHeight * 5)) - 19);
_local1.addChild(_local2);
musicBtn = new Array(5);
_local3 = 0;
while (_local3 < 5) {
_local2 = new TextField();
_local2.text = String((_local3 + 1));
_local2.width = (_local2.textWidth + 5);
_local2.height = (_local2.textHeight + 5);
_local2.selectable = false;
_local2.textColor = 0xFFFFFF;
_local2.filters = [new DropShadowFilter(0)];
_local2.setTextFormat(_local5);
_local2.x = (5 + (_local3 * (statsBMP.width / 5)));
_local2.y = (((statsBMP.height - 5) - (_local2.textHeight * 4)) - 18);
_local2.addEventListener(MouseEvent.CLICK, change_music);
_local2.addEventListener(MouseEvent.ROLL_OVER, roll);
_local2.addEventListener(MouseEvent.ROLL_OUT, out);
musicBtn[_local3] = _local2;
_local1.addChild(_local2);
_local3++;
};
_local5.size = 11;
_local5.bold = false;
_local5.align = "center";
_local2 = new TextField();
_local2.text = "Team-AtemiS.com";
_local2.height = (_local2.textHeight + 5);
_local2.width = statsBMP.width;
_local2.selectable = false;
_local2.textColor = 0xFFFFFF;
_local2.filters = [new DropShadowFilter(0)];
_local2.setTextFormat(_local5);
_local2.y = ((statsBMP.height - 5) - _local2.textHeight);
_local2.addEventListener(MouseEvent.CLICK, gotoAtemiS);
_local2.addEventListener(MouseEvent.ROLL_OVER, roll2);
_local2.addEventListener(MouseEvent.ROLL_OUT, out2);
_local1.addChild(_local2);
return (_local1);
}
private function init_highscore():void{
var _local1:URLLoader;
highscore.visible = true;
highscore.alpha = 0;
highscoreI = 0;
tunnel.color = TUNNEL_HIGH;
currMusic = HIGH_MUSIC;
if (music){
player = new AtemiS_Player_LITE(HIGH_MUSIC);
player.play(0, 0);
};
reset_score();
tunnel.vitesse = 0.02;
_local1 = new URLLoader(new URLRequest(("http://www.clubdubeau.com/team-atemis/tetris64k/highscore.xml?cache=" + getTimer().toString())));
_local1.addEventListener("complete", update_score);
addEventListener(Event.ENTER_FRAME, afficheHighscore);
addEventListener(Event.ENTER_FRAME, animeHighscore);
}
private function init_game():void{
var _local1:uint;
arenaBMP.bitmapData = arenaMSK.bitmapData.clone();
play2 = true;
lstLevel = 0;
level = sel_level;
lines = 0;
points = 0;
maxy = 0;
nextID = uint((Math.random() * BLOCK.length));
newBlock();
musicBtn[0].textColor = 0x888888;
backBtn[0].textColor = 0x888888;
down_timer.delay = ((SPEED[_local1] / NES_FRAME) * 1000);
init_game2();
_local1 = level;
if (_local1 > MAX_T_LEVEL){
_local1 = MAX_T_LEVEL;
};
check_background(0);
check_music(0);
update_lines();
update_level();
}
private function option_music(_arg1:Event):void{
if (sound){
press_snd.play(100);
};
if (TextField(_arg1.target).textColor == 0x888888){
TextField(_arg1.target).textColor = 0xFFFFFF;
music = false;
player.stop();
} else {
TextField(_arg1.target).textColor = 0x888888;
music = true;
player = new AtemiS_Player_LITE(currMusic);
player.play(0, 0);
};
}
private function animeHelp(_arg1:Event):void{
helpI = (helpI + 0.1);
txtHelp.alpha = ((Math.cos(helpI) * 0.2) + 0.8);
}
private function animePause(_arg1:Event):void{
pauseI = (pauseI + 0.35);
txtPause.x = (((Math.cos(pauseI) * 20) + BLOCK_PIXEL) + (((ARENA_WIDTH * BLOCK_PIXEL) - txtPause.textWidth) / 2));
}
private function erase_line(_arg1:Event):void{
var _local2:uint;
var _local3:Timer;
_local2 = 0;
while (_local2 < line_test.length) {
arenaBMP.bitmapData.fillRect(new Rectangle(((BLOCK_PIXEL * 5) - ((Timer(_arg1.target).currentCount - 1) * BLOCK_PIXEL)), line_test[_local2], BLOCK_PIXEL, BLOCK_PIXEL), 0);
arenaBMP.bitmapData.fillRect(new Rectangle(((BLOCK_PIXEL * 6) + ((Timer(_arg1.target).currentCount - 1) * BLOCK_PIXEL)), line_test[_local2], BLOCK_PIXEL, BLOCK_PIXEL), 0);
_local2++;
};
if (line_test.length == 4){
if ((Timer(_arg1.target).currentCount % 2) == 0){
arenaBMP.visible = true;
} else {
arenaBMP.visible = false;
};
};
if (Timer(_arg1.target).currentCount == 5){
Timer(_arg1.target).stop();
arenaBMP.visible = true;
arrange_line();
_local3 = new Timer(((ARE / NES_FRAME) * 1000), 1);
_local3.addEventListener(TimerEvent.TIMER, newBlock2);
_local3.start();
};
}
private function showPiece():void{
blockBMP.bitmapData = drawPiece(BLOCK[blockID], blockDegree);
blockBMP.bitmapData.applyFilter(blockBMP.bitmapData, blockBMP.bitmapData.rect, new Point(0, 0), new BevelFilter(2));
}
private function option_musict(_arg1:Event):void{
if (sound){
press_snd.play(100);
};
if (TextField(_arg1.target).textColor == 0x888888){
TextField(_arg1.target).textColor = 0xFFFFFF;
musict = false;
} else {
TextField(_arg1.target).textColor = 0x888888;
musict = true;
};
}
private function blockUPA2(_arg1:TimerEvent):void{
if (Timer(_arg1.target).currentCount == 1){
Timer(_arg1.target).delay = ((DAS2 / NES_FRAME) * 1000);
};
blockUPA();
}
private function init_pause(_arg1:Event):void{
killGame();
nextBMP.visible = true;
init_pause2();
}
private function animeOption(_arg1:Event):void{
optionI = (optionI + 0.1);
txtOption.alpha = ((Math.cos(optionI) * 0.2) + 0.8);
}
private function pauseOption(_arg1:Event):void{
kill_Pause();
init_option();
}
private function effacePause(_arg1:TimerEvent):void{
efface(_arg1, pauseBMP);
}
private function blockLEFT():void{
if (control){
blockBMP.x = (blockBMP.x - BLOCK_PIXEL);
checkCollision(false);
};
}
private function highMenu(_arg1:Event):void{
kill_highscore();
init_menu();
}
private function change_music2(_arg1:Class, _arg2:Number):void{
player.stop();
currMusic = _arg1;
if (music){
player = new AtemiS_Player_LITE(_arg1);
player.OVolume = _arg2;
};
if (tempo){
updateTPD();
};
player.play(0, 0);
}
private function option_fps(_arg1:Event):void{
if (sound){
press_snd.play(100);
};
if (TextField(_arg1.target).textColor == 0x888888){
TextField(_arg1.target).textColor = 0xFFFFFF;
frame.visible = false;
} else {
TextField(_arg1.target).textColor = 0x888888;
frame.visible = true;
};
}
private function change_level(_arg1:Event):void{
press_snd.play(100);
clear_levels();
sel_level = uint(TextField(_arg1.target).text);
TextField(_arg1.target).textColor = 0x888888;
}
private function gameover_menu(_arg1:Event):void{
kill_GameOver();
init_menu();
}
private function effaceBackground(_arg1:TimerEvent):void{
efface(_arg1, arenaBMP2);
}
private function removeBEVEL(_arg1:BitmapData, _arg2:uint):void{
var _local3:uint;
_local3 = 0;
while (_local3 < ARENA_WIDTH) {
_arg1.fillRect(new Rectangle((BLOCK_PIXEL * _local3), _arg2, BLOCK_PIXEL, 4), _arg1.getPixel32(((BLOCK_PIXEL * _local3) + (BLOCK_PIXEL / 2)), (BLOCK_PIXEL / 2)));
_local3++;
};
}
private function send_highscore(_arg1:Event):void{
var _local2:URLLoader;
var _local3:TextFormat;
_local2 = new URLLoader(new URLRequest(("http://www.clubdubeau.com/team-atemis/tetris64k/highscore.xml?cache=" + getTimer().toString())));
_local2.addEventListener("complete", send_highscore2);
_local3 = new TextFormat();
_local3.color = 0xFFFFFF;
_local3.bold = true;
_local3.align = "center";
_local3.size = 12;
txt_sendHighscore.text = "Please wait...";
txt_sendHighscore.setTextFormat(_local3);
txtName.type = TextFieldType.DYNAMIC;
txt_sendHighscore.removeEventListener(MouseEvent.CLICK, send_highscore);
txt_sendHighscore.removeEventListener(MouseEvent.ROLL_OVER, roll2);
txt_sendHighscore.removeEventListener(MouseEvent.ROLL_OUT, out2);
}
private function pauseHelp(_arg1:Event):void{
kill_Pause();
initHelp();
}
private function efface(_arg1:TimerEvent, _arg2:Bitmap):void{
_arg2.bitmapData.lock();
_arg2.bitmapData.scroll(0, 1);
_arg2.bitmapData.merge(dark, _arg2.bitmapData.rect, new Point(0, 0), 0, 0, 0, 10);
_arg2.bitmapData.applyFilter(_arg2.bitmapData, _arg2.bitmapData.rect, new Point(0, 0), new BlurFilter(2, 2, 2));
_arg2.bitmapData.unlock();
if (_arg2.bitmapData.getPixel32(0, 0) == 0){
Timer(_arg1.target).stop();
};
}
private function option_back(_arg1:Event):void{
if (sound){
press_snd.play(100);
};
if (TextField(_arg1.target).textColor == 0x888888){
TextField(_arg1.target).textColor = 0xFFFFFF;
back = false;
background.visible = false;
} else {
TextField(_arg1.target).textColor = 0x888888;
back = true;
background.visible = true;
};
}
private function afficheOption(_arg1:Event):void{
option.alpha = (option.alpha + 0.02);
if (option.alpha >= 1){
option.alpha = 1;
removeEventListener(Event.ENTER_FRAME, afficheOption);
};
}
private function kill_highscore():void{
var _local1:Timer;
if (sound){
press_snd.play(100);
};
highscoreBMP.bitmapData = arenaMSK.bitmapData.clone();
highscoreBMP.bitmapData.draw(highscore, null, null, "normal");
removeEventListener(Event.ENTER_FRAME, animeHighscore);
highscore.visible = false;
player.stop();
_local1 = new Timer(75);
_local1.addEventListener("timer", effaceHighscore);
_local1.start();
}
private function key_control_up(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == Keyboard.LEFT)) || ((_arg1.keyCode == 65)))){
if (left){
left = false;
leftTimer.stop();
};
};
if ((((_arg1.keyCode == Keyboard.RIGHT)) || ((_arg1.keyCode == 68)))){
if (right){
right = false;
rightTimer.stop();
};
};
if ((((((((((((((_arg1.keyCode == Keyboard.UP)) || ((_arg1.keyCode == 90)))) || ((_arg1.keyCode == 88)))) || ((_arg1.keyCode == 87)))) || ((_arg1.keyCode == Keyboard.SPACE)))) || ((_arg1.keyCode == 190)))) || ((_arg1.keyCode == 191)))){
if (up){
up = false;
upTimer.stop();
};
};
if ((((_arg1.keyCode == Keyboard.DOWN)) || ((_arg1.keyCode == 83)))){
if (down){
down = false;
down_timer.start();
downTimer.stop();
};
};
}
private function init_game2():void{
playing = true;
up = false;
down = false;
left = false;
right = false;
control = true;
blockBMP.visible = true;
nextBMP.visible = true;
arenaBMP.visible = true;
arenaBMP2.visible = false;
arenaBMP.alpha = 0;
blockBMP.alpha = 0;
addEventListener(Event.ENTER_FRAME, afficheGame);
down_timer.start();
stage.addEventListener(KeyboardEvent.KEY_DOWN, key_control_down);
stage.addEventListener(KeyboardEvent.KEY_UP, key_control_up);
}
private function restartGame(_arg1:Event):void{
kill_GameOver();
init_game();
}
private function out2(_arg1:Event):void{
TextField(_arg1.currentTarget).filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
TextField(_arg1.currentTarget).textColor = 0xFFFFFF;
}
private function drawHelp():void{
var _local1:TextField;
var _local2:TextFormat;
_local2 = new TextFormat();
_local2.color = 0xFFFFFF;
_local2.bold = true;
_local2.size = 18;
_local1 = new TextField();
_local1.text = "H E L P";
_local1.selectable = false;
_local1.setTextFormat(_local2);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = 25;
txtHelp = _local1;
help.addChild(_local1);
_local2.size = 11;
_local2.bold = false;
_local1 = new TextField();
_local1.text = "Move Piece :\n Left : Left Arrow, A\n Right : Right Arrow, D\n Down : Down Arrow, S\n\nRotate Clockwise :\n Up Arrow, W, Space, X, /\n\nRotate Counterclockwise :\n Z, .\n\nPause :\n Escape, P\n ";
_local1.selectable = false;
_local1.setTextFormat(_local2);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.x = (BLOCK_PIXEL + 2);
_local1.y = 70;
_local1.width = (_local1.textWidth + 3);
_local1.height = (_local1.textHeight + 3);
help.addChild(_local1);
_local2.size = 14;
_local2.bold = true;
_local1 = new TextField();
_local1.text = "Back";
_local1.selectable = false;
_local1.setTextFormat(_local2);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = (((ARENA_HEIGHT * BLOCK_PIXEL) - _local1.textHeight) - 15);
_local1.addEventListener(MouseEvent.CLICK, helpBack);
_local1.addEventListener(MouseEvent.ROLL_OVER, roll2);
_local1.addEventListener(MouseEvent.ROLL_OUT, out2);
help.addChild(_local1);
}
private function init_option():void{
option.visible = true;
option.alpha = 0;
optionI = 0;
addEventListener(Event.ENTER_FRAME, afficheOption);
addEventListener(Event.ENTER_FRAME, animeOption);
}
private function launch_option(_arg1:Event):void{
kill_menu();
init_option();
}
private function blockDOWN():void{
if (control){
blockBMP.y = (blockBMP.y + BLOCK_PIXEL);
checkCollision(true);
};
}
private function init_menu2():void{
menu.visible = true;
menu.alpha = 0;
menuI = 0;
tunnel.color = TUNNEL_MENU;
level = 0;
lines = 0;
points = 0;
sel_level = 0;
clear_level();
txtLevels[0].textColor = 0x888888;
update_lines();
addEventListener(Event.ENTER_FRAME, animeMenu);
addEventListener(Event.ENTER_FRAME, afficheMenu);
}
private function option_tempo(_arg1:Event):void{
if (sound){
press_snd.play(100);
};
if (TextField(_arg1.target).textColor == 0x888888){
TextField(_arg1.target).textColor = 0xFFFFFF;
tempo = false;
player.multBPM = 1;
} else {
TextField(_arg1.target).textColor = 0x888888;
tempo = true;
updateTPD();
};
}
private function __com_mochibot__(_arg1:String, _arg2:MovieClip, _arg3:uint, _arg4:Boolean):void{
var _local5:String;
var _local6:uint;
var _local7:Loader;
var _local8:URLRequest;
_local5 = "mochibot.com";
_local6 = 9;
_local7 = new Loader();
_local8 = new URLRequest((((((((((((((("http://" + _local5) + "/my/core.swf?mv=7&fv=") + _local6) + "&v=") + escape(Capabilities.version)) + "&swfid=") + escape(_arg1)) + "&l=") + _arg3) + "&f=") + _arg2) + "&sb=") + Security.sandboxType) + (_arg4) ? "&t=1" : ""));
_local7.load(_local8);
}
private function drawOption():void{
var _local1:TextField;
var _local2:TextFormat;
_local2 = new TextFormat();
_local2.color = 0xFFFFFF;
_local2.bold = true;
_local2.size = 18;
_local1 = new TextField();
_local1.text = "O P T I O N S";
_local1.selectable = false;
_local1.setTextFormat(_local2);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = 25;
txtOption = _local1;
option.addChild(_local1);
_local2.size = 12;
_local2.color = 0x888888;
_local1 = new TextField();
_local1.text = "Music Transition";
_local1.selectable = false;
_local1.setTextFormat(_local2);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = 72;
_local1.addEventListener(MouseEvent.CLICK, option_musict);
_local1.addEventListener(MouseEvent.ROLL_OVER, roll3);
_local1.addEventListener(MouseEvent.ROLL_OUT, out);
_local1.textColor = 0x888888;
option.addChild(_local1);
_local1 = new TextField();
_local1.text = "Background Transition";
_local1.selectable = false;
_local1.setTextFormat(_local2);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = 92;
_local1.addEventListener(MouseEvent.CLICK, option_backt);
_local1.addEventListener(MouseEvent.ROLL_OVER, roll3);
_local1.addEventListener(MouseEvent.ROLL_OUT, out);
_local1.textColor = 0x888888;
option.addChild(_local1);
_local1 = new TextField();
_local1.text = "Music";
_local1.selectable = false;
_local1.setTextFormat(_local2);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = 122;
_local1.addEventListener(MouseEvent.CLICK, option_music);
_local1.addEventListener(MouseEvent.ROLL_OVER, roll3);
_local1.addEventListener(MouseEvent.ROLL_OUT, out);
_local1.textColor = 0x888888;
option.addChild(_local1);
_local1 = new TextField();
_local1.text = "Background";
_local1.selectable = false;
_local1.setTextFormat(_local2);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = 142;
_local1.addEventListener(MouseEvent.CLICK, option_back);
_local1.addEventListener(MouseEvent.ROLL_OVER, roll3);
_local1.addEventListener(MouseEvent.ROLL_OUT, out);
_local1.textColor = 0x888888;
option.addChild(_local1);
_local1 = new TextField();
_local1.text = "Music Tempo";
_local1.selectable = false;
_local1.setTextFormat(_local2);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = 172;
_local1.addEventListener(MouseEvent.CLICK, option_tempo);
_local1.addEventListener(MouseEvent.ROLL_OVER, roll3);
_local1.addEventListener(MouseEvent.ROLL_OUT, out);
_local1.textColor = 0x888888;
option.addChild(_local1);
_local2.color = 0xFFFFFF;
_local1 = new TextField();
_local1.text = "Sound Effect";
_local1.selectable = false;
_local1.setTextFormat(_local2);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = 202;
_local1.addEventListener(MouseEvent.CLICK, option_sound);
_local1.addEventListener(MouseEvent.ROLL_OVER, roll3);
_local1.addEventListener(MouseEvent.ROLL_OUT, out);
_local1.textColor = 0x888888;
option.addChild(_local1);
_local2.color = 0xFFFFFF;
_local1 = new TextField();
_local1.text = "FPS Counter";
_local1.selectable = false;
_local1.setTextFormat(_local2);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = 232;
_local1.addEventListener(MouseEvent.CLICK, option_fps);
_local1.addEventListener(MouseEvent.ROLL_OVER, roll3);
_local1.addEventListener(MouseEvent.ROLL_OUT, out);
_local1.textColor = 0xFFFFFF;
option.addChild(_local1);
_local2.size = 14;
_local1 = new TextField();
_local1.text = "Back";
_local1.selectable = false;
_local1.setTextFormat(_local2);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = (((ARENA_HEIGHT * BLOCK_PIXEL) - _local1.textHeight) - 15);
_local1.addEventListener(MouseEvent.CLICK, backOption);
_local1.addEventListener(MouseEvent.ROLL_OVER, roll2);
_local1.addEventListener(MouseEvent.ROLL_OUT, out2);
option.addChild(_local1);
}
private function newBlock():void{
var _local1:uint;
var _local2:uint;
blockBMP.x = START_X;
blockBMP.y = START_Y;
blockID = nextID;
nextID = uint((Math.random() * BLOCK.length));
blockDegree = 0;
blockLST = 0;
blockPTS = new Point(blockBMP.x, blockBMP.y);
maxy = 0;
_local1 = 0;
while (_local1 < ARENA_HEIGHT) {
_local2 = 0;
while (_local2 < ARENA_WIDTH) {
if (arenaBMP.bitmapData.getPixel32((BLOCK_PIXEL + (_local2 * BLOCK_PIXEL)), (_local1 * BLOCK_PIXEL)) >= 4278190080){
maxy = (ARENA_HEIGHT - _local1);
if (maxy < 10){
maxy = 1;
} else {
maxy = (maxy - 10);
};
break;
};
_local2++;
};
if (maxy != 0){
break;
};
_local1++;
};
if (maxy == 0){
maxy = 1;
};
updateTPD();
showPiece();
showNext();
checkCollision(true);
}
private function effaceHelp(_arg1:TimerEvent):void{
efface(_arg1, helpBMP);
}
private function pauseGame(_arg1:Event):void{
kill_Pause();
init_game2();
}
private function kill_Credit():void{
var _local1:Timer;
press_snd.play(100);
creditBMP.bitmapData = arenaMSK.bitmapData.clone();
creditBMP.bitmapData.draw(credit, null, null, "normal");
removeEventListener(Event.ENTER_FRAME, animeCredit);
credit.visible = false;
player.stop();
_local1 = new Timer(75);
_local1.addEventListener("timer", effaceCredit);
_local1.start();
}
private function effaceCredit(_arg1:TimerEvent):void{
efface(_arg1, creditBMP);
}
private function init_pause2():void{
pause.visible = true;
pause.alpha = 0;
pauseI = 0;
addEventListener(Event.ENTER_FRAME, affichePause);
addEventListener(Event.ENTER_FRAME, animePause);
}
private function checkCollision(_arg1:Boolean):void{
var _local2:Timer;
if (arenaBMP.bitmapData.hitTest(new Point(0, 0), 0xFF, blockBMP.bitmapData, new Point(blockBMP.x, blockBMP.y))){
if (_arg1){
update_points();
if (blockBMP.y == START_Y){
DIE();
} else {
putPiece();
check_line();
blockBMP.visible = false;
newBlock();
if (control){
control = false;
_local2 = new Timer(((ARE / NES_FRAME) * 1000), 1);
_local2.addEventListener(TimerEvent.TIMER, newBlock2);
_local2.start();
};
};
} else {
blockBMP.x = blockPTS.x;
blockBMP.y = blockPTS.y;
blockDegree = blockLST;
showPiece();
};
} else {
blockPTS = new Point(blockBMP.x, blockBMP.y);
};
}
private function init_menu():void{
currMusic = MENU_MUSIC;
if (music){
player = new AtemiS_Player_LITE(MENU_MUSIC);
player.play(0, 0);
};
play2 = false;
init_menu2();
tunnel.vitesse = 0.02;
player.multBPM = 1;
txtLevel.text = "";
if (level < 10){
txtLevel.appendText("0");
};
txtLevel.appendText(String(level));
}
private function newBlock2(_arg1:TimerEvent):void{
if (playing){
control = true;
blockBMP.visible = true;
};
}
private function clear_level():void{
var _local1:uint;
_local1 = 0;
while (_local1 < txtLevels.length) {
txtLevels[_local1].textColor = 0xFFFFFF;
_local1++;
};
}
private function drawPause():void{
var _local1:TextField;
var _local2:TextFormat;
_local2 = new TextFormat();
_local2.color = 0xFFFFFF;
_local2.bold = true;
_local2.size = 18;
_local1 = new TextField();
_local1.text = "P A U S E";
_local1.selectable = false;
_local1.setTextFormat(_local2);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = 40;
txtPause = _local1;
pause.addChild(_local1);
_local2.size = 13;
_local1 = new TextField();
_local1.text = "Help";
_local1.selectable = false;
_local1.setTextFormat(_local2);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = 130;
_local1.addEventListener(MouseEvent.CLICK, pauseHelp);
_local1.addEventListener(MouseEvent.ROLL_OVER, roll2);
_local1.addEventListener(MouseEvent.ROLL_OUT, out2);
pause.addChild(_local1);
_local1 = new TextField();
_local1.text = "Options";
_local1.selectable = false;
_local1.setTextFormat(_local2);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = 160;
_local1.addEventListener(MouseEvent.CLICK, pauseOption);
_local1.addEventListener(MouseEvent.ROLL_OVER, roll2);
_local1.addEventListener(MouseEvent.ROLL_OUT, out2);
pause.addChild(_local1);
_local1 = new TextField();
_local1.text = "Back to Game";
_local1.selectable = false;
_local1.setTextFormat(_local2);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = 190;
_local1.addEventListener(MouseEvent.CLICK, pauseGame);
_local1.addEventListener(MouseEvent.ROLL_OVER, roll2);
_local1.addEventListener(MouseEvent.ROLL_OUT, out2);
pause.addChild(_local1);
_local1 = new TextField();
_local1.text = "Back to Menu";
_local1.selectable = false;
_local1.setTextFormat(_local2);
_local1.filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
_local1.width = (_local1.textWidth + 5);
_local1.height = (_local1.textHeight + 5);
_local1.x = (BLOCK_PIXEL + (((ARENA_WIDTH * BLOCK_PIXEL) - _local1.textWidth) / 2));
_local1.y = 220;
_local1.addEventListener(MouseEvent.CLICK, pauseMenu);
_local1.addEventListener(MouseEvent.ROLL_OVER, roll2);
_local1.addEventListener(MouseEvent.ROLL_OUT, out2);
pause.addChild(_local1);
}
private function out(_arg1:Event):void{
TextField(_arg1.currentTarget).filters = [new DropShadowFilter(0, 45, 0, 1, 6, 6, 3)];
if (TextField(_arg1.currentTarget).textColor != 0x888888){
TextField(_arg1.currentTarget).textColor = 0xFFFFFF;
};
}
private function roll3(_arg1:Event):void{
if (sound){
ove.soundTransform.volume = 0;
ove = over_snd.play(100);
};
TextField(_arg1.currentTarget).filters = [new DropShadowFilter(0, 45, 0xFF, 1, 6, 6, 2)];
if (TextField(_arg1.currentTarget).textColor != 0x888888){
TextField(_arg1.currentTarget).textColor = 0xFF00;
};
}
private function afficheHelp(_arg1:Event):void{
help.alpha = (help.alpha + 0.02);
if (help.alpha >= 1){
help.alpha = 1;
removeEventListener(Event.ENTER_FRAME, afficheHelp);
};
}
private function roll2(_arg1:Event):void{
if (sound){
ove.soundTransform.volume = 0;
ove = over_snd.play(100);
};
TextField(_arg1.currentTarget).filters = [new DropShadowFilter(0, 45, 0xFF, 1, 6, 6, 2)];
TextField(_arg1.currentTarget).textColor = 0xFF00;
}
private function blockDOWN2(_arg1:TimerEvent):void{
if (Timer(_arg1.target).currentCount == 1){
Timer(_arg1.target).delay = (Timer(_arg1.target).delay / TIMER_DELAY);
};
if (control){
points++;
};
blockDOWN();
}
private function showNext():void{
nextBMP.bitmapData = drawPiece(BLOCK[nextID], 0);
nextBMP.bitmapData.applyFilter(nextBMP.bitmapData, nextBMP.bitmapData.rect, new Point(0, 0), new BevelFilter(2));
}
private function clear_back():void{
var _local1:uint;
_local1 = 0;
while (_local1 < backBtn.length) {
backBtn[_local1].textColor = 0xFFFFFF;
_local1++;
};
}
private function clear_levels():void{
var _local1:uint;
_local1 = 0;
while (_local1 < txtLevels.length) {
txtLevels[_local1].textColor = 0xFFFFFF;
_local1++;
};
}
private function update_score(_arg1:Event):void{
var _local2:XML;
var _local3:TextFormat;
var _local4:uint;
_local2 = XML(_arg1.target.data);
_local3 = new TextFormat();
_local3.color = 0xFFFFFF;
_local3.bold = false;
_local3.size = 10;
_local4 = 0;
while (_local4 < txtHighs.length) {
_local3.align = "left";
txtHighs[_local4].name.text = _local2.top[_local4].@name;
txtHighs[_local4].name.setTextFormat(_local3);
_local3.align = "center";
txtHighs[_local4].score.text = _local2.top[_local4].@score;
txtHighs[_local4].score.setTextFormat(_local3);
txtHighs[_local4].lvl.text = _local2.top[_local4].@level;
txtHighs[_local4].lvl.setTextFormat(_local3);
_local4++;
};
}
private function kill_Help():void{
var _local1:Timer;
press_snd.play(100);
helpBMP.bitmapData = arenaMSK.bitmapData.clone();
helpBMP.bitmapData.draw(help, null, null, "normal");
removeEventListener(Event.ENTER_FRAME, animeHelp);
help.visible = false;
_local1 = new Timer(75);
_local1.addEventListener("timer", effaceHelp);
_local1.start();
}
private function reset_score():void{
var _local1:TextFormat;
var _local2:uint;
_local1 = new TextFormat();
_local1.color = 0xFFFFFF;
_local1.bold = false;
_local1.size = 10;
_local2 = 0;
while (_local2 < txtHighs.length) {
_local1.align = "left";
txtHighs[_local2].name.text = "---";
txtHighs[_local2].name.setTextFormat(_local1);
_local1.align = "center";
txtHighs[_local2].score.text = "---";
txtHighs[_local2].score.setTextFormat(_local1);
txtHighs[_local2].lvl.text = "--";
txtHighs[_local2].lvl.setTextFormat(_local1);
_local2++;
};
}
private function kill_GameOver():void{
var _local1:Timer;
press_snd.play(100);
GameOverBMP.bitmapData = arenaMSK.bitmapData.clone();
GameOverBMP.bitmapData.draw(GameOver, null, null, "normal");
removeEventListener(Event.ENTER_FRAME, animeGameOver);
GameOver.visible = false;
player.stop();
_local1 = new Timer(75);
_local1.addEventListener("timer", effaceGameOver);
_local1.start();
}
private function helpBack(_arg1:Event):void{
kill_Help();
if (play2){
init_pause2();
} else {
init_menu2();
};
}
private function updateTPD():void{
var _local1:uint;
if (play2){
_local1 = level;
if (_local1 > MAX_T_LEVEL){
_local1 = MAX_T_LEVEL;
};
player.multBPM = (((2 * (_local1 / MAX_T_LEVEL)) + 0.6) + (1 * (maxy / 10)));
tunnel.vitesse = ((0.3 * (_local1 / MAX_T_LEVEL)) + 0.01);
};
}
private function animeMenu(_arg1:Event):void{
var _local2:uint;
menuI = (menuI + 0.35);
_local2 = 0;
while (_local2 < txtMenu.length) {
txtMenu[_local2].y = (((Math.cos((menuI + (0.8 * _local2))) * 25) + (BLOCK_PIXEL * 3)) - 10);
_local2++;
};
}
private function blockUP():void{
if (control){
if (sound){
rotate_snd.play(100);
};
blockLST = blockDegree;
blockDegree++;
if (blockDegree > (DEGREE_MAX - 1)){
blockDegree = 0;
};
showPiece();
checkCollision(false);
blockLST = blockDegree;
};
}
private function creditMenu(_arg1:Event):void{
kill_Credit();
init_menu();
}
}
}//package
Section 59
//TetrisJD2_arkanoid (TetrisJD2_arkanoid)
package {
import mx.core.*;
public class TetrisJD2_arkanoid extends ByteArrayAsset {
}
}//package
Section 60
//TetrisJD2_bubble_toast_win (TetrisJD2_bubble_toast_win)
package {
import mx.core.*;
public class TetrisJD2_bubble_toast_win extends ByteArrayAsset {
}
}//package
Section 61
//TetrisJD2_cardiaxx (TetrisJD2_cardiaxx)
package {
import mx.core.*;
public class TetrisJD2_cardiaxx extends ByteArrayAsset {
}
}//package
Section 62
//TetrisJD2_ecrase (TetrisJD2_ecrase)
package {
import mx.core.*;
public class TetrisJD2_ecrase extends SoundAsset {
}
}//package
Section 63
//TetrisJD2_fifiou (TetrisJD2_fifiou)
package {
import mx.core.*;
public class TetrisJD2_fifiou extends SoundAsset {
}
}//package
Section 64
//TetrisJD2_iceCap (TetrisJD2_iceCap)
package {
import mx.core.*;
public class TetrisJD2_iceCap extends ByteArrayAsset {
}
}//package
Section 65
//TetrisJD2_line (TetrisJD2_line)
package {
import mx.core.*;
public class TetrisJD2_line extends SoundAsset {
}
}//package
Section 66
//TetrisJD2_my_little_hero (TetrisJD2_my_little_hero)
package {
import mx.core.*;
public class TetrisJD2_my_little_hero extends ByteArrayAsset {
}
}//package
Section 67
//TetrisJD2_over (TetrisJD2_over)
package {
import mx.core.*;
public class TetrisJD2_over extends SoundAsset {
}
}//package
Section 68
//TetrisJD2_press (TetrisJD2_press)
package {
import mx.core.*;
public class TetrisJD2_press extends SoundAsset {
}
}//package
Section 69
//TetrisJD2_rotate (TetrisJD2_rotate)
package {
import mx.core.*;
public class TetrisJD2_rotate extends SoundAsset {
}
}//package
Section 70
//TetrisJD2_simply_short (TetrisJD2_simply_short)
package {
import mx.core.*;
public class TetrisJD2_simply_short extends ByteArrayAsset {
}
}//package
Section 71
//TetrisJD2_tetris (TetrisJD2_tetris)
package {
import mx.core.*;
public class TetrisJD2_tetris extends ByteArrayAsset {
}
}//package
Section 72
//TetrisJD2_the_church (TetrisJD2_the_church)
package {
import mx.core.*;
public class TetrisJD2_the_church extends ByteArrayAsset {
}
}//package
Section 73
//TetrisJD2_tinytune2 (TetrisJD2_tinytune2)
package {
import mx.core.*;
public class TetrisJD2_tinytune2 extends ByteArrayAsset {
}
}//package
Section 74
//Tunnel (Tunnel)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
import flash.media.*;
import flash.filters.*;
public class Tunnel {
private var gfx:BitmapData;
private var pic:Bitmap;
private var dir:int;
private var sc:SoundChannel;
private var gfx2:BitmapData;
public var vitesse:Number;// = 0.02
private var noiseMap:BitmapData;
public var color:uint;// = 39423
private var ___width:uint;
private var ___height:uint;
private var s:Sound;
private var noiseInt:Timer;
private var z:Number;// = 0
private var xPos:int;
private var ba:ByteArray;
public function Tunnel(_arg1:MovieClip, _arg2:Number, _arg3:Number){
s = new Sound();
sc = new SoundChannel();
ba = new ByteArray();
z = 0;
color = 39423;
vitesse = 0.02;
super();
___width = _arg2;
___height = _arg3;
gfx = new BitmapData(_arg2, _arg3, false, 0);
gfx2 = gfx.clone();
pic = new Bitmap(gfx);
_arg1.addChild(pic);
noiseMap = new BitmapData(_arg2, _arg3, false, 0xFFFFFF);
noiseInt = new Timer(2000, 0);
noiseInt.addEventListener(TimerEvent.TIMER, remapNoise);
noiseInt.start();
remapNoise(null);
_arg1.addEventListener(Event.ENTER_FRAME, processSpectrum);
}
private function remapNoise(_arg1:TimerEvent):void{
noiseMap.perlinNoise(100, 40, 3, (Math.random() * 100), false, true, 7, true);
}
private function processSpectrum(_arg1:Event):void{
var values:Array;
var l:Number;
var i:uint;
var trans:Matrix;
var scale:Number;
var offset:Number;
var blur:BlurFilter;
var displace:DisplacementMapFilter;
var ev = _arg1;
try {
if (ev.target.visible != false){
SoundMixer.computeSpectrum(ba, true, 0);
values = new Array();
i = 0;
while (i < 0x0200) {
l = ba.readFloat();
gfx.setPixel(((((Math.sin(((i / 0x0100) * Math.PI)) * 40) * l) + (Math.sin(z) * 40)) + (___width / 2)), ((((Math.cos(((i / 0x0100) * Math.PI)) * 40) * l) + (Math.cos(z) * 40)) + (___height / 2)), (color | ((l * 360) << 8)));
if (l > 0.5){
gfx.setPixel(((((((Math.sin(((i / 0x0100) * Math.PI)) * 40) * l) + (Math.sin(z) * 40)) + (___width / 2)) + (Math.random() * 10)) - 5), ((((((Math.cos(((i / 0x0100) * Math.PI)) * 40) * l) + (Math.cos(z) * 40)) + (___height / 2)) + (Math.random() * 10)) - 5), 0xFFFFFF);
};
i = (i + 1);
};
z = (z + vitesse);
trans = new Matrix();
scale = 1.1;
trans.scale(scale, scale);
offset = (-((scale - 1)) / 2);
trans.translate((offset * ___width), (offset * 0x0100));
gfx2.draw(gfx, trans);
gfx.draw(gfx2);
blur = new BlurFilter(3, 3);
gfx.applyFilter(gfx, new Rectangle(0, 0, ___width, ___height), new Point(0, 0), blur);
displace = new DisplacementMapFilter(noiseMap, new Point(0, 0), 1, 2, 20, 20);
displace.mode = "clamp";
gfx.applyFilter(gfx, new Rectangle(0, 0, ___width, ___height), new Point(0, 0), displace);
};
} catch(e:Error) {
};
}
}
}//package