royale-asjs icon indicating copy to clipboard operation
royale-asjs copied to clipboard

issue with PopUpManager.createPopUp

Open Melliti opened this issue 5 years ago • 1 comments

hi,

I have a code which use PopUpManager.createPopUp and it works well on Flex. I must turn it into Apache Royale.

On my index.mxml i have:

<?xml version="1.0" encoding="UTF-8"?>
<ex:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:mx="library://ns.apache.org/royale/mx"
    xmlns:ex="library://ns.apache.org/royale/express"
    xmlns:jw="library://ns.apache.org/royale/jewel"
    xmlns:net="library://ns.apache.org/royale/net"
    xmlns:bs="library://ns.apache.org/royale/basic"
    xmlns:w3="library://ns.apache.org/royale/html"
    xmlns:ns1="components.*">

    <fx:Script>
    <![CDATA[
        import mx.managers.PopUpManager;
        import components.popupChangePass;

        [Bindable]
        public var pop:IFlexDisplayObject;

        public function changePass():void {
            console.log("changePass")
            pop = PopUpManager.createPopUp(this, popupChangePass, true) as IFlexDisplayObject; // Call another mxml
            console.log("changePass2")
            PopUpManager.centerPopUp(pop);
            console.log("changePass3")
        }
	]]>
	</fx:Script>

     <ex:initialView>
        <jw:View id="maVue" currentState="login">
            <jw:Card id="loggedInForm" includeIn="logged">

                <w3:H1 text="You are logged in!! :)"/>
                <jw:HGroup width="100%">
                    <mx:LinkButton label="Bienvenue" id="bt_bienvenue" click="changePass()"/> // Call the method
                </jw:HGroup>
                    <jw:Container id="Container"/>

            </jw:Card>
        </jw:View >
     </ex:initialView>
</ex:Application>

popupChangePass is another mxml with a form that should be displayed in the popup.

It compiles but it produces an error on the browser console:

Cannot read property 'parent' of null

the console.log("change pass 2") is not displayed so the createPopUp fail. The Flex version works so I guess the scope of this is different. And if i console this, it has no parent. I'm not 100% sure because if this is the cause because the js code is obfuscated.

Did someone else used createPopUp before and face this problem before?

Melliti avatar Dec 02 '20 11:12 Melliti

Can someone with emulation experience take a look on this? Thanks

carlosrovira avatar Dec 02 '20 22:12 carlosrovira