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kZmZo[s([|Z[~f[~[[[[[ \*\rFA.ObservableEvent: /users/petergoodman/Sites/Flash/Categories/FA/ObservableEvent.asclass FA.ObservableEvent { public function getEventName() : String { return ''; } public function getMessage() : String { return ''; } }FA.build.draw_fns: /users/petergoodman/Sites/Flash/Categories/FA/build/draw_fns.as //-------------------------------------------- // Class to deal with drawing things. //-------------------------------------------- class FA.build.draw_fns extends FA.Query { private var info:Object; private var line_width:Number; private var line_color:Number; private var line_transparency:Number; private var fill_transparency:Number; //-------------------------------------------- // Draw a shape. //-------------------------------------------- public function draw(shape_info:Object) : FA.Query { var shape:String = shape_info.shape.toLowerCase(); if(typeof this[shape] == 'function' and _object instanceof MovieClip) { info = shape_info; line_width = info.lineWidth || 1; line_color = info.lineColor || 0x000000; line_transparency = info.lineAlpha || 100; fill_transparency = info.fillAlpha || 100; //-------------------------------------------- // Create the shape and deal with filling it in // if necessary. //-------------------------------------------- if(info.fillColor != undefined) { _object.beginFill(info.fillColor, fill_transparency); } _object.lineStyle(line_width, line_color, line_transparency); this[shape].apply(this, []); if(info.fillColor != undefined) { _object.endFill(); } } return this; } //-------------------------------------------- // Draw a circle. Format: // { // radius: 10, // _x: 100, // _y: 100 // } //-------------------------------------------- private function circle() : Void { var x:Number; var y:Number; var a:Number; for (a = 0; a <= 360; a++) { x = info._x + info.radius * Math.cos(a * Math.PI / 180); y = info._y + info.radius * Math.sin(a * Math.PI / 180); with (_object) { if (a == 0) { moveTo(x, y); } lineTo(x, y); } } } //-------------------------------------------- // Draw a rectangle. Format: // { // width: 100, // height: 100, // } //-------------------------------------------- private function rectangle() : Void { _object.moveTo(info._x, info._y); _object.lineTo(info.width, info._y); _object.lineTo(info.width, info.height); _object.lineTo(info._x, info.height); } //-------------------------------------------- // Draw a triangle. // { // a: [x, y], // left // b: [x, y], // right // _x: 100, // _y: 100 // } //-------------------------------------------- private function triangle() : Void { _object.moveTo(info._x, info._y); _object.lineTo(info.b[1], info.b[1]); // c _object.lineTo(info.a[0], info.a[1]); // a _object.lineTo(info._x, info._y); // b } }FA.Query: /users/petergoodman/Sites/Flash/Categories/FA/Query.as //-------------------------------------------- // Class for shortening code. //-------------------------------------------- dynamic class FA.Query extends FA.Dispatcher { //-------------------------------------------- // The main object that all of these functions // deals with. //-------------------------------------------- private var _object; //-------------------------------------------- // Is the object that we are using 'dirty'? // Meaning, are we actually able to work with it // or is it a string, number, or boolean? //-------------------------------------------- private var _is_dirty:Boolean = false; //-------------------------------------------- // A list of sub objects that this class has access // to. //-------------------------------------------- private var _sub_classes:Array = [ ]; //-------------------------------------------- // Constructor, pass whatever it is (z) that we // will be fooling around with, and if actually // is something that most functions can use (d) //-------------------------------------------- public function Query (object, is_dirty) { _object = object; _is_dirty = is_dirty; _sub_classes = FA.Globals.get('fa_query_subclasses'); } //-------------------------------------------- // Deal with the calling of functions that are not // in this class but in sub classes. //-------------------------------------------- public function __resolve(method_name) : Function { var return_val:Function; for(var i = 0; i < _sub_classes.length; i++) { if(typeof _sub_classes[i][method_name] == 'function') { var temp_function:Function = function() { return this._sub_classes[i][method_name].apply(this, arguments); }; //-------------------------------------------- // By putting this here, resolve will not need // to be called in the future. //-------------------------------------------- this[name] = temp_function; //-------------------------------------------- // return the temporary functor that we made. //-------------------------------------------- return_val = temp_function; break; } } //-------------------------------------------- // return the function. //-------------------------------------------- return return_val; } }FA.build.xml_fns: /users/petergoodman/Sites/Flash/Categories/FA/build/xml_fns.as //-------------------------------------------- // A class to deal with the XML aspects of AS // that the Query class can access. //-------------------------------------------- class FA.build.xml_fns extends FA.Query { //-------------------------------------------- // This is a two purpose function. The first purpose // is as an event handler for the onLoad event. In that // case a function is passed to it. The second purpose // is to trigger the onLoad event by passing a url / filename // (a string) to the XML.load function. (assuming we're // using XML) //-------------------------------------------- public function load (event_or_url, event_fail:Function) : FA.Query { if (_object instanceof XML) { if (typeof event_or_url == 'function') { _object.onLoad = function(success:Boolean) : Void { if(success) { event_or_url.apply(this,[success]); } else { if(event_fail) { event_fail.apply(this,[false]); } } }; /* this.addObserver(new LoadEventObserver(event_or_url)); if(event_fail) { this.addObserver(new FailedLoadEventObserver(event_fail)); } */ } else { /* var self:FA.Query = this; _object.onLoad = function(success:Boolean) { if(success) { self.notifyAll(new FA.event.LoadEvent()); } else { if(event_fail) { self.notifyAll(new FA.event.FailedLoadEvent()); } } }; _object.onData = function(xml_data:String) { }; */ _object.load(event_or_url); } } return this; } //-------------------------------------------- // An event handler for the onData event. The // parameter passed is the function that will be // called when data is received. //-------------------------------------------- public function data (event_handler:Function) : FA.Query { if (typeof _object.onData != undefined) { if (_object instanceof XML or _object instanceof XMLSocket) { _object.onData = event_handler; } } return this; } //-------------------------------------------- // An event handler for the onXML event. The // parameter passed is the function that will be // called when XML has been recieved or parsed // or whatever. :P //-------------------------------------------- public function xml (event_handler:Function) : FA.Query { if (_object instanceof XML or _object instanceof XMLSocket) { if (_object instanceof XMLSocket) { _object.onXML = event_handler; } } return this; } //-------------------------------------------- // Get or set a XML node attribute. //-------------------------------------------- public function attrib (attrib_key:String, attrib_value) { var ret = this; if (_object.attributes) { if (attrib_value != undefined) { _object.attributes[attrib_key] = attrib_value; } else { ret = _object.attributes[attrib_key]; } } else { } return ret; } //-------------------------------------------- // Close the connection with a socket. //-------------------------------------------- public function close() : FA.Query { if(_object instanceof XMLSocket) { _object.close(); } return this; } }-FA.observer.EnterFrameObserver: /users/petergoodman/Sites/Flash/Categories/FA/observer/EnterFrameObserver.as //-------------------------------------------- // An observer for the 'onEnterFrame' event. //-------------------------------------------- class FA.observer.EnterFrameObserver extends FA.Observer { private var frame_function:Function; private var object:MovieClip; public function EnterFrameObserver(_frame_function:Function, _object:MovieClip) { frame_function = _frame_function; object = _object; } //-------------------------------------------- // The observer's name. This is the same as the // Event's name as well. //-------------------------------------------- public function getObserverName() : String { return 'enterFrame'; } public function notify(event:FA.ObservableEvent) : Object { var finished:Boolean = frame_function.apply(object, []); return { leave: finished, // leave, stop observing after this is used. success: false // false to allow other observers to continue }; } }/FA.build.fn: /users/petergoodman/Sites/Flash/Categories/FA/build/fn.as //-------------------------------------------- // A class of generic functions used in the query // class. //-------------------------------------------- dynamic class FA.build.fn extends FA.Query { //-------------------------------------------- // Loop through an array or object and apply // a function to each loop. This also corrects // the functions scope so that whatever each row // of the loop is becomes 'this' //-------------------------------------------- public function each (loop_function:Function) : FA.Query { if (!_is_dirty and _object.length != undefined) { for (var row in _object) { loop_function.apply(_object[row], [row]) } } return this; } //-------------------------------------------- // A two purpose function. Set can either set a // single value by supplying both function parameters // (key and value). If only the first parameter is // received and it is a object, all of the methods in // that object will be set the the thing that we are // modifying. //-------------------------------------------- public function set (object_or_key, value) : FA.Query { if (!_is_dirty) { if (typeof object_or_key == 'object') { for (var property in object_or_key) { _object[property] = object_or_key[property]; } } else { _object[object_or_key] = value; } } return this; } //-------------------------------------------- // Simple get function. it will either try to // get a specific thing from what we are using, // if that doesn't exist and 0 is specified, than // it will return what we are modifying. //-------------------------------------------- public function get (key) { var wanted_value; if (key == undefined) { // return the object we are modifying wanted_value = _object; } else { if (_object[key] != undefined) { wanted_value = _object[key]; } else { // xml if(_object.attributes != undefined) { wanted_value = this.attrib(key); } } } return wanted_value; } //-------------------------------------------- // Bind a function to an event. To use this function, // supply a lower case version of the event name // without the 'on'. E.g.: supply 'data' for 'onData'. //-------------------------------------------- public function bind(event_name:String, event_function:Function) : FA.Query { event_name = 'on' + event_name.substr(0, 1).toUpperCase() + event_name.substr(1); _object[event_name] = event_function; return this; } //-------------------------------------------- // Clear all graphics made. //-------------------------------------------- public function clear() : FA.Query { if(_object instanceof MovieClip or _object instanceof Video) { _object.clear; } return this; } //-------------------------------------------- // Create a loader. This is used in the following // way: $.loader() //-------------------------------------------- public function loader(loader_function:Function, finished_function:Function) : FA.Query { if(_is_dirty) { if(_framesloaded >= _totalframes) { if(finished_function != undefined) { finished_function.apply(null, []); } else { gotoAndPlay(1); } } else { var loaded_bytes:Number = _root.getBytesLoaded(); var total_bytes:Number = _root.getBytesTotal(); loader_function.apply(null, [Math.ceil((loaded_bytes / total_bytes) * 100)]); } } return this; } //-------------------------------------------- // Manually create an event if it doesn't exist and // add the appropriate event dispatchers to it. //-------------------------------------------- private function createEvent(event_name:String, observable_event:FA.ObservableEvent, scope:MovieClip) { //-------------------------------------------- // Sometimes it's not actually the smartest thing // to do to bind an event to a movie clip so an // optional scope parameter can be used. E.g.: // if you are using an onEnterFrame event, it's // smarter to use _root instead of a sub movie clip. //-------------------------------------------- scope = scope || _object; //-------------------------------------------- // If this object is a movie clip, add observers // to its events. //-------------------------------------------- if(scope instanceof MovieClip and scope[event_name] == undefined) { var self:FA.Query = this; scope[event_name] = function() { self.notifyAll(this[event_name], observable_event); }; } } }/FA.Dispatcher: /users/petergoodman/Sites/Flash/Categories/FA/Dispatcher.as //-------------------------------------------- // Dispatcher class deals with notifying observers // of events taking place. //-------------------------------------------- class FA.Dispatcher { private var observers:Object = { }; //-------------------------------------------- // Add an observer. //-------------------------------------------- public function addObserver(observer:FA.Observer) : Void { if(observers[observer.getObserverName()] == undefined) { observers[observer.getObserverName()] = [ ]; } observers[observer.getObserverName()].push(observer); } //-------------------------------------------- // Notify all observers of an event that's taking // place. //-------------------------------------------- public function notifyAll(observing, event:FA.ObservableEvent) : Boolean { var success:Boolean = false; //-------------------------------------------- // If there are observers for this events. //-------------------------------------------- if(observers[event.getEventName()] != undefined) { var num_observers:Number = observers[event.getEventName()].length; if(num_observers > 0) { var result:Object; for(var i = 0; i < num_observers; i++) { result = observers[event.getEventName()][i].notify(event); //-------------------------------------------- // If this observer wants to remove itself once // finished, do so. //-------------------------------------------- if(result.leave) { delete observers[event.getEventName()][i]; observers[event.getEventName()].splice(i, 1); } if(result.success) { break; } } //-------------------------------------------- // The ugly solution to deleting events when all // of their observers cease to exist. //-------------------------------------------- if(observers[event.getEventName()].length == 0) { delete observing; } } } return success; } }{:FA.build.mc: /users/petergoodman/Sites/Flash/Categories/FA/build/mc.as //-------------------------------------------- // A class to deal with managing movie clips. //-------------------------------------------- class FA.build.mc extends FA.Query { //-------------------------------------------- // Recursively get the ancestry of a movie clip. // This function is private. //-------------------------------------------- private function recursiveGetObjectParent (some_objects) : String { var ancestry:String = ''; if(some_objects._parent != undefined and some_objects._parent instanceof MovieClip) { if(some_objects._parent._name != '') { ancestry += '.' + some_objects._parent._name; ancestry += this.recursiveGetObjectParent(some_objects._parent); } } return ancestry; } //-------------------------------------------- // Private function to cache the ancestry of a // movie clip. //-------------------------------------------- private function cacheMovieClip(movie_clip) { //-------------------------------------------- // Cache the route to this movie clip in the globals // singleton. //-------------------------------------------- var mc_clip_cache:Object = FA.Globals.get('mc_cache'); if(mc_clip_cache[movie_clip._name] == undefined) { var ancestors:Array = this.recursiveGetObjectParent(movie_clip).split('.'); ancestors.reverse(); var ancestry:String = ('_root.' + ancestors.join('.')).substr(0, -1); if(ancestry != '_root') { mc_clip_cache[movie_clip._name] = ancestry + '.' + movie_clip._name; FA.Globals.set('mc_cache', mc_clip_cache); } } } //-------------------------------------------- // Create a return an existing movie clip object. //-------------------------------------------- public function movieClip (mc_name) : MovieClip { var movie_clip; if (_object instanceof MovieClip) { //-------------------------------------------- // If this movie clip does not exist under this // parent, or the parent object that we are // modifying _is_ this movie clip, then make/overwrite // it. //-------------------------------------------- if (!_object[mc_name] or _object._name == mc_name) { var mc_level:Number = FA.Globals.get('mc_level')+1; _object.createEmptyMovieClip(mc_name, mc_level); FA.Globals.set('mc_level', mc_level); } movie_clip = _object[mc_name]; this.cacheMovieClip(movie_clip); } return movie_clip; } //-------------------------------------------- // Duplicate a movie clip. //-------------------------------------------- public function duplicate(duplicate_name:String) : MovieClip { var movie_clip; if(_object instanceof MovieClip) { var mc_level:Number = FA.Globals.get('mc_level')+1; _object.duplicateMovieClip(duplicate_name, mc_level); FA.Globals.set('mc_level', mc_level); movie_clip = _object._parent[duplicate_name]; this.cacheMovieClip(movie_clip); } return movie_clip; } //-------------------------------------------- // Mask one movie clip with another. //-------------------------------------------- public function mask (maskee:String, masker:String) : FA.Query { if (_object instanceof MovieClip) { var maskee_is_valid:Boolean = _object[maskee] != undefined and _object[maskee] instanceof MovieClip; var masker_is_valid:Boolean = _object[masker] != undefined and _object[masker] instanceof MovieClip; if (maskee_is_valid and masker_is_valid) { _object[maskee].setMask(_object[masker]); } } return this; } //-------------------------------------------- // Create a text field object and apply any formatting // to it. To use this function, pass an object with whatever // formatting you want to be applied to the text. This includes // the things you find in the TextField and TextFormat objects. //-------------------------------------------- public function text (formatting_or_text) : TextField { var return_val = this; if (_object instanceof MovieClip) { var formatting:Object = formatting_or_text; //-------------------------------------------- // Create the text field. //-------------------------------------------- var mc_level:Number = FA.Globals.get('mc_level')+1; _object.createTextField(t._name, mc_level, t._x, t._y, t._width, t._height); FA.Globals.set('mc_level', mc_level); //-------------------------------------------- // Get the text field and create a format for it. //-------------------------------------------- var text_field:TextField = _object[t._name]; var text_format:TextFormat = new TextFormat(); // hack to use object notation to forgoe an in_array function var n = true; var valid_formats:Object = { align: n, blockIndent: n, bold: n, bullet: n, color: n, font: n, indent: n, italic: n, leading: n, leftMargin: n, rightMargin: n, tabStops: n, target: n, size: n, underline: n, url: n }; //-------------------------------------------- // Loop through the formatting object passed to // the function and apply it to the text. //-------------------------------------------- for (var format in formatting) { if (valid_formats[format]) { text_format[format] = formatting[format]; } else { text_field[format] = formatting[format]; } } text_field.setTextFormat(text_format); //-------------------------------------------- // Set the return value. //-------------------------------------------- return_val = text_field; } //-------------------------------------------- // If we're in an XML object, then create a text // node. //-------------------------------------------- else if(_object instanceof XML) { _object.createTextNode(formatting_or_text); } return return_val; } //-------------------------------------------- // Load a movie into the current movie clip. The // parameter passed is an object with keys 'url' // and 'method' or 'variables', depending on a // user's preference. //-------------------------------------------- public function movie(movie_info:Object) : FA.Query { if(_object instanceof MovieClip) { var variables = undefined; if(movie_info.method or movie_info.variables) { variables = movie_info.method || movie_info.variables; } _object.loadMovie(movie_info.url, variables); } return this; } //-------------------------------------------- // Unload a movie. //-------------------------------------------- public function unmovie() : FA.Query { if(_object instanceof MovieClip) { _object.unloadMovie(); } return this; } //-------------------------------------------- // Attach audio to this movie clip. //-------------------------------------------- public function audio(source) : FA.Query { if(_object instanceof MovieClip) { _object.attachAudio(source); } return this; } //-------------------------------------------- // Detach audio from this movie clip. //-------------------------------------------- public function unaudio() : FA.Query { this.audio(false); return this; } }RFA.Observer: /users/petergoodman/Sites/Flash/Categories/FA/Observer.asclass FA.Observer { public function notify(event) : Boolean { return false; } public function getObserverName() : String { return ''; } }VVFA.event.EnterFrameEvent: /users/petergoodman/Sites/Flash/Categories/FA/event/EnterFrameEvent.as //-------------------------------------------- // The event for 'onEnterFrame'. //-------------------------------------------- class FA.event.EnterFrameEvent extends FA.ObservableEvent { //-------------------------------------------- // This event's name (same as observer's) //-------------------------------------------- public function getEventName() : String { return 'enterFrame'; } public function getMessage() : String { return ''; // not necessary } }dFA.Stack: /users/petergoodman/Sites/Flash/Categories/FA/Stack.as //-------------------------------------------- // A class for dealing with associative stacks. // Think of how a normal stack would work in php // with an associative array. This mimicks that // although the process is much more involved. //-------------------------------------------- class FA.Stack { private var stack_object:Object = { } private var stack_keys:Array = [ ]; private var stack_vals:Array = [ ]; //-------------------------------------------- // Push a value on to the end of the stack //-------------------------------------------- public function push (key:String, value, _index) : Void { var index:Number = _index == undefined ? stack_keys.length : _index; if (stack_object[key] != undefined) { index = stack_object[key]; } // this is such an annoying thing to do to // get _all_ the functionality I want. stack_vals[index] = value; stack_keys[index] = key; stack_object[key] = index; } //-------------------------------------------- // Get a value and delete all stuff relating to it // in the stack. //-------------------------------------------- private function _get (index:Number) { var ret; if (stack_keys[index] != undefined) { ret = stack_vals[index]; // delete the stuff off of the end of the array delete stack_object[stack_keys[index]]; delete stack_keys[index]; delete stack_vals[index]; } return ret; } //-------------------------------------------- // Pop a value off of the end of the stack. //-------------------------------------------- public function pop () { //return this._get(stack_keys.length); var index:Number; var ret; for (index = stack_keys.length-1; index >= 0; index--) { ret = this._get(index); break; } return ret; } //-------------------------------------------- // Shift a value off of the start of the stack. //-------------------------------------------- public function shift () { var ret; var index:Number; for (index in stack_keys) { ret = this._get(index); break; } return ret; } //-------------------------------------------- // Insert a value (and key) onto the start of the // stack. The hope is this function will never be // used :P //-------------------------------------------- public function unshift (key:String, value) : Void { var index:Number; // oof, this is an ugly thing to do, we need to // change all of the keys in the the arrays. for (index = stack_keys.length-1; index >= 0; index--) { if(stack_keys[index] != undefined) { stack_object[stack_keys[index]] = index+1; stack_keys[index+1] = stack_keys[index]; stack_vals[index+1] = stack_vals[index]; // this serves to delete all the old stuff. this._get(index); } } // unshift the value :D this.push(key, value, 0); } //-------------------------------------------- // Get a value from the stack by the key that // it was assigned. //-------------------------------------------- public function get (key:String) { var ret; if (stack_object[key] != undefined) { ret = stack_vals[stack_object[key]]; } return ret; } //-------------------------------------------- // Just another name for the 'push' function. //-------------------------------------------- public function set (key, value) : Void { this.push(key, value); } }pFA.build.adv: /users/petergoodman/Sites/Flash/Categories/FA/build/adv.as //-------------------------------------------- // Some advanced functions that arn't meant // specifically for filearts but for some of // my projects. //-------------------------------------------- class FA.build.adv { }fuFA.Globals: /users/petergoodman/Sites/Flash/Categories/FA/Globals.as //-------------------------------------------- // A singleton class to deal with the creation // and use of global variables. //--------------------------------------------' class FA.Globals { //-------------------------------------------- // Static instance of the FAStack class. //-------------------------------------------- static public var instance:FA.Stack; //-------------------------------------------- // Get or create a static instance of the FAStack // class. //-------------------------------------------- static public function getStack () : FA.Stack { if (!FA.Globals.instance) { FA.Globals.instance = new FA.Stack(); } return FA.Globals.instance; } //-------------------------------------------- // Set a value in the stack. //-------------------------------------------- static public function set (key, value) : Void { var instance:FA.Stack = FA.Globals.getStack(); instance.push(key, value); } //-------------------------------------------- // Get a value from the stack. //-------------------------------------------- static public function get (key) { var instance:FA.Stack = FA.Globals.getStack(); return instance.get(key); } }FA.build.fx: /users/petergoodman/Sites/Flash/Categories/FA/build/fx.as //-------------------------------------------- // Class for dealing with effects and such. //-------------------------------------------- class FA.build.fx extends FA.Query { //-------------------------------------------- // Move a movie clip from where it is to some // point on the stage. //-------------------------------------------- public function move(x:Number, y:Number, speed:String) : FA.Query { if(_object instanceof MovieClip) { //-------------------------------------------- // make sure the x and y coordinates of the // object are set. //-------------------------------------------- _object._x = _object._x || 0; _object._y = _object._y || 0; //-------------------------------------------- // Figure out how far left/right and up/down // the movie clip will move. //-------------------------------------------- var diff_x:Number = Math.abs(x - _object._x); var diff_y:Number = Math.abs(y - _objext._y); //-------------------------------------------- // Find out the hypotenuse of the move. //-------------------------------------------- var hypotenuse:Number = Math.sqrt( (diff_x ^ 2) + (diff_y ^ 2) ); //-------------------------------------------- // Figure out how far up/down and left/right the // movie clip should go on each loop. //-------------------------------------------- var interval_z:Number = (speed == "slow") ? (hypotenuse / 40) : (hypotenuse / 20); var interval_x:Number = Math.floor((interval_z / hypotenuse) * diff_x) * (coords[0] < _object._x ? -1 : 1); var interval_y:Number = Math.floor((interval_z / hypotenuse) * diff_y) * (coords[1] < _objext._y ? -1 : 1); //-------------------------------------------- // Create a reference to this movie clip so that // it can be accessed in the below functor. //-------------------------------------------- var self:MovieClip = _object; //-------------------------------------------- // Event to handle the moving of the movie clip. //-------------------------------------------- var enter_frame_event = function() : Boolean { var finished:Boolean = false; //-------------------------------------------- // Move the movie clip. //-------------------------------------------- if(self._x < x or self._y < y) { self._x = (self._x < x) ? self._x + interval_x : x; self._y = (self._y < y) ? self._y + interval_x : y; } //-------------------------------------------- // The movie clip has been moved. Stop the event. //-------------------------------------------- else { self._x = x; self._y = y; finished = true; } return finished; }; this.createEvent('onEnterFrame', new FA.event.EnterFrameEvent, _root); this.addObserver(new FA.observer.EnterFrameObserver(enter_frame_event, _root)); } return this; } //-------------------------------------------- // Rotate a movie clip. //-------------------------------------------- public function rotate(degrees:Number, speed:String) : FA.Query { return this; } //-------------------------------------------- // Scale a movie clip. //-------------------------------------------- public function scale(percent:Number, speed:String) : FA.Query { if(_object instanceof MovieClip or _object instanceof TextField) { var interval:Number = (speed == "slow") ? 20 : 40; interval = (percent < 100) ? interval * -1 : interval; var interval_x:Number, interval_y:Number; //-------------------------------------------- // A little hack so that when we divide x by y, // we don't get NaN. //-------------------------------------------- var width:Number = _object._width == 0 ? 1 : _object._width; var height:Number = _object._height == 0 ? 1 : _object._height; //-------------------------------------------- // Figure out proportional intervals to scale // both sides of the movie clip with. //-------------------------------------------- if(_object._width > _object._height) { interval_x = interval; interval_y = Math.ceil( (width / height) * interval ); } else { interval_y = interval; interval_x = Math.ceil( (width / height) * interval ); } //-------------------------------------------- // Make sure we know the original x and y coordinates // so that we can adjust the movie clip as we scale it. //-------------------------------------------- var x_pos:Number = _object._x; var y_pos:Number = _object._y; //-------------------------------------------- // Create a reference to this movie clip so that // it can be accessed in the below functor. //-------------------------------------------- var self = _object; //-------------------------------------------- // Event to handle the moving of the movie clip. //-------------------------------------------- var enter_frame_event = function() : Boolean { var finished:Boolean = false; var continue_scale_x:Boolean = (interval < 0) ? self._xscale > percent : self._xscale < percent; var continue_scale_y:Boolean = (interval < 0) ? self._yscale > percent : self._yscale < percent; if(continue_scale_x || continue_scale_y) { self._xscale = continue_scale_x ? self._xscale + interval_x : percent; self._yscale = continue_scale_y ? self._yscale + interval_y : percent; } else { self._xscale = self._yscale = percent; finished = true; } return finished; }; this.createEvent('onEnterFrame', new FA.event.EnterFrameEvent, _root); this.addObserver(new FA.observer.EnterFrameObserver(enter_frame_event, _root)); } return this; } //-------------------------------------------- // Fade a movie clip from one percentage to // another. //-------------------------------------------- public function fade(from:Number, to:Number, speed:String) : FA.Query { var diff:Number = Math.abs(from - to); var interval:Number = Math.round((speed == "slow") ? (diff / 50) : (diff / 25)); interval = Math.round((from > to) ? interval * -1 : interval); //-------------------------------------------- // Make sure to set the transparency to where // we will start fading from. Otherwise the event // will go longer than it should. //-------------------------------------------- _object._alpha = from; //-------------------------------------------- // Create a reference to this movie clip so that // it can be accessed in the below functor. //-------------------------------------------- var self = _object; //-------------------------------------------- // Event to handle the moving of the movie clip. //-------------------------------------------- var enter_frame_event = function() : Boolean { var finished:Boolean = false; var continue_fade:Boolean = (interval < 0) ? self._alpha > to : self._alpha < to; if(continue_fade) { self._alpha += interval; } else { self._alpha = to; finished = true; } return finished; }; this.createEvent('onEnterFrame', new FA.event.EnterFrameEvent, _root); this.addObserver(new FA.observer.EnterFrameObserver(enter_frame_event, _root)); return this; } //-------------------------------------------- // Set the transparency of a movie clip / button / text field. //-------------------------------------------- public function setAlpha(num) : FA.Query { if(_object instanceof MovieClip or _object instanceof Button or _object instanceof TextField) { _object._alpha = 100; } return this; } //-------------------------------------------- // Show a movie clip. //-------------------------------------------- public function show() : FA.Query { return this.setAlpha(100); } //-------------------------------------------- // Hide a movie clip. //-------------------------------------------- public function hide() : FA.Query { return this.setAlpha(0); } }'Actions for Scene 1: Frame 1 of Layer Name actions#include "main.as"a/users/petergoodman/Sites/Flash/Categories/main.as #include "filearts.as" $(_root).movieClip('display_area').set({ _x: 0, _y: 0, _width: Stage.width, _height: Stage.height }); $(new XML()).set('ignoreWhite', true).load(function(){ var num_threads:Number = $(this.firstChild.firstChild).attrib('ts'); var num_categories:Number = $(this.firstChild.firstChild).attrib('cs'); $(this.firstChild.lastChild.childNodes).each(function(i){ var category_mc:String = 'category'+$(this).attrib('i'); var category_mc_point:String = category_mc + 'point'; var category_mc_name:String = category_mc + 'name_'; var x_position = Math.abs((Math.random() * Stage.width) - (Stage.width / 2)); var y_position = Math.abs((Math.random() * Stage.height) - (Stage.height / 2)); var size_ratio:Number = ($(this).attrib('ts') / num_threads); var width:Number = Math.ceil(size_ratio * 50); var font_size:Number = Math.ceil(size_ratio * 40); width = width < 15 ? 15 : width; font_size = font_size < 12 ? 12 : font_size; x_position = x_position <= 30 ? 50 : (x_position > Stage.width ? Stage.width - 50 : x_position); y_position = y_position <= 30 ? 50 : (y_position > Stage.height ? Stage.height - 50 : y_position); $($('display_area').movieClip(category_mc)).set({ _width: width, _height: width, _xscale: 20, _yscale: 20, _x: x_position, _y: y_position }); $($(category_mc).movieClip(category_mc_point + '_border')).draw({ shape: 'circle', radius: width / 2, lineColor: 0xACACAC, lineWidth: 2, fillColor: 0xFFFFFF, _x: 0, _y: 0 }); $($(category_mc).movieClip(category_mc_point)).draw({ shape: 'circle', radius: width / 2, fillColor: 0x000000, _x: 0, _y: 0 }); $($(category_mc).movieClip(category_mc_name + 'hidden')).text({ _name: 'category_name1', _x: (-1 * (width / 2)), _y: (-1 * (width / 2)), _width: width, _height: width, type: 'input', size: font_size, font: 'Arial, Helvetica', color: 0x000000, text: $(this).attrib('n').substr(0, 3), bold: true, selectable: false, embedFonts: true }); $(category_mc).fade(50, 100, "fast").scale(100, "fast"); $(category_mc).mask(category_mc_name + 'hidden', category_mc_point); }); },function(){ trace('Could not connect to XML.'); }).load('test.php'); yz/users/petergoodman/Sites/Flash/Categories/filearts.as //-------------------------------------------- // Import needed classes. //-------------------------------------------- // import FA import FA.Query; import FA.Stack; import FA.Globals; import FA.Observer; import FA.ObservableEvent; import FA.Dispatcher; // import the events import FA.event.EnterFrameEvent; import FA.observer.EnterFrameObserver; // import the build classes for FA import FA.build.fn; import FA.build.fx; import FA.build.draw_fns; import FA.build.mc; import FA.build.xml_fns; import FA.build.adv; //-------------------------------------------- // Global variable to keep track of the levels/depths // (which one?) of movie clips. Whatever is put // will be the base level that the first movie // clip created starts at. //-------------------------------------------- FA.Globals.set('mc_level', 10); //-------------------------------------------- // Global variable to keep track of all movie clips // created and their appropriate scopes. An example // of what is stored is: 'mc_name' => '_root.mc_name' //-------------------------------------------- FA.Globals.set('mc_cache', { }); //-------------------------------------------- // Global variable to keep track of the x and y positions // of all dynamically created movie clips on the stage. //-------------------------------------------- FA.Globals.set('mc_positions', { }); //-------------------------------------------- // Set the object of all of our subclasses so // that there is only 1 instance of the subclasses. //-------------------------------------------- FA.Globals.set('fa_query_subclasses', [ new FA.build.fn(), new FA.build.fx(), new FA.build.draw_fns(), new FA.build.mc(), new FA.build.xml_fns(), new FA.build.adv() ]); //-------------------------------------------- // The function that we use to access strings, objects, // and other nice things. //-------------------------------------------- var $ = function (thing, scope) { var object; var dirty:Boolean = false; //-------------------------------------------- // Look at the different types of what is being // passed to the FA.Query class. //-------------------------------------------- switch ((typeof thing).toLowerCase()) { //-------------------------------------------- // We are passing an object to it. //-------------------------------------------- case 'array': case 'movieclip': case 'object': { //-------------------------------------------- // This object happens to be an FA.Query instance. // Let's get the object that this FA.Query instance // modifies and use it. //-------------------------------------------- if (thing instanceof FA.Query) { thing = thing.get(); } object = thing; break; } //-------------------------------------------- // A string is being passed. //-------------------------------------------- case 'string': { //-------------------------------------------- // Look to see if a movie clip with this name // exists either in the scope passed to this // function or in the _root. //-------------------------------------------- var mc_scope:MovieClip = scope || _root; if (mc_scope[thing] != undefined) { //-------------------------------------------- // Hooray! This movie clip exists. We'll use it. //-------------------------------------------- object = mc_scope[thing]; } else { //-------------------------------------------- // The movie clip doesn't exist in the root so // see if we've created this movie clip and if // its ancestry is stored in the mc_cache global //-------------------------------------------- var mc_clip_cache:Object = FA.Globals.get('mc_cache'); if(mc_clip_cache[thing] != undefined) { object = eval("" + mc_clip_cache[thing] + ""); if(!(object instanceof MovieClip)) { dirty = true; object = null; } } else { //-------------------------------------------- // Uh oh. //-------------------------------------------- dirty = true; } } break; } default: { //-------------------------------------------- // Uh oh. //-------------------------------------------- dirty = true; } } return new FA.Query(object, dirty); } a"Xyz*yz1yz8yzFyzHyzIyzPyz`>yzbWyzeuyzgyzvyzxyz~yzyzyzyz.yzByzMyz\yzgyzlyzwaa aS1a ?axaaaaaagaaa aB ao a a! a#\ a, a6 a>I aN aP