1

Obviously as you can see from this clip below, the Hit and Miss is not corresponding to the actual event on the stage. why? It works only if I give the objects instance name, but not working when using the var name. why?

here's the code:

import flash.events.Event;
var gball: SmallGreenBall1_T = new SmallGreenBall1_T();
var bucket: allBuckets = new allBuckets();
this.addEventListener(Event.ENTER_FRAME, handleCollision)
function handleCollision(evt: Event): void {
  if (gball.hitTestObject(bucket)) {
  output_txt.text = "HIT"
  } else {
  output_txt.text = "MISS"
  }
}

https://www.youtube.com/watch?v=rL4N5Abokf0[Hit and Miss is not corresponding to the actual event on the stage][1]

1 Answer 1

1

Problem solved. Rookie mistake, I needed to addChild the object not preposition them on stage.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.