Thanks, looks like too much trouble for what it's worth...but still glad 
for the insight.

-- Keith H --
www.keith-hair.net

Josh McDonald wrote:
>
> You would need to modify the compiler. MXMLC looks at what's inside 
> your {} brackets, takes a (usually correct) guess as to which property 
> chains should be watched in order to fire the binding, and then 
> creates a new function with a name like __binding_123() or something 
> in the .AS file it is constructing from the containing document. In 
> order to add "self", you'd have to inspect the soon-to-be-function, 
> and replace "self" with the id (field name) for whatever tag/element 
> you're compiling.
>
> But what should "self" be? The enclosing MXML element? What if it 
> represents a field, or a class, and not an instance? And what about 
> when you're doing bindings that are elements of their own right, 
> rather than attributes of an element? And how would we handle 
> repeaters? <mx:Component>? [DefaultProperty]?
>
> As you can see, there'd be a *lot* of situations to evaluate, and a 
> great many edge cases to boot.
>
> On Mon, Nov 17, 2008 at 3:47 PM, Keith <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>     Hello Amy,
>
>     How could I "monkey patch" in Flex that I could use "self" in the
>     brackets?
>
>     This is all I could think of but I don't know how I could use that in
>     the Flex framework....
>      UIComponent.prototype.self=function():UIComponent
>      {
>           return this;
>      }
>
>     If the solution is more trouble than what it's worth...them I'm just
>     getting lazy. :)
>
>
>
>
>     -- Keith H --
>     www.keith-hair.net <http://www.keith-hair.net>
>
>     Amy wrote:
>     >
>     > --- In [email protected]
>     <mailto:[email protected]>
>     > <mailto:flexcoders%40yahoogroups.com
>     <mailto:flexcoders%2540yahoogroups.com>>, Keith <[EMAIL PROTECTED]> wrote:
>     > >
>     > > Thanks Pat,
>     > > Sorry I used a bad example earlier, yes I could do that with
>     events
>     > but
>     > > I meant like using it in other properties that
>     > > "event" is not available. .
>     > >
>     > > Here's a better example situation where I'd wish for a
>     > shortcut "self"
>     > > reference to each component.
>     > > For example if I wanted to assign the current component's
>     height in a
>     > > Binding expression for the current component's width property.
>     > >
>     > > <mx:CheckBox width="{self.height}" />
>     >
>     > You could monkey patch UIComponent and give it a "me" property.
>     >
>     > :-)
>     >
>     >
>
>
>
>     ------------------------------------
>
>     --
>     Flexcoders Mailing List
>     FAQ:
>     http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>     <http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt>
>     Alternative FAQ location:
>     
> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
>     
> <https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847>
>     Search Archives:
>     http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo
>     <http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo>!
>     Groups Links
>
>
>        (Yahoo! ID required)
>
>        mailto:[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>
>
>
>
>
>
> -- 
> "Therefore, send not to know For whom the bell tolls. It tolls for thee."
>
> Like the cut of my jib? Check out my Flex blog!
>
> :: Josh 'G-Funk' McDonald
> :: 0437 221 380 :: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> :: http://flex.joshmcdonald.info/ <http://flex.joshmcdonald.info/>
> :: http://twitter.com/sophistifunk <http://twitter.com/sophistifunk>
>  


Reply via email to