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

Categories

HOME
spring-boot
sql-server-2014
webvr
microcontroller
cryengine
salesforce-lightning
sms
snmp
msbi
aggregation-framework
restheart
software-collections
cracking
theory
decoding
resharper
http-status-codes
sha1
appsettings
django-rest-auth
mattermost
libxml2
emr
exacttarget
qt-designer
directions
odp.net
headphones
border-layout
maven-2
jibx
lex
nscollectionview
bzip2
contenteditable
uitextview
web-technologies
peerjs
synchronized
anonymous-function
flask-socketio
ajv
r-commander
webmatrix
multi-targeting
rmq
iban
jspx
geokit
syslog4j
mrunit
user-profile
chomsky-normal-form
firefox-os
containstable
yfiles
overlapping
controlpanel
ios8-share-extension
magnet-uri
maven-antrun-plugin
redquerybuilder
edgar
lytro
windows-phone-8-emulator
identifying
stereotype
nsq
quickfixn
fedena
fscanf
behance-api
xpand
opencobol
nomachine
lastinsertid
scidb
tlbimp
ironworker
qgraphicsscene
azure-scheduler
bho
mmo
antixsslibrary
algol
wpml
custom-cursor
winrt-async
django-admin-tools
mysql-connector
jmesa
session-hijacking
soapexception
http-response-codes
arraycollection
simultaneous
glassfish-embedded
zend-acl
expander

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile