actionscript-3
Array targeting trouble in AS3
Brand new to programming so I apologize in advance. I'm trying to set up a game where after each time a button is pressed, a new instance of a MC is added to stage, then I need a collision detection for an existing object with any of the new instances of the MC. I need to add one instance to the stage at a time and once it reaches 8 instances, I need it to stop adding children but still be able to detect collisions with any of the instances. As it stands now it just replaces the MC or MCs into the new random position. Heres what my code looks like so far: var pinkBox:pinkClass = new pinkClass(); var pinkArray:Array = new Array(); myButton.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownleftBtn);{ function mouseDownleftBtn(e: Event): void { for(var i=0; i<8; i++) { addChild(pinkBox); pinkArray.push(pinkBox); pinkBox.x = Math.random()*stage.width; } myButton.startDrag(); } } addEventListener(Event.ENTER_FRAME, checkCollision); function checkCollision(event:Event){ if (myButton.hitTestObject(pinkBox)) { trace("hit") }}
Related Links
domainMemory issue with Loader
BUG - rotation of Default image on iOS with AIR SDK 16.0.0.250
AS3 Flash Animation not fully working in captivate 5.5
Flash crash after matrix rotation
generate pdf files using adobe flash professional
ShowAllDataTips only in a LineSeries
Not able to type in input textboxes in AC3 when attempt the scene in the second time
AS3: Caching files without user interaction?
Choice for multi-platform application development
How to get specific item from Array Collection in Adobe Flex 4.6
How can we broadcast live video from SWF running in flash player to Azure Media Services Live Streaming? [closed]
Move Components in the Title Bar?
AS3 efficient way to make a disabled state
call a function when component visibility changes
Actionscript3 Simple platform collision confusion
JWplayer. Change destination source with http request