Almost every error has been a null reference and Iv'e either moved the code to 
creationComplete or did as did as Maria said used ternary statements. 
 
The spark and mx comboBox always fails when the dataProvider is initially null. 
The JS checks to see if the labelField is blank and adds "label" as the 
labelField. (I think it's supposed to exit here)The the dp is accesed using the 
labelField and throws an error.  
 
I switched to the Jewel comboBox and all of the null errors disappeared but a 
lot of extra attribute errors. I have a lot of ComboBoxes with some special 
functionality so I extended the Jewel CB and added some attributes that get 
created as beads if not null. I did a global change from s:ComboBox to my 
extended CL:ComboBox, and the system opened login with no errors in the log. 

<j:ComboBox xmlns:fx="http://ns.adobe.com/mxml/2009";
xmlns:j="library://ns.apache.org/royale/jewel">

<fx:Script>
<![CDATA[
[Bindable]public var editable:Boolean = true;
[Bindable]public var enabled:Boolean = true;
[Bindable]public var selected:Boolean = true;
[Bindable]public var restrict:String=null;
]]>
</fx:Script>
</j:ComboBox>
 
 
 

> On 05/02/2024 2:29 PM EDT Maria Jose Esteve <[email protected]> wrote:
>  
>  
> 
> Hi Mark,
> 
> I don't know how the binding in Flex worked internally but if gp is null an 
> error would surely occur, perhaps it was an internal error that was 
> intercepted but...
> 
> I can share with you how I do it, although I don't know if it is the best way:
> 
> <ns7:CustomButtonBar id="topCBB"
> btnA="['Home','Statistics','Network','MCA Grid']"
> btnBoxA="{!gp?[]:[gp.hpc, gp.statisticsCtrl, gp.siteNetworkCtrl, gp.dgBOX]}"
> itemH="36"
> fntSz="16"/>
> 
>  
> 
> Or
> btnBoxA="{!gp?null:[gp.hpc, gp.statisticsCtrl, gp.siteNetworkCtrl, gp.dgBOX]}"
> 
> Or
> btnBoxA="{!gp?[null,null,null,null]:[gp.hpc, gp.statisticsCtrl, 
> gp.siteNetworkCtrl, gp.dgBOX]}"
> 
>  
> 
> It depends on what works for you.
> 
> 
> Hiedra
> 
> De: MARK HARTNETT <[email protected]>
> Enviado el: jueves, 2 de mayo de 2024 18:44
> Para: [email protected]
> Asunto: JS questions
> 
>  
> 
> Hi all,
> 
> All of my errors right now are null references. 
> 
>  
> 
> In this code gp.hpc crashes because hpc is null at this point.
> 
> In Flex, I didn't care about that because once init() was done it was no 
> longer null.
> 
>  
> 
> <ns7:CustomButtonBar id="topCBB"
> btnA="['Home','Statistics','Network','MCA Grid']"
> btnBoxA="{[gp.hpc, gp.statisticsCtrl, gp.siteNetworkCtrl, gp.dgBOX]}"
> itemH="36"
> fntSz="16"/>
> 
>  
> 
> With JS  the null hpc throws an error.
> 
> Moving those variables to creationComplete solves the problem.
> 
>  
> 
> What is the difference with JS binding and Flex in terms of timing and object 
> creation?
> 
> Is there a a bead that allows nulls?
> 
>  
> 
> Thanks
> 
>  
> 
>  
> 

Reply via email to