nihavend opened a new issue #825:
URL: https://github.com/apache/royale-asjs/issues/825


   When click on button, windows should be opened and the the xml should be 
displayed.
   1. It is not displayed and exception thrown
   2. After displayed it might be able to be saved via save button but not.
   
   Flex View : 
   
   
![image](https://user-images.githubusercontent.com/5983818/81298086-f3de5480-907c-11ea-8d21-f2ac638d1994.png)
   
   Royale View : 
   
   
![image](https://user-images.githubusercontent.com/5983818/81298142-06f12480-907d-11ea-8b0b-47da96be3d32.png)
   
   > Exception
   
   
![image](https://user-images.githubusercontent.com/5983818/81297815-803c4780-907c-11ea-9b93-e8959c7df86c.png)
   
   Here is the test case (two sources): 
   
   > 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>
        </fx:Metadata>
        
        <fx:Script>
                <![CDATA[
                        import mx.managers.PopUpManager;
                        
                        import mx.collections.XMLListCollection;
                        import mx.events.FlexEvent;
                        import mx.events.MenuEvent;
                        
                        
                        [Bindable]
                        public var menuBarData2:XMLListCollection = new 
XMLListCollection();
                                
                        protected function 
creationCompleteHandler2(event:FlexEvent):void
                        {
   
                                var roleInfo:String = "ADMIN";
                                
                                var tmpXmlList:XMLListCollection = new 
XMLListCollection();
                                tmpXmlList.source = menuDataXMLList;
                                
                                menuDataXMLList = tmpXmlList.source.copy();
                                
                                menuBarData2.source = menuDataXMLList;
                                
                                menuBarData2.refresh();
   
                        }
                        
                        protected function 
itemClickHandler(event:MenuEvent):void {
                        }
                                                
                        private function dummyMethod(event:MouseEvent):void {
                        }
                        
                        protected function showXML(event:MouseEvent):void {
                                
                                var dummyWindow:DummyForm = 
PopUpManager.createPopUp(this, DummyForm, true) as DummyForm;
                                dummyWindow.title="Job List XML";
                                dummyWindow.htmlTextAsHTML = 
menuBarData2.children().toXMLString();
                                PopUpManager.centerPopUp(dummyWindow);
                                dummyWindow.setFocus();
                                
                        }
                        
                ]]>
        </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="Switch Locale" id="admin" >            
        
                                <menuitem label="label-2-1"/>                   
                                <menuitem label="label-2-2"/>                   
                                <menuitem label="label-2-3" id="admin" />
                        </menuitem>
                </fx:XMLList>
        </fx:Declarations>      
        
        <s:layout>
                <s:VerticalLayout gap="10" paddingRight="10" paddingLeft="10" 
paddingTop="10" paddingBottom="20" />
        </s:layout>
   
        <s:Button label="View XML" click="showXML(event)" visible="true" 
includeInLayout="true"/>
        
        <mx:MenuBar id="menuBar_fx_Declarations" width="100%" 
dataProvider="{menuBarData2}" horizontalCenter="0"
                                itemClick="itemClickHandler(event)" 
                                labelField="@label" 
                                
creationComplete="creationCompleteHandler2(event)"/>
   </s:Application>
   
   ```
   
   > DummyForm.mxml
   
   ```
   <?xml version="1.0"?>
   <!--  borderAlpha="1" -->
   <s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009";
                           xmlns:mx="library://ns.apache.org/royale/mx" 
                           xmlns:s="library://ns.apache.org/royale/spark"
                           width="520" height="450"
                           close="removeMe();" 
keyDown="titleWindow_keyDown(event);"
                           
creationComplete="titlewindow1_creationCompleteHandler(event)">
        <s:layout>
                <s:VerticalLayout/>
        </s:layout>
        
        <fx:Script>
                <![CDATA[
                        import mx.events.CloseEvent;
                        import mx.events.KeyboardEvent;
                        import mx.events.FlexEvent;
                        import mx.managers.PopUpManager;
                        
                        import mx.core.Keyboard;
                        // import flash.ui.Keyboard;
                        import mx.net.FileReference;
                        
                        // import flashx.textLayout.conversion.TextConverter;
                        import 
org.apache.royale.textLayout.conversion.TextConverter;
                        import org.apache.royale.textLayout.elements.TextFlow;
   
                        [Bindable]
                        public var htmlTextAsHTML:String;
   
                        protected function 
titlewindow1_creationCompleteHandler(event:FlexEvent):void {
                                // Alert.show("htmlTextAsHTML : " + 
htmlTextAsHTML);
                                myText.textFlow = 
TextConverter.importToFlow(htmlTextAsHTML, TextConverter.PLAIN_TEXT_FORMAT) as 
TextFlow;
                        }
                        
                        private function 
titleWindow_keyDown(evt:mx.events.KeyboardEvent):void {
                                COMPILE::SWF {var charCode:uint = evt.charCode;}
                                COMPILE::JS {var charCode:uint = evt.keyCode;}  
                                
                                if (charCode == Keyboard.ESCAPE) {
                                        this.dispatchEvent(new 
mx.events.CloseEvent(mx.events.CloseEvent.CLOSE));
                                }
                        }
                        
                        private function removeMe():void {
                                PopUpManager.removePopUp(this);
                        }
                        
                        protected function 
button1_clickHandler(event:MouseEvent):void
                        {
                                var fileReference:FileReference = new 
FileReference();
                                fileReference.save(myText.text, 
"pinaraexport.xml");
                        }
                        
                ]]>
        </fx:Script>
   
        <s:VGroup paddingLeft="10" paddingTop="10">
                <s:Button label="Save" click="button1_clickHandler(event)" 
visible="true" includeInLayout="true"/>
                <s:TextArea id="myText" width="500" height="360" 
textAlign="justify" fontFamily="Arial" fontSize="12" editable="false" />
        </s:VGroup>
        
   </s:TitleWindow> 
   
   ```


----------------------------------------------------------------
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]


Reply via email to