Thanks...I'm trying to figure out how to work a hitTest into the Circle.as class and don't know what to put on the other side of the argument...
I tried this in Circle.as:
Code:package { import flash.display.MovieClip; import flash.events.Event; import flash.utils.getDefinitionByName; import flash.utils.getQualifiedClassName; public class Circle extends MovieClip { public function Circle () { this.addEventListener(Event.ENTER_FRAME, MoveCircle); } public function getClassObj(obj:*):* { var objClass:Class = Class(getDefinitionByName(getQualifiedClassName(obj))); return new objClass(); } private function MoveCircle(e:Event) { //I've got code here to randomly move the circles and I have the same sort of thing on the squares //I tried this for collision detection, but it doesn't work...not sure how to check to see if the circle is hitting another circle or a square if (this.hitTestObject(getClassObj(this))) { trace("name1 " + this.name); } //I tried this also to see if I could tell if it was hitting anything, but it just returns that it's hitting Main every time if(stage){ var i:int = 0; for(i; i < stage.numChildren; ++i){ if (this.hitTestObject(stage.getChildAt(i) && stage.getChildAt(i)) != this) { trace("hit "+stage.getChildAt(i)); } } } } } }




Reply With Quote