nihavend opened a new issue #551: Static references in xml menu data throws exception in runtime URL: https://github.com/apache/royale-asjs/issues/551 When using static references of custom classes in xml data of a component causes the exception below ``` EventDispatcher.js:73 Uncaught TypeError: Cannot read property '1' of null at org.apache.royale.binding.ContainerDataBinding.org.apache.royale.binding.DataBindingBase.makeConstantBinding (DataBindingBase.js:250) at org.apache.royale.binding.ContainerDataBinding.initBindingsHandler (ContainerDataBinding.js:107) at main.mtest.FindBug.goog.events.EventTarget.fireListeners (eventtarget.js:284) at Function.goog.events.EventTarget.dispatchEventInternal_ (eventtarget.js:382) at main.mtest.FindBug.goog.events.EventTarget.dispatchEvent (eventtarget.js:196) at main.mtest.FindBug.org.apache.royale.events.EventDispatcher.dispatchEvent (EventDispatcher.js:70) at main.mtest.FindBug.org.apache.royale.core.HTMLElementWrapper.dispatchEvent (HTMLElementWrapper.js:254) at main.mtest.FindBug.spark.components.SkinnableContainer.createChildren (SkinnableContainer.js:157) at main.mtest.FindBug.mx.core.UIComponent.initialize (UIComponent.js:846) at main.mtest.FindBug.mx.core.UIComponent.addedToParent (UIComponent.js:403) ``` Source codes : UserRole.as ``` package main.mtest { public class UserRole { public static const ADMIN:String = "ADMIN"; public static const OPERATION:String = "OPERATION"; public static const VIEW:String = "VIEW"; } } ``` FindBug.mxml ``` <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.apache.org/royale/spark" xmlns:mx="library://ns.apache.org/royale/mx" paddingBottom="0" paddingTop="0" paddingLeft="0" paddingRight="0" height="100%" width="100%" > <fx:Metadata> [ResourceBundle("messages")] </fx:Metadata> <fx:Script> <![CDATA[ import mx.resources.ResourceManager; import mx.collections.XMLListCollection; import mx.events.FlexEvent; import mx.events.MenuEvent; [Bindable] public var menuBarData:XMLListCollection = new XMLListCollection(); public function onCreationComplete():void { } protected function creationCompleteHandler(event:FlexEvent):void { var tmpXmlList:XMLListCollection = new XMLListCollection(); tmpXmlList.source = menuDataXMLList; menuDataXMLList = tmpXmlList.source.copy(); menuBarData.source = menuDataXMLList; menuBarData.refresh(); } protected function itemClickHandler(event:MenuEvent):void { } ]]> </fx:Script> <fx:Declarations> <fx:XMLList id="menuDataXMLList"> <menuitem label="label-1"> <menuitem label="label-1-1"/> <menuitem label="label-1-2"/> </menuitem> <menuitem label="{resourceManager.getString('messages', 'configFiles')}" id="configfiles" role="{UserRole.OPERATION}"> <menuitem label="label-2-1"/> <menuitem label="label-2-2"/> </menuitem> </fx:XMLList> </fx:Declarations> <s:layout> <s:VerticalLayout gap="10" paddingRight="10" paddingLeft="10" paddingTop="10" paddingBottom="20" /> </s:layout> <mx:MenuBar id="menuBar_fx_Declarations" width="100%" dataProvider="{menuBarData}" horizontalCenter="0" itemClick="itemClickHandler(event)" labelField="@label" creationComplete="creationCompleteHandler(event)"/> </s:Application> ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
