Soolseem
09-06-2008, 04:49 PM
I have many of the same type of object in my world, is there a way to create a method and use it on multiple objects?
Digimath
09-06-2008, 06:22 PM
How about using a parameter to pass the name of an object to your method?
DrJim
09-07-2008, 01:29 AM
How about using a parameter to pass the name of an object to your method?
This can get a bit tricky to implement with Alice's drag and drop interface but it can be done. See the attached example or the Zeus example in the text by Dunn, et al.
Since Alice doesn't enforce class ownership :(, it really doesn't make a lot of difference what object owns the method - but it probably should be one of the multiple objects.
You will have to drag the commands and start with "dummy" variable names. Then substitute the actual name/subpart name you want. You have to type the part name - and Alice, like all computer programs, is very unforgiving of typos.
Also, all of the objects using the method have to have exactly the same object tree structure down to the part being moved. This is often not true of different library objects - though this can sometimes be corrected simply by changing the part names.
An alternate approach is to just drag a method into the clipboard and then copy as a method for next object. Slightly easier - but most of the above comments still apply.