hi i am a little bit closer to my assignment,
so please help me Out
My Question is how i deduct the position of the hitTest Objecti mean to say which angle he hit X Y and after hiting it must be goo that angle
http://myrozgar.noads.biz/flash/base.html
here is my code
import mx.transitions.Tween;
import mx.transitions.easing.*;
acceleration = 5;
newpos = function ()
{
ranx = random(600);
rany = random(400);
};
//initialize counter
var object:String=“leaf”+mycount+" “+mycount1;
var fromX:Number=_root[“leaf”+mycount+” “+mycount1]._x;
var fromY:Number=_root[“leaf”+mycount+” "+mycount1]._y;
var toX:Number=0+(mycount40);
var toY:Number=10+(mycount140);
/function walk(object:String,fromX:Number,fromY:Number,toX:N umber,toY:Number){
_root[object]._x =toX;
_root[object]._y =toY;
}/
//function to create multiple movieclips from single movie clip
function createFlyingMC() {
for (mycount1=1; mycount1<12; mycount1++) {
for (mycount=1; mycount<14; mycount++) {
_root.leaf.duplicateMovieClip(“leaf”+mycount+" "+mycount1, _root.getNextHighestDepth());
var object:String=“leaf”+mycount+" “+mycount1;
var fromX:Number=_root[“leaf”+mycount+” “+mycount1]._x;
var fromY:Number=_root[“leaf”+mycount+” "+mycount1]._y;
var toX:Number=0+(mycount40);
var toY:Number=10+(mycount140);
walk(object,fromX,fromY,toX,toY);
}
}
}
onMouseMove = function()
{
for (mycount1=1; mycount1<12; mycount1++) {
for (mycount=1; mycount<14; mycount++) {
if(_root[“leaf”+mycount+" "+mycount1].hitTest(_root._xmouse, _root._ymouse)){
/ranx = random(1000);
rany = random(1000);
var _loc4 = ranx - _root[“leaf”+mycount+" “+mycount1]._x;
var _loc3 = rany - _root[“leaf”+mycount+” "+mycount1]._y;
//var _loc5 = Math.atan2(_loc3, _loc4);/
/var tweenInstanceName:Tween = new Tween (object, property, function, begin, end, duration, useSeconds)
var myHoriTween:Tween = new Tween (myBall_mc,“_x”,Strong.easeOut,0,400,2,true);/
var tweens=new Tween(_root[“leaf”+mycount+" “+mycount1],”_x", Strong.easeOut, _root._xmouse, 300, 1, true);
var tweene=new Tween(_root[“leaf”+mycount+" “+mycount1],”_y", Strong.easeOut, _root._ymouse, 0, 1, true);
//_root[“leaf”+mycount+" “+mycount1]._x = _root[“leaf”+mycount+” “+mycount1]._x + _loc4 / acceleration;
//_root[“leaf”+mycount+” “+mycount1]._y = _root[“leaf”+mycount+” "+mycount1]._y + _loc3 / acceleration;
}
}
}
}
onEnterFrame = setTimeout(this,‘placeeagain’,2000)
function placeeagain(){
for (mycount1=1; mycount1<12; mycount1++) {
for (mycount=1; mycount<14; mycount++) {
var object:String=“leaf”+mycount+" “+mycount1;
var fromX:Number=_root[“leaf”+mycount+” “+mycount1]._x;
var fromY:Number=_root[“leaf”+mycount+” "+mycount1]._y;
var toX:Number=0+(mycount40);
var toY:Number=10+(mycount140);
if(fromX != toX || fromY != toY)
walk(object,fromX,fromY,toX,toY);
}
}
setTimeout(this,‘placeeagain’,2000)
}
function walk(object:String,fromX:Number,fromY:Number,toX:N umber,toY:Number){
_root[object]._x =toX;
_root[object]._y =toY;
}
ID = createFlyingMC();