chain reaction

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

chain reaction

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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: chain reaction

Markus Gälli-3
Hi

"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

Cheers

Markus

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
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

RE: chain reaction

Christine Wolfe
Oh Markus!!! You are a genius!!!

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Markus
Gälli
Sent: Friday, November 06, 2009 10:54 AM
To: A friendly place to get answers to even the most basic questions about
Squeak.
Subject: Re: [Newbies] chain reaction

Hi

"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

Cheers

Markus

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
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners