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

Flash AS3: saving/loading the positions of all the children of a MovieClip
load external image to empty symbol as3
ADDED_TO_STAGE firing issues
How to get image if I drag and drop an Image from Internet Explorer 11/8 to AIR Application
How to play full animation with one press in action script 3
Got the error 1046 when changing the property of a component from a RSL
Flash Hit Test Object as3
Actionscript 3.0 Error opening URL error
Setting the value of a PopUpMenuButton programmatically?
AS3: How to check, all zip files has been extracted?
Action Script3 error #1176
Getting the error, “The application cannot be installed due to a certificate…”
AS3 copy and paste with colour formatting
adt error - “… is not part of a Mac OS X Native Extensions framework”
How to make a public method that is not inherited by subclasses?
Change the size of text if charcters > at 15

Categories

HOME
qlikview
asp.net
joomla
postgresql
skype-for-business
oracle-sqldeveloper
postgresql-9.3
azure-eventhub
dynamic
open-search-server
segmentation-fault
angularjs-ng-repeat
appsettings
openscad
css-float
samba
openam
indri
views
datasource
onclicklistener
android-6.0-marshmallow
large-files
emr
edsdk
ng2-bootstrap
mootools
tunnel
minitest
flex3
extern
latency
ngrok
azure-web-roles
wicket-tester
glide-image-library
jquery-ui-slider
test-kitchen
servicebus
dcom
audio-fingerprinting
openpgp.js
aws-rds
stringbuilder
blitz3d
symantec
dimensionality-reduction
weblogic-maven-plugin
nsoperationqueue
phpdesigner
instabug
google-finance-api
redquerybuilder
page-flipping
jsoncpp
azure-mobile-app
avrcp
iphone-6
kss
pyalgotrade
episerver-7
sendy
sqldatasource
autofilter
mysql-error-1146
complete
thucydides
google-mirror-api
google-voice
mencoder
dylan
pechkin
qgraphicsscene
kademlia
nsautoreleasepool
ftpwebrequest
algol
motordriver
netbiscuits
reflexil
sqlbuddy
unordered-set
fileoutputstream
utm
yii-cactiverecord
openwrap
hs-err
table-valued-parameters
database-agnostic
bootstrap-protocol
j++

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App