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

AS3 font embedding - Error message
Why is Flash stretching my image when I didn't ask it to?
Embedded font makes TextField invisible
AS3:Move Objects in a curve path using as3 programming?
Filtering spikes in realtime data without adding latency
Flash internet browser AS3 [closed]
ActionScript3 URLLoader doesnt load page or respond to Event.Complete
Buffering while pausing netStream.pause() actionscript
Alternativa3D: Actionscript3: How to avoid z-fighting in imported 3DS model?
Migrate from AS3 to AIR, flvPlayback VideoEvent Error
TextField appears on stage when it's not a child of DisplayContainer?
datefield itemrenderer
Recording and playback actions with AS3
AIR (As3) - Download large file trough iPad application
Is there any technical or processing difference between TouchEvent.Touch and MouseEvent.Click?
How to find which styles are defined for an element

Categories

HOME
pact
intellij-idea
customization
python-requests
opencv4android
gaussian
mifare
where
squeak
coordinates
google-docs-api
travis-ci-cli
gnuradio
rmarkdown
ejb-3.0
wowza
suitecrm
expo
element
opengrok
dat.gui
facebook-marketing-api
template10
single-page-application
mattermost
android-wear-2.0
android-xml
core-animation
jopendocument
typeorm
ipython-parallel
selenium3
deferred
favorites
webmock
ansible-inventory
leaderboard
outlook-2010
armadillo
jvisualvm
definition
rexx
ocpjp
ocamlbuild
qtwebkit
xmldom
openxava
google-cloud-shell
sharing
qudpsocket
dimensionality-reduction
netlink
instaparse
falcon
gdi
system-integration
django-celery
jersey-test-framework
instabug
ios8-share-extension
ruby-1.8.7
recode
litedb
jeet-grid
chunks
illegalargumentexception
sync
api-eveonline
vundle
javacompiler
sat4j
isl
html5-filesystem
carrier
db2-connect
friendly-id
pechkin
exi
qmainwindow
junction-table
cron4j
teamsystem
shapado
winrt-async
sup
django-1.4
parsec
jmesa
maven-eclipse-plugin
recess
noise-reduction
cinder
onunload
rollover
oaw
table-valued-parameters
chromebug
focus-stealing

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App