If you want to ensure that the class gets linked but is available at creation up you can use [ClassReference] as the metadata on the property of your component and we’ll link it in so that you don’t have to use bindings.  That should give things to you a little earlier.

 

[ClassReference]

var monkeyClass:Object;

 

Then when you startup look if monkeyClass is a Function (you’re done) or String (pray that it was linked).  But binding becomes unnecessary.  If you always want the class reference you could of course type your variable as Function.

 

Flex 2 will allow you to say that a variable should be of type Class.

 

Is this enough or do you still need the binding stuff later? 

 

Yeah, the deferred instantiation structure to work with binding and all that jazz was pretty insane.  Almost every engineer on the app model was involved in it somewhere J

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Scott Barnes
Sent: Monday, October 24, 2005 4:54 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: BindingManager and Properties interogation.. (Flex 1.5)

 

Hi Matt,

On 10/25/05, Matt Chotin <[EMAIL PROTECTED]> wrote:

Well in this particular example you know that cellRenderer doesn't need to use a binding _expression_, it can be done as a string and we know that CellRenderers are usually classes so we do a lookup?

I should of used a different naming for my attribute. I've created my own MXML tag *component* that in a nutshell does one or more things (rather then occupying verbose XML, i decided to consolidate a few concepts to less tags, resulting in part-instruction, part-creation).

Anyway, the concept is that if i can insert my own attribute within a tag, that has "class signatures" (if thats the correct term), the compiler will also include these classes at compile time... ie if i make no reference to "com.mossyblog.monkey" anywhere but:

<oe:myTag monkeyClass="{ com.mossyblog.monkey }"/> then essentially i'm not only "importing" this class auto-magically, but i'm also setting this tag up to use createClassObject( monkeyClass ) style approach aswell. If i go by using string, then I'll have to assume that somewhere else, this class was imported correctly... figured we are in MXML, why not fly by the seat of our pants hehe.
 

 

But assuming the issue still needs to be solved bindings tend to get assigned right before the initialize event of the component fires.  I don't remember if the document._bindings will even be instantiated by the time createChildren is called on the document, though it might be.  It


It does. The moment mx:Application container gets constructed, we have document._bindings. I've stepped through the frameworks instantiation process overall, and man, how you guys sat down and wrote this framework is amazing (heh, i mean that in terms of, some smart ideas put into play to reduce memory).

I've simply resigned myself to the fact that inside each class, is a variable that has "knownBindingPropertiers" or whatever you want to call it, and it simply cycles through these properties and looks for this._document._bindings[this.id + "." knownBindingProperties[i]]._srcFunc() for the value(s) i need in order to createClassObject or createChild/createComponent.

I've not yet checked to see how FLEX 2.0 framework does the overall construct, but hopefully there is similiar routines in play? ....hopefully...

 

could happen while the app itself is going through its initialize phase and the bindings will be assigned later.  So unfortunately the answer is no, no great way of reliably determining what properties will be assigned into you before you are constructed.

 

The getUIComponentWatcherForDestination is to make the validation errors work correctly, it isn't going to provide what you need.

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Scott Barnes
Sent: Sunday, October 23, 2005 10:09 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: BindingManager and Properties interogation.. (Flex 1.5)

 

Just to add more perspective to this.

I basically want to have the ability to provide an array of some sort, that will turn off binding for a given property and simply add it to a containers properties.

At present if you did cellRenderer="{ whatever  }", that argument wouldn't show up in obj.properties list, unless its a simple string value. It instead gets placed in document._bindings. What i'm trying to do is remove this out of bindings (that or find some way to get information on all known attributes provided within MXML and their values at createChildren())

So far, the only way i can see this being done is to look in two parts, obj.properties and look in obj.document._bindings or obj.document._bindingsByDestination[dest]...

Catch22, is if i do this, i have to *know* all potential properties being passed into a custom MXML components (maybe a simmiliar mergeProperties array maybe?

Anyway, anyone within MM or in this list had much experience with MXML tags and how to intercept various routines before construct commences, i'd greatly appreciate it.

On 10/24/05, Scott Barnes < [EMAIL PROTECTED]> wrote:

Heyas,

I've been wanting to basically access a property on a MXML tag thats not "string", ie cellRenderer="{ com.mossyblog.myRenderer }" before "createComponent" is executed. In that, i want to firstly determine what the renderer is and based on this, delegate that instantion elsewhere.

Now, on first pass i noticed that the moment you place "{}" within an argument, BindingManager basically takes that and treats it as a "binding". How does one ask the BindingManager for that reference at say "createChildren"?

Is it a matter of:

mx.managers.BindingManager.getUIComponentWatcherForDestination(this, this.id )

--
Regards,
Scott Barnes
http://www.mossyblog.com




--
Regards,
Scott Barnes
http://www.mossyblog.com



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com



YAHOO! GROUPS LINKS

 

 





--
Regards,
Scott Barnes
http://www.mossyblog.com


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to