Better… This was difficult to understand.

Vodpod videos no longer available.

more about “studyDist2“, posted with vodpod

var clip:MovieClip=createClip(100);

function createClip(num:Number):MovieClip {
for (var i:int = 0; i < num; i++) {
var c:MovieClip = new Clip();
c.addEventListener(Event.ENTER_FRAME, onAnimate);
return (c);

function onAnimate(evt:Event):void {
var c:MovieClip = MovieClip(evt.currentTarget);
var cntr:MovieClip = MovieClip(c.parent);

*/This part I think is what I am having trouble with – How can a Var that is data typed to Number be equal to a function?/*

var d:Number = dist(cntr.mouseX, cntr.mouseY, c.x, c.y);
var distScale:Number = (100 – d) / 100;
if (distScale < 0.1){
distScale = 0;
c.scaleX = c.scaleY = distScale;

function dist(x1:Number, y1:Number, x2:Number, y2:Number):Number{
var diffX:Number = x1 – x2;
var diffY:Number = y1 – y2;
return Math.sqrt(diffX * diffX + diffY * diffY);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s