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

Actionscript 3.0: Help Linking Document Class To And Audio Slider Class
p2p RTMFP controlling movieClip frame action
How to get caretIndex from a TextArea as TextField
Invalid number of arguments when calling static method through function reference
AS3 softkeyboard auto slide up
parent and MovieClip(root) trouble
Redirect to a website after you win
How to make a d-pad in flash AS3?
loading saved bitmap
Blurred bitmap/embedded text when scrolling in TextField? (Flash/AS3)
Random flashing white pixel at the bottom of the insertion point/caret in TextField? (Flash/AS3)
Actionscript regex false negative
air app crash when load some pict
How add UNDO to my text field in AS3?
as3 pepperFlash check on runtime
Actionscript 3 will not work with movie clips

Categories

HOME
ssms
stata
locale
wifi
spss
bitbucket
symfony-sonata
snmp
richtextbox
kendo-asp.net-mvc
schema
jetbrains
swift3.1
react-select
popup
views
md2
draw2d
aws-devicefarm
android-wifi
gomobile
vala
typedef
multipart
smali
google-drive-android-api
procedural-generation
advertising
uipath
apdu
inspec
dynamic-memory-allocation
emr
hierarchy
mobile-development
akamai
slim-lang
snapkit
node-soap
android-scrollview
powerbi-embedded
wit-ai
minitest
perf
multi-user
pygraphviz
armadillo
blueimp
ng-lightning
idea-plugin
server-side-swift
rbac
contenteditable
riemann
perldoc
playframework-1.x
seyren
r-commander
reloaddata
wicketstuff
iban
scrollmagic
lattice
ownership
syslog4j
innertext
stdlist
alchemy
sqldataadapter
opendolphin
newlib
windows-kernel
redquerybuilder
om
android-filterable
polarion
stereotype
tinymce-plugins
jeet-grid
radgrid
douglas-peucker
fiware-health
alpha-beta-pruning
xcode5
system.io.packaging
react-os
agent-based-modeling
episerver-7
ant-contrib
reactjs-native
winrun4j
facebook-java-api
php-amqplib
mahara
xcode6.1-gm-seed
infomaker
ia-32
oc4j
qgraphicsscene
wordbreaker
gpl
mail-gem
openafs
animationdrawable
win-prolog
jqueryi-ui-buttonset
n2
http-response-codes
p4.net
file-icons
html-help-workshop
managed-code
cross-cutting-concerns

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