it's better to code and accidentally discover you've used a design pattern,
than beginning to code thinking you have to use a specifick pattern, but
that's just my humble opinion.

On Thu, Mar 20, 2008 at 6:08 PM, Jiri Heitlager <
[EMAIL PROTECTED]> wrote:

> I could use another design pattern, but I need to figure out which one
> then. The application is one where the user can selected certain items
> and those items are put on a canvas. Then when the user selects the item
> on the canvas, a panel shows up that allows the item to be rotated,
> scaled and possible edited ,i.e add text. I thought that the decorator
> would be perfect for this.
> Come to think of it maybe it still is. I really dont ever need to remove
> any decorator that is added do I.
> Them item starts blank and when the user rotates it, I just add a
> decorator, rotatorModifier. Then the decorator  interface has a method
> setModifierProperty(key , value), in this case key = "rot" value=number.
> The decorator component holds a hash and checks if
> hash["rot"]!=undefined, then adds the rot and the value. Then calls an
> update method to reflect the property set.
> Deleting the modifier would be then just setting the hash["rot"] to 0.
>
> Does that make sense and I am approaching this in a efficient way. I am
> quit new to design patterns, but fell in love with there elegance and
> would like to learn how to implement them as best as possible. Some
> feedback would be very much appreciated.
>
> Jiri
>
> Cory Petosky wrote:
> > That's not really how Decorator is meant to work.
> >
> > You could hack around it by exposing the decorated instance in your
> > Decorator interface, digging down to it, and using a bunch of
> > instanceof calls to figure out which is which. I really don't
> > recommend this, though -- instead, use a different design pattern or
> > program architecture.
> >
> > On 3/20/08, Jiri Heitlager <[EMAIL PROTECTED]> wrote:
> >> Hello List,
> >>
> >>  i am looking into the decorator pattern for an upcoming AS2 project. I
> was
> >>  wondering if the following is possible
> >>
> >>  var com:Component = new Component()
> >>
> >>  com = new decoratorA(com)
> >>  com = new decoratorB(decA)
> >>  com = new decoratorC(decB)
> >>
> >>  I cant seem to figure out what I need to do in order to remove let say
> >>  decB at runtime? I tried a search on the internet, but all the
> articles
> >>  about the decorator pattern are about runtime adding, not removing.
> >>
> >>  Can somebody please help me if it is at all possible.
> >>
> >>  Thank you,
> >>
> >>  Jiri
> >>
> >>  _______________________________________________
> >>  Flashcoders mailing list
> >>  Flashcoders@chattyfig.figleaf.com
> >>  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >>
> >
> >
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
M.A. van't Kruis
http://www.malatze.nl/
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to