Link to home
Start Free TrialLog in
Avatar of msukow
msukowFlag for United States of America

asked on

AS2 class attachMovie

The name of my .fla file is round.fla. In round.fla, I have a movieClip called "collisionToolTip" and the identifier is also named the same. Export for ActionScript and Export in first Frame are both checked.

Originally, the code was a function in the main .fla. I am now updating to use an external class instead. Everything was working before, but the movieClip is not appearing now. I know the syntax needs to be tweaked, but I am not sure what is needed for the attachMovie code.
import flash.geom.Rectangle;
// for collision detection
import com.gskinner.sprites.CollisionDetection;
//
class com.wfc.CollisionHandling extends MovieClip {
  private var myTextCollisions:Number = 0;
	
  function CollisionHandling() {
  }
	
  public function checkCollision(mc1, mc2, alphaAmount) {
    var collisionRect:Rectangle = CollisionDetection.checkForCollision(mc1, mc2, alphaAmount);

    if (collisionRect) {
      myTextCollisions = myTextCollisions + 1;
      _root.attachMovie("collisionToolTip","collisionToolTip",100,{_x:(25), _y:(75)});
    } else {
      _root.removeMovieClip(collisionToolTip);
    }  
  }
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of TanLiHao
TanLiHao
Flag of Singapore 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