Find objects

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Find objects

Rob Van Pamel
Hello

I have added some cube's to my space. I have given them an objectname so i could find them back. But i doesn't work.
The code i tried is the following :

cube := Redcube new:'rode cubussss'.  (I've overriden the standard new method so i could do this)
cube translationX: 0 y:0   z:0.
space addChild: cube. (until here it works fine)
test := ((space find:[:frm | frm objectName = 'rode cubussss']) at: 1).
(this crashes)

I hope somebody could help me

Kind regards and thanx in advantage
  Rob Van Pamel



Reply | Threaded
Open this post in threaded view
|

Re: Find objects

Rob Van Pamel
I found out that the problem was not to find my objects, but when i find it, it is located in a Collection. Now i want to find out how i can access an object out of that collection. I tried many things but it all fails ...
i thought this had to work :

list add:(space find:[:frm|
  frm objectName='rode cubussss' .
]).    "here i add my object with the objectname to the list"

list do:[:cubes|
  Transcript show: cubes getobjectName.
]. "here i trie to call a method (getobjectName) on that object but i doesn't work."


I hope somebody can get me out of here?