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 (Column 3 1120: Access of undefined property ball.)
Flash Builder 4.6 - ComboBox set to visible on underlying component MouseOver, but flickers when MouseOver of ComboBox
AS3 Super Class Issue
TweenMax frame & onComplete issue
Adobe Flash - Access of possible undefined property COMPLETE
autosizing movieclips to match text size (AS3)
Flex single swf worker - with no lifecycle events or constructor, how is the worker configured?
How to play full movie clip once with a single key press
How to use a single script for multiple frames
As3 jumping collision issue
How to fix AS3 button?
Actionscript 3 jumping animation issue
Actionscript 3 Code Keeps Giving Error 1009
Horizontal collision issue with actionscript 3 flash
Actionscript 3 FileReference load/save strings
actionscript 3, removeEventListener not working properly

Categories

HOME
airflow
drupal
internet-explorer
model-view-controller
azure-documentdb
marie
leaflet
cxf
perl6
mediarecorder
kohana
collision-detection
python-3.4
handlebars.js
wavefront
android-webview
angularjs-ng-repeat
minimax
theory
aws-sdk-cpp
vichuploaderbundle
ldap-query
captcha
mongodb-replica-set
yui
game-engine
amazon-data-pipeline
css-float
ringcentral
vivado-hls
openam
audio-streaming
legend-properties
gnu-screen
oracle-golden-gate
large-files
federated
ocl
foxpro
offset
fastadapter
openvms
gitosis
tunnel
yelp
jibx
jquery-inputmask
jvisualvm
mef
runtime-permissions
multi-select
was
suitesparse
apache-commons-cli
catalyst
breadcrumbs
optional-parameters
racket-student-languages
access-violation
jira-agile
qtruby
patching
angular-i18n
google-app-engine-php
dynamics-nav
ruby-1.8.7
maven-antrun-plugin
uinavigationitem
polarion
web-standards
pymol
crtdbg.h
caption
dojox.grid
cocos2d-x-2.x
time-frequency
parallel-port
opencobol
connections
class-library
kendo-window
qgraphicsscene
mandelbrot
reference-manual
ntdll
fileoutputstream
yii-cactiverecord
umfpack
pex-and-moles
gmagick
azure-appfabric
subdirectories
chromebug
mysql-logic
rpxnow

Resources

Encrypt Message