Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: event system

  1. #1
    Join Date
    Jan 2009
    Posts
    6

    Default event system

    hello!
    is there any plan to include some kind of event system in SAS?
    I'd love to be able to use metadata to add listeners.

    i like the simplicity of the Swiz approach for ex. They use a tag [Mediate=eventName] to add listeners to a global eventdispatcher (bound to the Stage). You then just bubble your events. (Problem being that Swiz targets flex-only projects).
    Is there anything similar in SAS? (existing or planned)
    thanks!

  2. #2

    Default

    +1

    Looking at Swiz they have have done many things right.

    Still loving the unmatched power of the SAS IoC container though and it will be my choice
    for the next project.

    But here another suggestion for the future roadmap:
    Swiz uses mxml for the container which has 2 big advantages:
    - editor support (code completion / error checking etc)
    - no hassle with including classes by hand
    The drawbacks:
    - no config changes without recompiling
    - flex only.

    But investigating more frameworks i stumbled upon Parsley which gives you the choice. Both are supported. That is pretty flexible and suits different needs.

    My question is how hard would it be to add this? For pure actionscript you would still use xml, but for flex you can choose (or even mix...) I know you guys are working really hard so i don't want to sound like a lazy bastard just requesting features.

    Just my 2 cents,

    Arnoud

  3. #3
    Join Date
    Jan 2009
    Posts
    6

    Default

    just to clarify my question: please keep the flash AND flex route. This is what got me to this framework. I m sick of having to change my flow on every new project.

    My question was more: i'm sure that everybody who use SAS has to choose a way to work with events so why not provide a general (non-intrusive) way to handle them?

  4. #4
    Join Date
    Oct 2008
    Location
    Belgium
    Posts
    160

    Default

    Hi guys,

    thanks for your valuable feedback. Here are some answers:

    - we currently do not have support for Mediate metadata. We do have a global/application level event system in the "mvcs" package. Please see the SVN version for more info and don't hesitate to ask any questions about this. The mvcs package is meant to be(come) a set of base classes for architecting your application. I wouldn't necessarily call it a framework on it's own, but it will certainly provide you a guideline.

    - implementing MXML configuration might be quite easy actually. I haven't tried it, but it doesn't seem impossible to fit into the framework. I'm thinking of a MXMLApplicationContext. If anyone has time to experiment with this, I'd be happy to hear about the results.

    cheers,
    Christophe
    Christophe Herreman
    Spring ActionScript Founder
    http://www.herrodius.com

  5. #5
    Join Date
    Jan 2009
    Posts
    6

    Default

    thanks Christophe.
    i had a look at the ApplicationEvent class (and surroundings..)
    Is there any integration possible with the rest of SAS?
    Or do you just use it as a "normal" eventdispatcher?
    am i right in thinking that each view would need a reference to the global dispatcher in order to dispatch an event?

  6. #6
    Join Date
    Oct 2008
    Location
    Belgium
    Posts
    160

    Default

    There is currently no extra support/integration with SAS since we don't want to couple these base classes to much to the core container. However, it is perfectly possible to integrate parts of the mvcs package in the container.

    The views don't really need a direct reference to the central dispatcher. The ApplicationEvent has a dispatch method that will globally dispatch the event vs. the dispatch event of the display list that will bubble the event. So you can choose how you deal with application events. (globally or locally)
    Christophe Herreman
    Spring ActionScript Founder
    http://www.herrodius.com

  7. #7
    Join Date
    Jan 2009
    Posts
    6

    Default

    ok thanks.

    i think what i'd like to do is:
    - have a global dispatcher bound to the stage
    - use a metadata ("Mediate" or something else) to register listeners to this dispatcher
    - use some kind of magic so that any added view is automaticaly scanned for this metadata (so that you don't have to reference any single ui element/view in the xml context).

    so that from the views you can just dispatch usual events, which would bubble down to global dispatcher (no coupling), or from a non-visual element you just use a ref to the global dispatcher to dispatch events.

    (best would be to be able to define multiple dispatchers each bound to a "floor" element so that you could create mini-mvcs and intercept some bubbling events).

    a kind of mix between SAS, Swiz and Mate

    point 1 should be quite easy, for point 2 i ll have a look at the Autowire configuration to see if i understand something... and if someone has any idea for point 3 i'd be glad to hear them

    thanks

  8. #8
    Join Date
    Jun 2009
    Location
    Los Angeles
    Posts
    6

    Default Injecting mxml components into Spring beans.

    One thing I really like about the Swiz framework is the "view autowiring" feature.

    A Swiz bean may have a method with "[autowire(view='true')]" annotation. When Swiz is initialized, it sets up a listener for objects added to the stage, and if those objects matches the rules for view autowiring, then the annotated method is called, allowing the object to be "injected" with a view component.

    What I like is that Swiz allows for view components to be injected into beans. To me, this makes it easy to move code that needs to coordinate multiple view components out of mxml, into an ActionScript class.

    Reading the Reference Documentation, I don't see a way to inject a bean with view components.

    What's the thought on this? Could it be something useful?

  9. #9
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    407

    Default its in v0.8

    The technique you mention is part of the upcoming version 0.8 release:

    http://www.springactionscript.org/do...on.html#d4e518

    The current online documentation isn't complete either, it'll be updated when 0.8 is released officially.

    cheers,

    Roland

  10. #10
    Join Date
    Oct 2008
    Location
    Belgium
    Posts
    160

    Default

    I might be missing something here (or just misinterpreting jlcheng's post), but I think this request is for autowiring ActionScript objects with view components. As far as I know, we only support the other way around (inject object into view, not view into object).
    Christophe Herreman
    Spring ActionScript Founder
    http://www.herrodius.com

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •