Hi Gustavo,

please check this commit:

https://github.com/apache/royale-asjs/commit/165393449114c215e80e538644c03b00c7e42ba5

I uploaded a working example in TDJ about how to instantiate a PopUp via
AS3. I don't see any issue. Maybe there's a language barrier. If you think
there's some issue, please let me know with more detail so I can try to
identify it.

Thanks! :)

Carlos



El mar., 17 dic. 2019 a las 3:43, De Carli Gustavo (<
[email protected]>) escribió:

> Carlos, I think the error is classified with this post.
>
>
> http://apache-royale-development.20373.n8.nabble.com/TypeError-this-generateMXMLAttributes-is-not-a-function-td8881.html
>
> thk.
>
> El lun., 16 dic. 2019 a las 19:11, De Carli Gustavo (<
> [email protected]>) escribió:
>
>>
>> Carlos No. both examples didn't work for me .
>> About your comment, MyPopup already has inside a label component.
>>
>>
>>
>>
>>
>> El lun., 16 dic. 2019 a las 15:59, Carlos Rovira (<
>> [email protected]>) escribió:
>>
>>> Hi Gustavo,
>>>
>>> I didn't understand if you finally get it working or not, can you
>>> specify?
>>> thanks
>>> Carlos
>>>
>>> El lun., 16 dic. 2019 a las 18:52, De Carli Gustavo (<
>>> [email protected]>) escribió:
>>>
>>>>
>>>> Carlos: thank, Yes, those examples were where we started from. Now
>>>> MyPopup already has a label (StyledUIBase) inside.
>>>>
>>>> MyPopup.mxml
>>>>
>>>> <?xml version="1.0" encoding="utf-8"?>
>>>> <j:PopUp xmlns:fx="http://ns.adobe.com/mxml/2009";
>>>> xmlns:j="library://ns.apache.org/royale/jewel">
>>>>
>>>> <j:Label text="Hello External"/>
>>>>
>>>> </j:PopUp>
>>>>
>>>>
>>>> It was also tested in this way, by code and not in mxml.
>>>>
>>>> public function popupByAS(event:Event):void
>>>> {
>>>> trace('In method byAs');
>>>> var onePopup:MyPopup = new MyPopup();
>>>> var oneLabel2:Label = new Label();
>>>> oneLabel2.text = "Hi !!";
>>>> onePopup.content = oneLabel2;
>>>> this.addElement(onePopup);
>>>>
>>>> onePopup.open = true;
>>>> }
>>>>
>>>>
>>>> Thanks for your time
>>>> Gustavo.
>>>>
>>>>
>>>>
>>>> El lun., 16 dic. 2019 a las 13:43, Carlos Rovira (<
>>>> [email protected]>) escribió:
>>>>
>>>>> Hi Gustavo,
>>>>>
>>>>> thanks for your kindly words :)
>>>>>
>>>>> About your problem, I don't see in the code exposed that you are
>>>>> adding MyPopup to the onePopup instance
>>>>>
>>>>> Popup has Defaultproperty "content". you must create and assign to it
>>>>>
>>>>> In Tour De Jewel: https://royale.apache.org/tourdejewel/
>>>>> You can see this:
>>>>> https://github.com/apache/royale-asjs/blob/develop/examples/royale/TourDeJewel/src/main/royale/PopUpPlayGround.mxml
>>>>>
>>>>> <j:PopUp id="popup2"
>>>>> closePopUp="popupFormContent.formValidator.removeAllErrorTips()">
>>>>> <c:FormExample localId="popupFormContent" label="Form example in a
>>>>> PopUp" width="490" height="392"/>
>>>>> </j:PopUp>
>>>>>
>>>>>
>>>>> since content is Default property we can nest FormExample directly in
>>>>> the instance
>>>>>
>>>>> in AS you need to add to content
>>>>>
>>>>> Best
>>>>>
>>>>> Carlos
>>>>>
>>>>>
>>>>>
>>>>> El lun., 16 dic. 2019 a las 17:27, De Carli Gustavo (<
>>>>> [email protected]>) escribió:
>>>>>
>>>>>> Carlos, Thanks for your prompt response. It fix !!! Now we are
>>>>>> dealing with an external Popup, all this is for the migration of
>>>>>> TitleWindow of flex to royale. We believe it is the best way. Take this
>>>>>> opportunity to congratulate the framework, hopefully you have the first
>>>>>> release version.
>>>>>> Gustavo.
>>>>>>
>>>>>> public function popupByAS(event:Event):void
>>>>>> {
>>>>>> trace('In method byAs');
>>>>>> var onePopup:MyPopup = new MyPopup();
>>>>>> this.addElement(onePopup);
>>>>>>
>>>>>> onePopup.open = true;
>>>>>> }
>>>>>>
>>>>>>
>>>>>> Where MyPopup.mxml
>>>>>> <?xml version="1.0" encoding="utf-8"?>
>>>>>> <j:PopUp xmlns:fx="http://ns.adobe.com/mxml/2009";
>>>>>> xmlns:j="library://ns.apache.org/royale/jewel">
>>>>>>
>>>>>> <j:Label text="Hello External"/>
>>>>>>
>>>>>> </j:PopUp>
>>>>>>
>>>>>> MyPopup.js:42 Uncaught TypeError: this.generateMXMLAttributes is not
>>>>>> a function
>>>>>>     at new main.components.Form.MyPopup (MyPopup.js:42)
>>>>>>     at Main.popupByAS (Main.mxml:22)
>>>>>>     at Main.$EH1 (Main.mxml:51)
>>>>>>     at Function.goog.events.fireListener [as googFireListener]
>>>>>> (events.js:753)
>>>>>>     at
>>>>>> Object.org.apache.royale.core.HTMLElementWrapper.fireListenerOverride [as
>>>>>> fireListener] (HTMLElementWrapper.js:53)
>>>>>>     at HTMLButtonElement.goog.events.handleBrowserEvent_
>>>>>> (events.js:879)
>>>>>>     at HTMLButtonElement.f (events.js:296)
>>>>>>
>>>>>> El lun., 16 dic. 2019 a las 13:11, Carlos Rovira (<
>>>>>> [email protected]>) escribió:
>>>>>>
>>>>>>> Hi Carli,
>>>>>>>
>>>>>>> the main problem is that you need to add to the parent the popup
>>>>>>> created with
>>>>>>>
>>>>>>> addElement(onePopup);
>>>>>>>
>>>>>>> Notice that each time you'll be creating one popup and adding to the
>>>>>>> container, so maybe you need to create some logic to ensure creation and
>>>>>>> addition to parent is done just one time.
>>>>>>>
>>>>>>> An additional issue (that does not gives error) is that click event
>>>>>>> handlers has binding expressions. That's not needed
>>>>>>>
>>>>>>> instead of
>>>>>>>
>>>>>>> click="{this.popByMethod.open = true}"
>>>>>>>
>>>>>>> you write only:
>>>>>>>
>>>>>>> click="popByMethod.open = true"
>>>>>>>
>>>>>>>
>>>>>>> HTH
>>>>>>>
>>>>>>> Carlos
>>>>>>>
>>>>>>>
>>>>>>> El lun., 16 dic. 2019 a las 17:03, Carlos Rovira (<
>>>>>>> [email protected]>) escribió:
>>>>>>>
>>>>>>>> Hi Carli,
>>>>>>>> I'm going to try your code and see what I can report about it
>>>>>>>>
>>>>>>>> El lun., 16 dic. 2019 a las 16:56, De Carli Gustavo (<
>>>>>>>> [email protected]>) escribió:
>>>>>>>>
>>>>>>>>> Hello, someone could be oriented because I do not have the same
>>>>>>>>> behavior in the creation of a popup by msxml than by as. thank you 
>>>>>>>>> very much
>>>>>>>>> Method, popupByAs, is the problem, does nothing.
>>>>>>>>>
>>>>>>>>> thank
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> <?xml version="1.0" encoding="utf-8"?>
>>>>>>>>> <j:Application xmlns:fx="http://ns.adobe.com/mxml/2009";
>>>>>>>>> xmlns:html="library://ns.apache.org/royale/html"
>>>>>>>>> xmlns:j="library://ns.apache.org/royale/jewel"
>>>>>>>>> xmlns:Button="main.components.Button.*"
>>>>>>>>> xmlns:Form="main.components.Form.*"
>>>>>>>>> xmlns:js="library://ns.apache.org/royale/basic"
>>>>>>>>> xmlns:c="components.*">
>>>>>>>>>
>>>>>>>>> <fx:Script>
>>>>>>>>> <![CDATA[
>>>>>>>>>
>>>>>>>>> import org.apache.royale.events.Event;
>>>>>>>>> import org.apache.royale.jewel.Button;
>>>>>>>>> import org.apache.royale.jewel.PopUp;
>>>>>>>>>
>>>>>>>>> public function popupByAS(event:Event):void
>>>>>>>>> {
>>>>>>>>> trace('In method byAs');
>>>>>>>>> var oneLabel:Label = new Label();
>>>>>>>>> oneLabel.text = "Hello by As";
>>>>>>>>> oneLabel.visible = true;
>>>>>>>>>
>>>>>>>>> var onePopup:PopUp = new PopUp();
>>>>>>>>> onePopup.content = oneLabel;
>>>>>>>>>
>>>>>>>>> onePopup.open = true;
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> ]]>
>>>>>>>>> </fx:Script>
>>>>>>>>>
>>>>>>>>> <j:initialView>
>>>>>>>>> <j:View>
>>>>>>>>> <j:Button id="btnByInMXML"
>>>>>>>>> text="By Method MXML"
>>>>>>>>> x="10"
>>>>>>>>> y="200"
>>>>>>>>> emphasis="primary"
>>>>>>>>> click="{this.popByMethod.open = true}"/>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> <j:PopUp id="popByMethod">
>>>>>>>>> <j:Label id="lblByMethod" text="Hello Method XML"/>
>>>>>>>>> </j:PopUp>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> <j:Button id="btnByInAS"
>>>>>>>>> text="By Metodo AS"
>>>>>>>>> x="10"
>>>>>>>>> y="200"
>>>>>>>>> emphasis="primary"
>>>>>>>>> click="{this.popupByAS(event)}"/>
>>>>>>>>> </j:View>
>>>>>>>>> </j:initialView>
>>>>>>>>> </j:Application>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Carlos Rovira
>>>>>>>> http://about.me/carlosrovira
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Carlos Rovira
>>>>>>> http://about.me/carlosrovira
>>>>>>>
>>>>>>>
>>>>>
>>>>> --
>>>>> Carlos Rovira
>>>>> http://about.me/carlosrovira
>>>>>
>>>>>
>>>
>>> --
>>> Carlos Rovira
>>> http://about.me/carlosrovira
>>>
>>>

-- 
Carlos Rovira
http://about.me/carlosrovira

Reply via email to