Hi I've got this misunderstanding of how to use arrays and objects
stored there in (note I'm actually using Shoes if this has any bearing
on my problem).
below is a bit of code i've written that creates an array of 25 places.
@myarray = Array(1..25)
I then want to "install" a bona fide object like a shape into each 25
places.
so i do this...
1.upto @myarray.length do |p|
@myarray[p] = oval(0,0,20,20)
@myarray[p].move = x,y
note: x & y being defined else where so each shape is visable on screen
or can it be @myarray[p] = oval(0,0,20,20).move x,y?
if i use a local variable when defining ashape and do this
@myarray[p] << ashape
then it works without the error that i get presntly which is
move is private and refers to the actual line @array[p].move = x,y
any explanations would be great and thoughts on best practices with this
sort of thing would be grateful.
dave.
--
Posted via http://www.ruby-forum.com/.