Flight Binding Custom Processor

34 views
Skip to first unread message

John Lindquist

unread,
Mar 13, 2010, 10:31:23 PM3/13/10
to swiz-framework
I figured I'd take a stab at building a custom processor. So I put together a processor that uses Flight's binding defined in metadata for pure as3 projects.

How to use:

Processor source:


Thoughts?

Ben Clinkinbeard

unread,
Mar 13, 2010, 11:03:00 PM3/13/10
to swiz-fr...@googlegroups.com
Hey John,

I think that is pretty great. I've never used Flight at all, but this piques my interest in their binding implementation. (I knew they have one, I just haven't looked into it much.)

Just a couple of ideas you can take or leave but that came to mind.

  • [Inject] uses source and destination, but maybe targetPath matches the Flight semantics better?
  • We support class level metadata, so you could potentially do [Bind(source="simpleModel.data", target="helloWorldDisplay.text")] above your class
  • Processors can specify custom tag types if you wanted to encapsulate some of the arg parsing and stuff. See InjectProcessor and InjectMetadataTag for ref.

Great work though, I can't wait to see where you take it. Some planned improvements may even let you make all [Inject] tags in an app use the Flight binding, which could be a cool option.

Ben




--
You received this message because you are subscribed to the Google Groups "Swiz Framework" group.
To post to this group, send email to swiz-fr...@googlegroups.com.
To unsubscribe from this group, send email to swiz-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/swiz-framework?hl=en.

Sam Ahn

unread,
Mar 13, 2010, 11:53:45 PM3/13/10
to swiz-fr...@googlegroups.com
Hi John, never heard of Flight before, but glad to hear there's a good
pure as3 binding tool.

Regarding the processor, keep in mind that there's one instance of the
processor so it'll have to deal with multiple Binding objects. It'll
have to save/retrieve them somehow to property release them during
tear down.

-Sam

--
http://blog.foomonger.com/
http://twitter.com/foomonger/

John Lindquist

unread,
Mar 14, 2010, 9:53:02 AM3/14/10
to swiz-fr...@googlegroups.com
Can you explain a bit more about when teardown happens? I assume I'd
still have access to the metadata args at teardown time if I wanted to
generate a unique key from them?

Sent from my phone

Ben Clinkinbeard

unread,
Mar 14, 2010, 2:23:07 PM3/14/10
to swiz-fr...@googlegroups.com
Hey John,

Right now tearDown happens in response to removedFromStage for view beans, though the trigger event will be customizable any day now. Sam made a good point, which is just that your processor is a (small s) singleton, so your binding property should probably be a Dictionary of binding objects, keyed off of the bean, or a UID for the bean. Since you could have more than one binding per bean, you'd probably want a Dictionary of Arrays, where the key is the bean and the Array is filled with Binding instances.

Something like this: http://gist.github.com/332127 (just pseudo code in tearDown to get the point across)

It's also worth mentioning that the IMetadataProcessor interface's defined methods get all of the metadata tags at once, and it's just a convenience of BaseMetadataProcessor that you can get them one at a time. For something like this it may actually be easier to process all the tags together.

HTH,
Ben

John Lindquist

unread,
Mar 14, 2010, 2:45:20 PM3/14/10
to swiz-fr...@googlegroups.com
Great, that all makes sense. Thanks for the tips Sam and Ben!

Tyler Wright

unread,
Mar 15, 2010, 9:22:53 AM3/15/10
to Swiz Framework
Sorry I'm late to the Party, just joined the mailing list.

I just wanted to share a couple of features of the Flight binding for
others who haven't used it before. First is that all binding is 100%
weak-reference, so if somehow you miss the tear-down phase or some
other scenario the binding won't hold your objects in memory. Second,
the bindings are already stored in a dictionary and can be removed the
same way they were added (via source and sourcePath). Finally we have
a removeAllBindings feature in the works that removes ALL bindings
where the object is either the source or target of the binding.

Activity on the Flight project will be picking up again with the
development of Reflex, which also uses its non-Flex binding, lists and
other AS3 solutions. Mailing list is flight-framework on google
groups.

Great work John, I love seeing how you combine these projects. You're
becoming quite the subject-matter expert.

Tyler Wright


On Mar 14, 12:45 pm, John Lindquist <johnlindqu...@gmail.com> wrote:
> Great, that all makes sense. Thanks for the tips Sam and Ben!
>
>
>
> On Sunday, March 14, 2010, Ben Clinkinbeard <ben.clinkinbe...@gmail.com> wrote:
> > Hey John,
>
> > Right now tearDown happens in response to removedFromStage for view beans, though the trigger event will be customizable any day now. Sam made a good point, which is just that your processor is a (small s) singleton, so your binding property should probably be a Dictionary of binding objects, keyed off of the bean, or a UID for the bean. Since you could have more than one binding per bean, you'd probably want a Dictionary of Arrays, where the key is the bean and the Array is filled with Binding instances.
>

> > Something like this:http://gist.github.com/332127(just pseudo code in tearDown to get the point across)


>
> > It's also worth mentioning that the IMetadataProcessor interface's defined methods get all of the metadata tags at once, and it's just a convenience of BaseMetadataProcessor that you can get them one at a time. For something like this it may actually be easier to process all the tags together.
>
> > HTH,
> > Ben
>

> >>> On Sat, Mar 13, 2010 at 10:31 PM, John Lindquist <johnlindqu...@gmail.com>


> >>> wrote:
>
> >>>> I figured I'd take a stab at building a custom processor. So I put
> >>>> together a processor that uses Flight's binding defined in metadata for pure
> >>>> as3 projects.
> >>>> How to use:
>

> >>>>http://github.com/johnlindquist/swiz-crap/blob/master/src/views/ShowC...
> >>>> Processor source:
>
> >>>>http://github.com/johnlindquist/swiz-crap/blob/master/src/processors/...

Tehsin Bhayani

unread,
Mar 15, 2010, 1:53:57 PM3/15/10
to swiz-fr...@googlegroups.com
Wow that is pretty cool..

Have been meaning to take a look at the Flight Binding, ...this makes
it fairly easy to use in the Swiz projects.

Btw Tyler really enjoyed the presentation you and Jacob put together
on Reflex at 360flex..... Definitely a very exciting project :)

Thanks,

Tehsin

Tyler Wright

unread,
Mar 15, 2010, 4:42:09 PM3/15/10
to swiz-fr...@googlegroups.com
:) thanks!

The discussion on whether to tie the binding into the component framework or keep it out in a more general AS3 library is underway if anyone wants to pitch in on the reflex-platform google group.

Tyler
Reply all
Reply to author
Forward
0 new messages