home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
404 Jogos
/
CLJG.iso
/
Puzzle
/
filler.swf
/
scripts
/
mx
/
binding
/
BindingManager.as
< prev
next >
Wrap
Text File
|
2008-09-02
|
3KB
|
93 lines
package mx.binding
{
import mx.core.mx_internal;
use namespace mx_internal;
public class BindingManager
{
static var debugDestinationStrings:Object = {};
mx_internal static const VERSION:String = "2.0.1.0";
public function BindingManager()
{
super();
}
public static function executeBindings(param1:Object, param2:String, param3:Object) : void
{
var _loc4_:* = null;
if(!param2 || param2 == "")
{
return;
}
if(param1 && param1._bindingsByDestination && param1._bindingsBeginWithWord && param1._bindingsBeginWithWord[getFirstWord(param2)])
{
for(_loc4_ in param1._bindingsByDestination)
{
if(_loc4_.charAt(0) == param2.charAt(0))
{
if(_loc4_.indexOf(param2 + ".") == 0 || _loc4_.indexOf(param2 + "[") == 0 || _loc4_ == param2)
{
param1._bindingsByDestination[_loc4_].execute(param3);
}
}
}
}
}
public static function addBinding(param1:Object, param2:String, param3:Binding) : void
{
if(!param1._bindingsByDestination)
{
param1._bindingsByDestination = {};
param1._bindingsBeginWithWord = {};
}
param1._bindingsByDestination[param2] = param3;
param1._bindingsBeginWithWord[getFirstWord(param2)] = true;
}
public static function debugBinding(param1:String) : void
{
debugDestinationStrings[param1] = true;
}
private static function getFirstWord(param1:String) : String
{
var _loc2_:int = 0;
var _loc3_:int = 0;
var _loc4_:int = 0;
_loc2_ = param1.indexOf(".");
_loc3_ = param1.indexOf("[");
if(_loc2_ == _loc3_)
{
return param1;
}
if((_loc4_ = Math.min(_loc2_,_loc3_)) == -1)
{
_loc4_ = Math.max(_loc2_,_loc3_);
}
return param1.substr(0,_loc4_);
}
public static function getUIComponentWatcherForDestination(param1:Object, param2:String) : int
{
var _loc3_:* = null;
if(param1._bindingsByDestination)
{
for(_loc3_ in param1._bindingsByDestination)
{
if(_loc3_ == param2 && param1._bindingsByDestination[_loc3_].uiComponentWatcher != -1)
{
return param1._bindingsByDestination[_loc3_].uiComponentWatcher;
}
}
}
return -1;
}
}
}