/** * Copyright (c) 2006 Peter Goodman * Licensed under the MIT License: * http://www.opensource.org/licenses/mit-license.php */ class FA.evt_fns extends FA.query { public function bind(e:String, f:Function) : FA.query { return this.each(function(i){ this['on' + e] = f; }); } public function hover(h:Function, l) : FA.query { return this.each(function(i){ if (this instanceof MovieClip) { this.onRollOver = function() { if (this.hitTest(_root._xmouse, _root._ymouse, true)) { h.apply(this, []); } else { if(l != undefined) { l.apply(this, []); } } }; if (l != undefined) { this.onRollOut = l; } } }); } public function click(p:Function, r) : FA.query { return this.each(function(i){ if (this instanceof MovieClip) { this.onPress = p; if (r != undefined) { this.onRelease = r; } } }); } public function loader(l:Function, f:Function, fr) : FA.query { if (_d) { if (_framesloaded >= _totalframes) { if (f != undefined) { f.apply(null, []); } else { gotoAndPlay(fr || 1); } } else { var lb:Number = _root.getBytesLoaded(); var tb:Number = _root.getBytesTotal(); l.apply(null, [Math.ceil((lb / tb) * 100)]); } } return this; } }