package
{
import flash.display.Sprite;
/**********************************************************************************************\
* BinaryTreeNode Class - Designed to give generic object functionality to a binary tree *
* node type. *
* @author : Richard Vacheresse /|\ http://www.rvacheresse.com /|\ *
* Licensed for free Commercial and Private use creative commons license agreement. *
* The provided code is in an "as-is" state. Richard Vacheresse makes no warranties *
* regarding the provided code, and disclaims liability for damages resulting from its use. *
* I am also not responsible for baby Smurfs being born only on a blue moon; the way your *
* father looks really creeepy like at one of your friends; or for your better half being home *
* late last Tuesday night, but man-oh-man she can sure dance. I am most importantly not *
* responsible for you reading this far in docs, really? *
* @version 1.0 *
\**********************************************************************************************/
public class BinaryTreeNode extends Sprite
{
private var element:Sprite;
private var left:BinaryTreeNode;
private var right:BinaryTreeNode;
/**
* BinaryTreeNode(obj:Object):void Constructor. Creates a new
* tree node with the specified data element being passed to it.
* @param - Sprite Object
**/
public function BinaryTreeNode(obj:Sprite):void
{
element = obj;
left = null;
right = null;
trace("\nBinary Tree Node Created");
}
/**
* numChildren():int - Returns the number of non-null children of this node.
* This method may be able to be written more efficiently.
* @return the integer number of non-null children of this node
**/
public function getNumChildren():int
{
var children:int = 0;
if(left != null)
children = (1 + left.getNumChildren());
else if(right != null)
children += (1 + right.getNumChildren());
return children;
}
/**
* toString():String function - Returns a string representation of the
* node and its children.
* @return - String Object
**/
override public function toString():String
{
var result:String = "";
result = ("\nBinary Tree Node: " +
"\n-----------------"+
"\nThe Main Element is: " +
this.element.toString());
if(this.getNumChildren() > 0)
{
try
{
if(this.left != null)
result += ("\nThe Left is: " + this.left.toString());
if(this.right != null)
result += ("\nThe Right is: " + this.right.toString());
}
catch(er:Error)
{
trace("Error Caught: " + er);
}
}
return result;
}
//$-------------------------------------------
//$ $-SETTERS-$
//$-------------------------------------------
/**
* setElement(spr:Sprite):void function - Sets the element property to passed value.
**/
public function setElement(spr:Sprite):void
{
this.element = spr;
trace("\nMain Element Set to: " + spr);
}
/**
* setLeftNode(btNode:BinaryTreeNode):void function - Sets the left binary tree node
* property to passed value.
**/
public function setLeftNode(btNode:BinaryTreeNode):void
{
this.left = btNode;
trace("\nLeft Node Set To: " + btNode);
}
/**
* setRightNode(btNode:BinaryTreeNode):void function - Sets the right binary tree node
* property to passed value.
**/
public function setRightNode(btNode:BinaryTreeNode):void
{
this.right = btNode;
trace("\nRight Node Set To: " + btNode);
}
//$-------------------------------------------
//$ $-GETTERS-$
//$-------------------------------------------
/**
* getElement():Sprite function - Returns the element property value.
* @return - Sprite Object
**/
public function getElement():Sprite
{
return this.element;
trace("\nMain Element Returned: " + spr);
}
/**
* getLeftNode():BinaryTreeNode function - Returns the left binary tree node
* property.
* @return - BinaryTreeNode Object
**/
public function getLeftNode():BinaryTreeNode
{
reuturn this.left;
trace("\nLeft Node Returned: " + btNode);
}
/**
* getRightNode():BinaryTreeNode function - Returns the right binary tree node
* property.
* @return - BinaryTreeNode Object
**/
public function getRightNode():BinaryTreeNode
{
return this.right;
trace("\nRight Node Returned: " + btNode);
}
}
}
package
{
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.IEventDispatcher;
import flash.events.ProgressEvent;
import flash.net.URLRequest;
public class ImageLoader extends Sprite implements IEventDispatcher
{
public var newLoader : Loader;
private var newRequest : URLRequest;
private var assetsFolder : String;
public var allowDomainUrl : String;
private var percent: Number = 0;
public function ImageLoader()
{
}
public function load ( thisURL: String ):void{
//
//Security.allowDomain( allowDomainUrl );
this.newLoader = new Loader();
//Security.allowDomain("*");
this.newRequest = new URLRequest( thisURL );
this.newLoader.load(this.newRequest);
/*
"Grasshopper - Remember to refer to the obj contentLoaderInfo which holds the data as it loads"
*/
this.newLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
this.newLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, checkProgress);
}
public function checkProgress(e:ProgressEvent):void{
//
percent = Math.ceil( e.bytesLoaded / e.bytesTotal ) * 100;
}
public function get progress ( ) : Number {
return percent;
}
public function loaded(e:Event): void {
//addChild( this.newLoader.content );
}
}
}
import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;
OverwriteManager.init(OverwriteManager.AUTO);
TweenPlugin.activate([GlowFilterPlugin, TintPlugin]);
// create some variables used in tweens
var tweenTime:Number = 0.5;
var pauseTime:Number = 0.2;
// create timeline
var myTimeline:TimelineLite = new TimelineLite();
// .append adds tweens onto the end of existing ones - like TweenGroup.ALIGN_SEQUENCE
myTimeline.append(new TweenLite(mc1, tweenTime, {x:100}));
myTimeline.append(new TweenLite(mc2, tweenTime, {y:100}));
myTimeline.append(new TweenLite(nul, pauseTime, {})); // simple PAUSE - use any mc in the tween
myTimeline.append(new TweenLite(mc1, tweenTime, {x:150}));
myTimeline.append(new TweenLite(mc1, tweenTime, {x:250, delay:-tweenTime})); // use negative delays for simultaneous tweens