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

Optimizing an Actionscript function
how to test flash cs5 app on the iPad
How can I pass parameters from a web application (JSP) to a Flex application (mxml file)
Not able to Embed images in Flex action script
TCP Socket frames 'queuing' up on Windows. How can I force each message in it's own frame?
How can I break down a view in a flex application?
Add a % sign and color it
Error #1010 (Probably an object error)
OSMF Playing Event
as3 error says “Stream Error”, but when loaded manually it's there
How to load an image in memory with Flex/ActionScript?
Check if Class Implements a Specific Interface
Scrollbar-Button jitters when reaching maximum/minimum
Can a Flex-based project be released under the GPL v2? [closed]
Read Text File with AS3 and Tween Each Word from Small to Large out of the screen
Flex button script

Categories

HOME
postgresql
swift3
macros
fortran
packet
mysqli
mifare
hex
okhttp3
confluence-rest-api
mediarecorder
angularjs-directive
aggregate-functions
doctrine2
revit-api
guidewire
background-image
web-worker
filehelpers
powerpivot
beacon
passbook
minimagick
smali
email-client
aws-iot
ppp
deployment-descriptor
sqldependency
r-factor
loopback
eclipse-jdt
epub
asp.net-webhooks
stdin
ngrok
socketcluster
vertical-alignment
glide-image-library
paperclip
taleo
android-doze-and-standby
spring-ide
rivets.js
flask-socketio
noise
runtime-permissions
playframework-1.x
openpgp.js
aot
hellosign
catalyst
recursive-query
qudpsocket
turbolinks
scikit-image
papyrus
netlink
cosign-api
hoare-logic
change-password
airwatch
angularfire
system-integration
stdlist
ios8-share-extension
jts
biginsights
android-togglebutton
musicbrainz
properties-file
copy-on-write
veeam
dockerpy
sony-xperia
launcher
xmlserializer
dirname
pnunit
pytz
xpand
hotlinking
satisfiability
ekevent
ardor3d
dylan
raddatepicker
leap-year
select2-rails
rbm
event-propagation
advanceddatagrid
inserthtml
scsf
xpolog
backlight
lwp
mass-emails
iphone-maps
database-agnostic
pkcs#7
cross-cutting-concerns
moores-law

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