Link to home
Start Free TrialLog in
Avatar of Cheryl Lander
Cheryl LanderFlag for United States of America

asked on

collision detection

Im having trouble getting this to code to work.

I basically want trace to say something once project1 movieclip moves over active main.

but the trace does nothing in output.


import mx.transitions.Tween;
import mx.transitions.easing.*;
function moveMc(instname, newx, newy)
{
      new Tween(instname, "_x", Strong.easeOut, instname._x, newx, 1.3, true);
      new Tween(instname, "_y", Strong.easeOut, instname._y, newy, 1.3, true);
}

project1.onPress = function()
{
      moveMc(project1,activemain._x,activemain._y);
};

if (project1.hitTest (activemain)) {
  trace ("You've been hitouch!");
}
ASKER CERTIFIED SOLUTION
Avatar of Zeffer
Zeffer
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Cheryl Lander

ASKER

ive tried this on a frame in the mail timeline.

project1.onEnterFrame = function () {
    if (project1.hitTest (activemain)) {
      trace ("You've been hitouch!");
};

but it comes up with this error.

Statement block must be terminated by '}'
Operator '=' must be followed by an operand

Worked it out.

Thanks.
_root.project1.onEnterFrame = function()
{
    if(_root.project1.hitTest(activemain)){
        trace ("You've been hitouch!");
    }

};