[Newbies] chain reaction

Markus Gälli gaelli at emergent.de
Fri Nov 6 15:53:54 UTC 2009


"on top of which I have added two other morphs:"

If that means that you have added a and b as submorphs of X then you  
are fine:
each morph knows its owner and can access it via "owner".
So you could tell the instance of A to call its owner X to trigger the  
instance of B.

As X knows both of them you can write sth. along the lines of

A >> move
	"now I am ready"
	self owner triggerActionsAfterAHasMoved

X >> triggerActionsAfterAHasMoved
	b move

Hope that helps



Am 06.11.2009 um 16:36 schrieb Christine Wolfe:

> I have an image morph X on top of which I have added two other  
> morphs: A and B.  I want to be able to click on morph A and have it  
> move and at the end of its motion, automatically trigger the  
> movement of morph B.
> Here’s my dilemma.
> A, B, and X are all instances of different classes of morphs that I  
> defined.
> X has two instance variables, a and b to which I assign new  
> instances of the classes A and B.
> a responds to the mouse down event by moving – that part works.
> Now I want B to move too without the user having to do any more  
> clicking.
> If I try to add a method to A that calls a movement method in B, it  
> doesn’t know what B is – I assume because at this point, I’m just  
> defining the classes and they don’t know about the instance names of  
> other objects.
> I will greatly appreciate it if you can help me think of a way to  
> make a chain reaction and a group of morphs based on clicking only  
> one of the morphs.
> Thanks!
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

More information about the Beginners mailing list