myName

Vodpod videos no longer available.

import com.greensock.*;
import com.greensock.easing.*;

var txt:TextField = new TextField();
addChild(txt);
txt.embedFonts = true;
txt.defaultTextFormat = new TextFormat(“Arial”, 36);
txt.text = “why does this only work with Arial?”;
txt.autoSize = TextFieldAutoSize.LEFT;
txt.x = 100;
txt.y = -200;
TweenLite.to(txt, 2, {y:300, rotation:360});

DragDrop

Drop items in buckets ….

Vodpod videos no longer available.

So this is on the main time line….

var clutter:Array = [leafbug1, leafbug2, leafbug3, leafbug4, leaf1, leaf2, leaf3, leaf4];

function assignTargets():void
{
var instanceName:String;

for(var i:uint = 0; i < clutter.length; i++)
{
instanceName = clutter[i].name;
if(instanceName.indexOf(“bug”) != -1)
{
clutter[i].target = bugBkt_mc;
}
else
{
clutter[i].target = leafBkt_mc;
}
}
}

assignTargets();

And this is the Class …

package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;

public class DragDrop extends MovieClip
{
public var target:MovieClip;
private var originalX:Number;
private var originalY:Number;
public function DragDrop()
{
originalX = this.x;
originalY = this.y;
this.addEventListener(MouseEvent.MOUSE_DOWN, drag);
}
private function drag(event:MouseEvent):void
{
this.startDrag();
this.parent.addChild(this);
this.addEventListener(MouseEvent.MOUSE_UP, drop);
}
private function drop(event:MouseEvent):void{
this.stopDrag();
this.removeEventListener(MouseEvent.MOUSE_UP, drop);

if(this.hitTestObject(target))
{
this.visible = false;
}
else
{
this.x = originalX;
this.y = originalY;
}
}
}
}