[Pixlib] PixLib MVC, where should Key triggers go?
Tim Will
thedigitalartist at gmail.com
Thu Mar 8 19:20:39 EST 2007
Hey Jon,
I would definitely put them in a view! Use the view to trap the key input -
but don't do any logic there. You want to keep the logic separate from the
user interaction. So, if the response to the user gesture is just a
cosmetic one, and no model needs to be updated, you can have a simple
control matched to the view (a good example might be a rollover - it's just
a simple animation change, and no other view or model needs to be informed).
But if the key press triggers any kind of data change - this is where you
will follow your event/frontcontroller/command/model flow.
It's important to keep in mind two things:
-views are not just for graphics, anything that results in a model needing
to change should originate at a view
-to the application, the user is just another model :) Who do models 'talk'
to? Only views....
-tim.
On 3/8/07, Jon Bennett <jmbennett at gmail.com> wrote:
>
> hi,
>
> I need to capture some key commands (left right arrow keys) in my
> project and I'm not 100% sure where I should put the code.
>
> Should it go in the view, where the buttons that trigger the events
> are at the moment?
>
> I don't think they should be a command, I could put them in
> Application, but that doesn't feel right, any ideas?
>
> thanks,
>
> Jon
>
> --
>
>
> jon bennett
> t: +44 (0) 1225 341 039 w: http://www.jben.net/
> iChat (AIM): jbendotnet Skype: jon-bennett
>
> _______________________________________________
> Pixlib mailing list
> Pixlib at osflash.org
> http://osflash.org/mailman/listinfo/pixlib_osflash.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/pixlib_osflash.org/attachments/20070308/452b06dd/attachment.htm
More information about the Pixlib
mailing list