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