Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 07-05-2009, 01:30 PM   #1
universalState
n/
 
Join Date: Jul 2009
Posts: 2
Question _object overwrites an _object

hi,
i've made little script which picks up random numbers from array as coordinates to objects that are in second array and puts those objects to the stage.
it's like that:
instance of a class (_pinkcircle = new PinkCircle(); _graycircle = new GrayCircle();... - there are four of such instances of different classes) is pushed to an array (_objects = new Array(). i also have an array of numbers and those numbers will be x's an y's to those objects.
then there is for loop (it goes 4 times): randomly chooses numbers from _numbers Array (2 times for x and y coordinates) and also randomly chooses instance from _objects Array. then it adds instance with different xy's to stage. and what happens? if the random method will choose _pinkcircle on (for example) 2 loop and also on 4 loop then on the stage that second instance appears only and the first is overwritten by that second so there are only three objects on stage (Debug->List Objects). i thought there should always were 4 objects since there are four in array and also since loop goes 4 times. i understand that object is equal to object so it will be overwritten. but is there any way to have always four objects on the screen even if they were the same type? i could add all of those instances to stage first and then write a function which would swap x and y coordinates of all of them, but i think it is not the best way to solve this problem. Any ideas? maybe some conditional would help? thanks a lot for any answers
universalState is offline   Reply With Quote
Old 07-05-2009, 01:32 PM   #2
universalState
n/
 
Join Date: Jul 2009
Posts: 2
Default

there is that shitty blink icon-sorry - there should be _objects = new Array();
universalState is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:29 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.