I don't get where MouseInteractor fits in...

5 views
Skip to first unread message

Tobe Nwanna

unread,
Apr 4, 2010, 7:40:22 PM4/4/10
to 68...@googlegroups.com
So I think I'm not fully understanding how MoveInteractor is supposed to
work. This is what I'm guessing. When you create a board, a MI subclass
(so in this case a CheckerInteractor for instance) is created. Whenever
a checker is created you add it to the list of things listened to in
CheckerInteractor. Whenever you click on a checker pickUp is called,
which checks if it can be dragged and then calls its startDrag()
function. When it's released, drop is called and checks whether it can
be dropped in that location, then calles it's stopDrag() function. Is
this the basic idea?

If so, my question is why don't pickUp and drop take MouseEvents? Is
some other function supposed to take the events and call pickUp and drop?

Sean Liu (Gmail)

unread,
Apr 4, 2010, 7:42:46 PM4/4/10
to 68...@googlegroups.com
I think the only difference from what you wrote is that you are supposed to create other eventHandlers, like "mouseDown" and "mouseUp".  And then have these get called by the eventListeners.  These methods then call pickUp() and drop() to determine what to actually do (e.g. put down the checker or not).  This way when you subclass to CheckerInteractor, you don't have to modify as much code (just the pickUp() and drop()).

Hope that helps!
Sean

On Sun, Apr 4, 2010 at 7:40 PM, Tobe Nwanna <tnw...@mit.edu> wrote:
So I think I'm not fully understanding how MoveInteractor is supposed to work. This is what I'm guessing. When you create a board, a MI subclass (so in this case a CheckerInteractor for instance) is created. Whenever a checker is created you add it to the list of things listened to in CheckerInteractor. Whenever you click on a checker pickUp is called, which checks if it can be dragged and then calls its startDrag() function. When it's released, drop is called and checks whether it can be dropped in that location, then calles it's stopDrag() function. Is this the basic idea?

If so, my question is why don't pickUp and drop take MouseEvents? Is  some other function supposed to take the events and call pickUp and drop?



--
To unsubscribe, reply using "remove me" as the subject.



--
Sean Liu
Massachusetts Institute of Technology
Department of Electrical Engineering & Computer Science '10
(916) 220-4326 | sean...@mit.edu

Tobe Nwanna

unread,
Apr 4, 2010, 7:48:22 PM4/4/10
to 68...@googlegroups.com
So what exactly do startDrag() and stopDrag() do? It seems like I have to implement what happens during dragging anyway so why does it say use them for mouse capture?

Nicole Bieber

unread,
Apr 4, 2010, 7:51:14 PM4/4/10
to 68...@googlegroups.com
They do the dragging. If you've done everything correctly, you
shouldn't have to re-implement dragging for the Pixel model.

>> (916) 220-4326 | sean...@mit.edu <mailto:sean...@mit.edu>
>

Ryan Ko

unread,
Apr 4, 2010, 9:36:41 PM4/4/10
to 68...@googlegroups.com
"Use UIComponent.startDrag() and UIComponent.stopDrag() to do mouse capture. "

Does this mean we have to define startDrag and stopDrag? The way this is phrased implies to me that these should be accessible in documentation but I can't find anything in UIComponent. Anyone care to point me in the right direction? Thank you!

Ryan Ko
Massachusetts Institute of Technology Class of 2011
Department of Electrical Engineering and Computer Science
510.468.6998 || r...@mit.edu
Phi Kappa Theta Fraternity -- "Give, expecting nothing thereof."

Sean Liu (Gmail)

unread,
Apr 4, 2010, 9:38:36 PM4/4/10
to 68...@googlegroups.com
Yea, they didn't show up with Ctrl+Space in my Flex.  But they are predefined.  Just do component.startDrag().  See documentation:

Alex Jiang

unread,
Apr 4, 2010, 9:51:17 PM4/4/10
to 68...@googlegroups.com
When we override the methods, pickUp() and drop(), in the subclass, are
we supposed to be figuring if a checker is being clicked/is the square
is empty? I import ui.Checkerboard, but PPS and board are not being
recognized. Are we supposed to do this outside the class?

Sean Liu (Gmail) wrote:
> Yea, they didn't show up with Ctrl+Space in my Flex. But they are
> predefined. Just do component.startDrag(). See documentation:
> http://livedocs.adobe.com/flex/3/html/help.html?content=05_Display_Programming_14.html
>
> On Sun, Apr 4, 2010 at 9:36 PM, Ryan Ko <ryank...@gmail.com
> <mailto:ryank...@gmail.com>> wrote:
>
> "Use UIComponent.startDrag() and UIComponent.stopDrag() to do
> mouse capture. "
>
> Does this mean we have to define startDrag and stopDrag? The way
> this is phrased implies to me that these should be accessible in
> documentation but I can't find anything in UIComponent. Anyone
> care to point me in the right direction? Thank you!
>
> Ryan Ko
> Massachusetts Institute of Technology Class of 2011
> Department of Electrical Engineering and Computer Science

> 510.468.6998 || r...@mit.edu <mailto:r...@mit.edu>


> Phi Kappa Theta Fraternity -- "Give, expecting nothing thereof."
>
>
>
> On Sun, Apr 4, 2010 at 7:51 PM, Nicole Bieber <nbi...@mit.edu
> <mailto:nbi...@mit.edu>> wrote:
>
> They do the dragging. If you've done everything correctly,
> you shouldn't have to re-implement dragging for the Pixel model.
>
> Tobe Nwanna wrote:
>
> So what exactly do startDrag() and stopDrag() do? It seems
> like I have to implement what happens during dragging
> anyway so why does it say use them for mouse capture?
>
> On 4/4/2010 7:42 PM, Sean Liu (Gmail) wrote:
>
> I think the only difference from what you wrote is
> that you are supposed to create other eventHandlers,
> like "mouseDown" and "mouseUp". And then have these
> get called by the eventListeners. These methods then
> call pickUp() and drop() to determine what to actually
> do (e.g. put down the checker or not). This way when
> you subclass to CheckerInteractor, you don't have to
> modify as much code (just the pickUp() and drop()).
>
> Hope that helps!
> Sean
>
> On Sun, Apr 4, 2010 at 7:40 PM, Tobe Nwanna
> <tnw...@mit.edu <mailto:tnw...@mit.edu>

> <mailto:sean...@mit.edu> <mailto:sean...@mit.edu


> <mailto:sean...@mit.edu>>
>
>
>
>
>
>
>
> --
> Sean Liu
> Massachusetts Institute of Technology
> Department of Electrical Engineering & Computer Science '10

> (916) 220-4326 | sean...@mit.edu <mailto:sean...@mit.edu>

Reply all
Reply to author
Forward
0 new messages