ObjectProxy

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

ObjectProxy

hiedra

Hi,

I have passed a class that I had, in my Flex project, to load language xml, into an objectproxy and accessed after obj.namevar mode.

When we instantiate the ObjectProxy object, the system throws an “ObjectProxy not implemented” trace.

The "js" that is created:

 

 

It seems that the trace is informative ...

I'm going to see the ObjectProxy.as class and see that everything is commented:

 

 

I am "confused", is the ObjectProxy implemented?

 

Thanks.

Hiedra.

 

 

Reply | Threaded
Open this post in threaded view
|

Re: ObjectProxy

Alex Harui-2

I don’t think we’ve emulated ObjectProxy.  All Proxy usage (even ArrayCollection) is problematic in JavaScript because the JS runtime does not know about our Proxy implementation so you have to strongly type access to the instances.    If you only have a few accesses it is doable.  There is a JavaScript Proxy implementation, but there is no support for IE.

 

If you are not using Internet Explorer, you can try creating your own data class based on JavaScript Proxy.  If you need IE support, let’s discuss what that class did and see if there is some other way to do it.

 

-Alex

 

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 8:21 AM
To: "[hidden email]" <[hidden email]>
Subject: ObjectProxy

 

Hi,

I have passed a class that I had, in my Flex project, to load language xml, into an objectproxy and accessed after obj.namevar mode.

When we instantiate the ObjectProxy object, the system throws an “ObjectProxy not implemented” trace.

The "js" that is created:

 

cid:image001.png@01D5DD11.5D0CF350

 

It seems that the trace is informative ...

I'm going to see the ObjectProxy.as class and see that everything is commented:

 

cid:image002.jpg@01D5DD11.9DAB9D30

 

I am "confused", is the ObjectProxy implemented?

 

Thanks.

Hiedra.

 

 

Reply | Threaded
Open this post in threaded view
|

RE: ObjectProxy

hiedra

Thanks for answering, Alex.

 

The truth is that it is a transversal object, we use it throughout the application so that the texts appear in the language that the user selects.

I have to say that as it works, of course, I imagine that we are working with a masked Object type, so the performance will not be the best.

For now, we are going to leave it that way, because I do not feel prepared to look at, or modify, not a single line of code outside my project: P (If someone experienced decides to do something about it, I offer to help in debugging)

 

Thanks Alex.

Greetings.

 

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: jueves, 6 de febrero de 2020 18:16
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I don’t think we’ve emulated ObjectProxy.  All Proxy usage (even ArrayCollection) is problematic in JavaScript because the JS runtime does not know about our Proxy implementation so you have to strongly type access to the instances.    If you only have a few accesses it is doable.  There is a JavaScript Proxy implementation, but there is no support for IE.

 

If you are not using Internet Explorer, you can try creating your own data class based on JavaScript Proxy.  If you need IE support, let’s discuss what that class did and see if there is some other way to do it.

 

-Alex

 

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 8:21 AM
To: "[hidden email]" <[hidden email]>
Subject: ObjectProxy

 

Hi,

I have passed a class that I had, in my Flex project, to load language xml, into an objectproxy and accessed after obj.namevar mode.

When we instantiate the ObjectProxy object, the system throws an “ObjectProxy not implemented” trace.

The "js" that is created:

 

cid:image001.png@01D5DD11.5D0CF350

 

It seems that the trace is informative ...

I'm going to see the ObjectProxy.as class and see that everything is commented:

 

cid:image002.jpg@01D5DD11.9DAB9D30

 

I am "confused", is the ObjectProxy implemented?

 

Thanks.

Hiedra.

 

 

Reply | Threaded
Open this post in threaded view
|

Re: ObjectProxy

Alex Harui-2

I’m confused about what your plan is.  I believe that something has to change.  I’m not sure Royale should just implement an ObjectProxy on top of JavaScript proxy if it doesn’t work on IE.

 

Do you need to support IE?  Once we know that, if you can show us a reduced example of how that object worked, we can help you emulate it for your application.

 

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 9:34 AM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

Thanks for answering, Alex.

 

The truth is that it is a transversal object, we use it throughout the application so that the texts appear in the language that the user selects.

I have to say that as it works, of course, I imagine that we are working with a masked Object type, so the performance will not be the best.

For now, we are going to leave it that way, because I do not feel prepared to look at, or modify, not a single line of code outside my project: P (If someone experienced decides to do something about it, I offer to help in debugging)

 

Thanks Alex.

Greetings.

 

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: jueves, 6 de febrero de 2020 18:16
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I don’t think we’ve emulated ObjectProxy.  All Proxy usage (even ArrayCollection) is problematic in JavaScript because the JS runtime does not know about our Proxy implementation so you have to strongly type access to the instances.    If you only have a few accesses it is doable.  There is a JavaScript Proxy implementation, but there is no support for IE.

 

If you are not using Internet Explorer, you can try creating your own data class based on JavaScript Proxy.  If you need IE support, let’s discuss what that class did and see if there is some other way to do it.

 

-Alex

 

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 8:21 AM
To: "[hidden email]" <[hidden email]>
Subject: ObjectProxy

 

Hi,

I have passed a class that I had, in my Flex project, to load language xml, into an objectproxy and accessed after obj.namevar mode.

When we instantiate the ObjectProxy object, the system throws an “ObjectProxy not implemented” trace.

The "js" that is created:

 

cid:image001.png@01D5DD11.5D0CF350

 

It seems that the trace is informative ...

I'm going to see the ObjectProxy.as class and see that everything is commented:

 

cid:image002.jpg@01D5DD11.9DAB9D30

 

I am "confused", is the ObjectProxy implemented?

 

Thanks.

Hiedra.

 

 

Reply | Threaded
Open this post in threaded view
|

RE: ObjectProxy

hiedra

xD, you confused and I, hallucinated.

It works well with IE, Chrome and Firefox.

 

I am aware that "we should not leave it that way", but the lack of time and knowledge makes me "conform", for now ...

 

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: jueves, 6 de febrero de 2020 18:39
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I’m confused about what your plan is.  I believe that something has to change.  I’m not sure Royale should just implement an ObjectProxy on top of JavaScript proxy if it doesn’t work on IE.

 

Do you need to support IE?  Once we know that, if you can show us a reduced example of how that object worked, we can help you emulate it for your application.

 

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 9:34 AM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

Thanks for answering, Alex.

 

The truth is that it is a transversal object, we use it throughout the application so that the texts appear in the language that the user selects.

I have to say that as it works, of course, I imagine that we are working with a masked Object type, so the performance will not be the best.

For now, we are going to leave it that way, because I do not feel prepared to look at, or modify, not a single line of code outside my project: P (If someone experienced decides to do something about it, I offer to help in debugging)

 

Thanks Alex.

Greetings.

 

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: jueves, 6 de febrero de 2020 18:16
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I don’t think we’ve emulated ObjectProxy.  All Proxy usage (even ArrayCollection) is problematic in JavaScript because the JS runtime does not know about our Proxy implementation so you have to strongly type access to the instances.    If you only have a few accesses it is doable.  There is a JavaScript Proxy implementation, but there is no support for IE.

 

If you are not using Internet Explorer, you can try creating your own data class based on JavaScript Proxy.  If you need IE support, let’s discuss what that class did and see if there is some other way to do it.

 

-Alex

 

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 8:21 AM
To: "[hidden email]" <[hidden email]>
Subject: ObjectProxy

 

Hi,

I have passed a class that I had, in my Flex project, to load language xml, into an objectproxy and accessed after obj.namevar mode.

When we instantiate the ObjectProxy object, the system throws an “ObjectProxy not implemented” trace.

The "js" that is created:

 

cid:image001.png@01D5DD11.5D0CF350

 

It seems that the trace is informative ...

I'm going to see the ObjectProxy.as class and see that everything is commented:

 

cid:image002.jpg@01D5DD11.9DAB9D30

 

I am "confused", is the ObjectProxy implemented?

 

Thanks.

Hiedra.

 

 

Reply | Threaded
Open this post in threaded view
|

Re: ObjectProxy

Alex Harui-2

I’m not sure I understood your response.  If you have an example of your class that extends ObjectProxy, we can help you get it to work in Royale.

 

Thanks,

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 3:04 PM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

xD, you confused and I, hallucinated.

It works well with IE, Chrome and Firefox.

 

I am aware that "we should not leave it that way", but the lack of time and knowledge makes me "conform", for now ...

 

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: jueves, 6 de febrero de 2020 18:39
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I’m confused about what your plan is.  I believe that something has to change.  I’m not sure Royale should just implement an ObjectProxy on top of JavaScript proxy if it doesn’t work on IE.

 

Do you need to support IE?  Once we know that, if you can show us a reduced example of how that object worked, we can help you emulate it for your application.

 

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 9:34 AM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

Thanks for answering, Alex.

 

The truth is that it is a transversal object, we use it throughout the application so that the texts appear in the language that the user selects.

I have to say that as it works, of course, I imagine that we are working with a masked Object type, so the performance will not be the best.

For now, we are going to leave it that way, because I do not feel prepared to look at, or modify, not a single line of code outside my project: P (If someone experienced decides to do something about it, I offer to help in debugging)

 

Thanks Alex.

Greetings.

 

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: jueves, 6 de febrero de 2020 18:16
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I don’t think we’ve emulated ObjectProxy.  All Proxy usage (even ArrayCollection) is problematic in JavaScript because the JS runtime does not know about our Proxy implementation so you have to strongly type access to the instances.    If you only have a few accesses it is doable.  There is a JavaScript Proxy implementation, but there is no support for IE.

 

If you are not using Internet Explorer, you can try creating your own data class based on JavaScript Proxy.  If you need IE support, let’s discuss what that class did and see if there is some other way to do it.

 

-Alex

 

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 8:21 AM
To: "[hidden email]" <[hidden email]>
Subject: ObjectProxy

 

Hi,

I have passed a class that I had, in my Flex project, to load language xml, into an objectproxy and accessed after obj.namevar mode.

When we instantiate the ObjectProxy object, the system throws an “ObjectProxy not implemented” trace.

The "js" that is created:

 

cid:image001.png@01D5DD11.5D0CF350

 

It seems that the trace is informative ...

I'm going to see the ObjectProxy.as class and see that everything is commented:

 

cid:image002.jpg@01D5DD11.9DAB9D30

 

I am "confused", is the ObjectProxy implemented?

 

Thanks.

Hiedra.

 

 

Reply | Threaded
Open this post in threaded view
|

RE: ObjectProxy

hiedra

Sorry, look ...

LanManager.as receives an XML file and loads it into an objectproxy [idref]; exposes the getRef function (ref: String = "") that will return the text associated with the "ref" parameter in the loaded language xml:

 

package com.iest.wnetsuiteplus.utils

{

import org.apache.royale.events.EventDispatcher;

import mx.utils.ObjectProxy;

            import mx.rpc.events.ResultEvent;

            import com.iest.wnetsuiteplus.vo.DataLanManager;

            import org.apache.royale.events.Event;

           

            /** Language Manager based on an asociative array */

            [Bindable]

            public class LanManager extends EventDispatcher

            {

 

                        public var lanId:String;

                        private var pairsObj:DataLanManager;

                        public var idref:ObjectProxy;

                       

                        public function LanManager() {                            

                                    reset();

                        }

                       

                        /** Deletes all the data but the idref */

                        public function reset():void

                        {

                                    pairsObj = new DataLanManager();

                                    idref = new ObjectProxy(pairsObj);

                        }

                       

                        /** Once the xml is loaded, it will be parsed to populate the

                         * "words" array and it will dispatch an Event of type "XML_PARSED" constant */

                        public function xmlLoaderHandler(e:ResultEvent):void

                        {

                                    var nodes:XMLList = e.result.children();

                                    trace("Got "+nodes.length()+" items");

                                   

                                    for each(var node:XML in nodes)

                                    {

                                               var ref:String = [hidden email];

                                               ref = ref.toLowerCase();

                                               var text:String = [hidden email];

                                               idref[ref] = text;

                                    }

                                   

                                    dispatchEvent(new Event("idrefPUpdate"));

                        }

 

                        [Bindable(event="idrefPUpdate")]

                        public function getRef(ref:String="",outDefault:Boolean = true):String

                        {

                                    var paramref:String = ref.toLowerCase();

                                    var res:String=paramref;

                                              

                                    if(idref[paramref]){

                                               res = idref[paramref];

                                    }else{

                                               if(!outDefault){

                                                           res = null;

                                                            return res;

                                               }

                                    }

                                    return res;

                        }

                       

            }

 

}

 

Although objectProxy is supposed to give an error, it "works" and I imagine it is because it is taking it as an "Object".

 

We use it like this:          <j:Label localId="popupCurrPass" text="{langModel.lang.getRef('pwdact')}"/>

 

Surely you see "Binding" the Binding, but in Royale it does not work with functions and in this way it does work 😝

 

What do you think?, is he taking it as an Object or what is it that makes it work?

 

Thanks Alex.

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: viernes, 7 de febrero de 2020 0:35
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I’m not sure I understood your response.  If you have an example of your class that extends ObjectProxy, we can help you get it to work in Royale.

 

Thanks,

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 3:04 PM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

xD, you confused and I, hallucinated.

It works well with IE, Chrome and Firefox.

 

I am aware that "we should not leave it that way", but the lack of time and knowledge makes me "conform", for now ...

 

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: jueves, 6 de febrero de 2020 18:39
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I’m confused about what your plan is.  I believe that something has to change.  I’m not sure Royale should just implement an ObjectProxy on top of JavaScript proxy if it doesn’t work on IE.

 

Do you need to support IE?  Once we know that, if you can show us a reduced example of how that object worked, we can help you emulate it for your application.

 

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 9:34 AM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

Thanks for answering, Alex.

 

The truth is that it is a transversal object, we use it throughout the application so that the texts appear in the language that the user selects.

I have to say that as it works, of course, I imagine that we are working with a masked Object type, so the performance will not be the best.

For now, we are going to leave it that way, because I do not feel prepared to look at, or modify, not a single line of code outside my project: P (If someone experienced decides to do something about it, I offer to help in debugging)

 

Thanks Alex.

Greetings.

 

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: jueves, 6 de febrero de 2020 18:16
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I don’t think we’ve emulated ObjectProxy.  All Proxy usage (even ArrayCollection) is problematic in JavaScript because the JS runtime does not know about our Proxy implementation so you have to strongly type access to the instances.    If you only have a few accesses it is doable.  There is a JavaScript Proxy implementation, but there is no support for IE.

 

If you are not using Internet Explorer, you can try creating your own data class based on JavaScript Proxy.  If you need IE support, let’s discuss what that class did and see if there is some other way to do it.

 

-Alex

 

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 8:21 AM
To: "[hidden email]" <[hidden email]>
Subject: ObjectProxy

 

Hi,

I have passed a class that I had, in my Flex project, to load language xml, into an objectproxy and accessed after obj.namevar mode.

When we instantiate the ObjectProxy object, the system throws an “ObjectProxy not implemented” trace.

The "js" that is created:

 

cid:image001.png@01D5DD11.5D0CF350

 

It seems that the trace is informative ...

I'm going to see the ObjectProxy.as class and see that everything is commented:

 

cid:image002.jpg@01D5DD11.9DAB9D30

 

I am "confused", is the ObjectProxy implemented?

 

Thanks.

Hiedra.

 

 

Reply | Threaded
Open this post in threaded view
|

Re: ObjectProxy

Alex Harui-2

I’m pretty sure the reason it works is because of the loop were the XML is examined and idref is populated.  I’ll bet even in the Flex version it would work using Object instead of ObjectProxy.  ObjectProxy mainly exists to detect changes to properties on plain object and trigger bindings.  Unless the values in idref change at runtime, you don’t really need ObjectProxy.

 

HTH,

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 4:06 PM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

Sorry, look ...

LanManager.as receives an XML file and loads it into an objectproxy [idref]; exposes the getRef function (ref: String = "") that will return the text associated with the "ref" parameter in the loaded language xml:

 

package com.iest.wnetsuiteplus.utils

{

import org.apache.royale.events.EventDispatcher;

import mx.utils.ObjectProxy;

            import mx.rpc.events.ResultEvent;

            import com.iest.wnetsuiteplus.vo.DataLanManager;

            import org.apache.royale.events.Event;

           

            /** Language Manager based on an asociative array */

            [Bindable]

            public class LanManager extends EventDispatcher

            {

 

                        public var lanId:String;

                        private var pairsObj:DataLanManager;

                        public var idref:ObjectProxy;

                       

                        public function LanManager() {                            

                                    reset();

                        }

                       

                        /** Deletes all the data but the idref */

                        public function reset():void

                        {

                                    pairsObj = new DataLanManager();

                                    idref = new ObjectProxy(pairsObj);

                        }

                       

                        /** Once the xml is loaded, it will be parsed to populate the

                         * "words" array and it will dispatch an Event of type "XML_PARSED" constant */

                        public function xmlLoaderHandler(e:ResultEvent):void

                        {

                                    var nodes:XMLList = e.result.children();

                                    trace("Got "+nodes.length()+" items");

                                   

                                    for each(var node:XML in nodes)

                                    {

                                               var ref:String = [hidden email];

                                               ref = ref.toLowerCase();

                                               var text:String = [hidden email];

                                               idref[ref] = text;

                                    }

                                   

                                    dispatchEvent(new Event("idrefPUpdate"));

                        }

 

                        [Bindable(event="idrefPUpdate")]

                        public function getRef(ref:String="",outDefault:Boolean = true):String

                        {

                                    var paramref:String = ref.toLowerCase();

                                    var res:String=paramref;

                                              

                                    if(idref[paramref]){

                                               res = idref[paramref];

                                    }else{

                                               if(!outDefault){

                                                           res = null;

                                                            return res;

                                               }

                                    }

                                    return res;

                        }

                       

            }

 

}

 

Although objectProxy is supposed to give an error, it "works" and I imagine it is because it is taking it as an "Object".

 

We use it like this:          <j:Label localId="popupCurrPass" text="{langModel.lang.getRef('pwdact')}"/>

 

Surely you see "Binding" the Binding, but in Royale it does not work with functions and in this way it does work 😝

 

What do you think?, is he taking it as an Object or what is it that makes it work?

 

Thanks Alex.

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: viernes, 7 de febrero de 2020 0:35
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I’m not sure I understood your response.  If you have an example of your class that extends ObjectProxy, we can help you get it to work in Royale.

 

Thanks,

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 3:04 PM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

xD, you confused and I, hallucinated.

It works well with IE, Chrome and Firefox.

 

I am aware that "we should not leave it that way", but the lack of time and knowledge makes me "conform", for now ...

 

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: jueves, 6 de febrero de 2020 18:39
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I’m confused about what your plan is.  I believe that something has to change.  I’m not sure Royale should just implement an ObjectProxy on top of JavaScript proxy if it doesn’t work on IE.

 

Do you need to support IE?  Once we know that, if you can show us a reduced example of how that object worked, we can help you emulate it for your application.

 

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 9:34 AM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

Thanks for answering, Alex.

 

The truth is that it is a transversal object, we use it throughout the application so that the texts appear in the language that the user selects.

I have to say that as it works, of course, I imagine that we are working with a masked Object type, so the performance will not be the best.

For now, we are going to leave it that way, because I do not feel prepared to look at, or modify, not a single line of code outside my project: P (If someone experienced decides to do something about it, I offer to help in debugging)

 

Thanks Alex.

Greetings.

 

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: jueves, 6 de febrero de 2020 18:16
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I don’t think we’ve emulated ObjectProxy.  All Proxy usage (even ArrayCollection) is problematic in JavaScript because the JS runtime does not know about our Proxy implementation so you have to strongly type access to the instances.    If you only have a few accesses it is doable.  There is a JavaScript Proxy implementation, but there is no support for IE.

 

If you are not using Internet Explorer, you can try creating your own data class based on JavaScript Proxy.  If you need IE support, let’s discuss what that class did and see if there is some other way to do it.

 

-Alex

 

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 8:21 AM
To: "[hidden email]" <[hidden email]>
Subject: ObjectProxy

 

Hi,

I have passed a class that I had, in my Flex project, to load language xml, into an objectproxy and accessed after obj.namevar mode.

When we instantiate the ObjectProxy object, the system throws an “ObjectProxy not implemented” trace.

The "js" that is created:

 

cid:image001.png@01D5DD11.5D0CF350

 

It seems that the trace is informative ...

I'm going to see the ObjectProxy.as class and see that everything is commented:

 

cid:image002.jpg@01D5DD11.9DAB9D30

 

I am "confused", is the ObjectProxy implemented?

 

Thanks.

Hiedra.

 

 

Reply | Threaded
Open this post in threaded view
|

RE: ObjectProxy

hiedra

Yes we need to change the value, because users can change the language throughout the session, and we have all the values bindeados, but hey, that is how it works ...

That's why I told you, I'm going to leave it like this for now. Also, I wouldn't know where to start :(

 

Hiedra

 

De: Alex Harui <[hidden email]>
Enviado el: viernes, 7 de febrero de 2020 2:11
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I’m pretty sure the reason it works is because of the loop were the XML is examined and idref is populated.  I’ll bet even in the Flex version it would work using Object instead of ObjectProxy.  ObjectProxy mainly exists to detect changes to properties on plain object and trigger bindings.  Unless the values in idref change at runtime, you don’t really need ObjectProxy.

 

HTH,

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 4:06 PM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

Sorry, look ...

LanManager.as receives an XML file and loads it into an objectproxy [idref]; exposes the getRef function (ref: String = "") that will return the text associated with the "ref" parameter in the loaded language xml:

 

package com.iest.wnetsuiteplus.utils

{

import org.apache.royale.events.EventDispatcher;

import mx.utils.ObjectProxy;

            import mx.rpc.events.ResultEvent;

            import com.iest.wnetsuiteplus.vo.DataLanManager;

            import org.apache.royale.events.Event;

           

            /** Language Manager based on an asociative array */

            [Bindable]

            public class LanManager extends EventDispatcher

            {

 

                        public var lanId:String;

                        private var pairsObj:DataLanManager;

                        public var idref:ObjectProxy;

                       

                        public function LanManager() {                            

                                    reset();

                        }

                       

                        /** Deletes all the data but the idref */

                        public function reset():void

                        {

                                    pairsObj = new DataLanManager();

                                    idref = new ObjectProxy(pairsObj);

                        }

                       

                        /** Once the xml is loaded, it will be parsed to populate the

                         * "words" array and it will dispatch an Event of type "XML_PARSED" constant */

                        public function xmlLoaderHandler(e:ResultEvent):void

                        {

                                    var nodes:XMLList = e.result.children();

                                    trace("Got "+nodes.length()+" items");

                                   

                                    for each(var node:XML in nodes)

                                    {

                                               var ref:String = [hidden email];

                                               ref = ref.toLowerCase();

                                               var text:String = [hidden email];

                                               idref[ref] = text;

                                    }

                                   

                                    dispatchEvent(new Event("idrefPUpdate"));

                        }

 

                        [Bindable(event="idrefPUpdate")]

                        public function getRef(ref:String="",outDefault:Boolean = true):String

                        {

                                    var paramref:String = ref.toLowerCase();

                                    var res:String=paramref;

                                              

                                    if(idref[paramref]){

                                               res = idref[paramref];

                                    }else{

                                               if(!outDefault){

                                                           res = null;

                                                            return res;

                                               }

                                    }

                                    return res;

                        }

                       

            }

 

}

 

Although objectProxy is supposed to give an error, it "works" and I imagine it is because it is taking it as an "Object".

 

We use it like this:          <j:Label localId="popupCurrPass" text="{langModel.lang.getRef('pwdact')}"/>

 

Surely you see "Binding" the Binding, but in Royale it does not work with functions and in this way it does work 😝

 

What do you think?, is he taking it as an Object or what is it that makes it work?

 

Thanks Alex.

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: viernes, 7 de febrero de 2020 0:35
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I’m not sure I understood your response.  If you have an example of your class that extends ObjectProxy, we can help you get it to work in Royale.

 

Thanks,

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 3:04 PM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

xD, you confused and I, hallucinated.

It works well with IE, Chrome and Firefox.

 

I am aware that "we should not leave it that way", but the lack of time and knowledge makes me "conform", for now ...

 

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: jueves, 6 de febrero de 2020 18:39
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I’m confused about what your plan is.  I believe that something has to change.  I’m not sure Royale should just implement an ObjectProxy on top of JavaScript proxy if it doesn’t work on IE.

 

Do you need to support IE?  Once we know that, if you can show us a reduced example of how that object worked, we can help you emulate it for your application.

 

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 9:34 AM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

Thanks for answering, Alex.

 

The truth is that it is a transversal object, we use it throughout the application so that the texts appear in the language that the user selects.

I have to say that as it works, of course, I imagine that we are working with a masked Object type, so the performance will not be the best.

For now, we are going to leave it that way, because I do not feel prepared to look at, or modify, not a single line of code outside my project: P (If someone experienced decides to do something about it, I offer to help in debugging)

 

Thanks Alex.

Greetings.

 

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: jueves, 6 de febrero de 2020 18:16
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I don’t think we’ve emulated ObjectProxy.  All Proxy usage (even ArrayCollection) is problematic in JavaScript because the JS runtime does not know about our Proxy implementation so you have to strongly type access to the instances.    If you only have a few accesses it is doable.  There is a JavaScript Proxy implementation, but there is no support for IE.

 

If you are not using Internet Explorer, you can try creating your own data class based on JavaScript Proxy.  If you need IE support, let’s discuss what that class did and see if there is some other way to do it.

 

-Alex

 

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 8:21 AM
To: "[hidden email]" <[hidden email]>
Subject: ObjectProxy

 

Hi,

I have passed a class that I had, in my Flex project, to load language xml, into an objectproxy and accessed after obj.namevar mode.

When we instantiate the ObjectProxy object, the system throws an “ObjectProxy not implemented” trace.

The "js" that is created:

 

cid:image001.png@01D5DD11.5D0CF350

 

It seems that the trace is informative ...

I'm going to see the ObjectProxy.as class and see that everything is commented:

 

cid:image002.jpg@01D5DD11.9DAB9D30

 

I am "confused", is the ObjectProxy implemented?

 

Thanks.

Hiedra.

 

 

Reply | Threaded
Open this post in threaded view
|

Re: ObjectProxy

Alex Harui-2

I don’t think Bindings will be updated if you change an individual property’s value at runtime using the current code.  But otherwise, I think you’ll be ok.

 

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 5:18 PM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

Yes we need to change the value, because users can change the language throughout the session, and we have all the values bindeados, but hey, that is how it works ...

That's why I told you, I'm going to leave it like this for now. Also, I wouldn't know where to start :(

 

Hiedra

 

De: Alex Harui <[hidden email]>
Enviado el: viernes, 7 de febrero de 2020 2:11
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I’m pretty sure the reason it works is because of the loop were the XML is examined and idref is populated.  I’ll bet even in the Flex version it would work using Object instead of ObjectProxy.  ObjectProxy mainly exists to detect changes to properties on plain object and trigger bindings.  Unless the values in idref change at runtime, you don’t really need ObjectProxy.

 

HTH,

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 4:06 PM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

Sorry, look ...

LanManager.as receives an XML file and loads it into an objectproxy [idref]; exposes the getRef function (ref: String = "") that will return the text associated with the "ref" parameter in the loaded language xml:

 

package com.iest.wnetsuiteplus.utils

{

import org.apache.royale.events.EventDispatcher;

import mx.utils.ObjectProxy;

            import mx.rpc.events.ResultEvent;

            import com.iest.wnetsuiteplus.vo.DataLanManager;

            import org.apache.royale.events.Event;

           

            /** Language Manager based on an asociative array */

            [Bindable]

            public class LanManager extends EventDispatcher

            {

 

                        public var lanId:String;

                        private var pairsObj:DataLanManager;

                        public var idref:ObjectProxy;

                       

                        public function LanManager() {                            

                                    reset();

                        }

                       

                        /** Deletes all the data but the idref */

                        public function reset():void

                        {

                                    pairsObj = new DataLanManager();

                                    idref = new ObjectProxy(pairsObj);

                        }

                       

                        /** Once the xml is loaded, it will be parsed to populate the

                         * "words" array and it will dispatch an Event of type "XML_PARSED" constant */

                        public function xmlLoaderHandler(e:ResultEvent):void

                        {

                                    var nodes:XMLList = e.result.children();

                                    trace("Got "+nodes.length()+" items");

                                   

                                    for each(var node:XML in nodes)

                                    {

                                               var ref:String = [hidden email];

                                               ref = ref.toLowerCase();

                                               var text:String = [hidden email];

                                               idref[ref] = text;

                                    }

                                   

                                    dispatchEvent(new Event("idrefPUpdate"));

                        }

 

                        [Bindable(event="idrefPUpdate")]

                        public function getRef(ref:String="",outDefault:Boolean = true):String

                        {

                                    var paramref:String = ref.toLowerCase();

                                    var res:String=paramref;

                                              

                                    if(idref[paramref]){

                                               res = idref[paramref];

                                    }else{

                                               if(!outDefault){

                                                           res = null;

                                                            return res;

                                               }

                                    }

                                    return res;

                        }

                       

            }

 

}

 

Although objectProxy is supposed to give an error, it "works" and I imagine it is because it is taking it as an "Object".

 

We use it like this:          <j:Label localId="popupCurrPass" text="{langModel.lang.getRef('pwdact')}"/>

 

Surely you see "Binding" the Binding, but in Royale it does not work with functions and in this way it does work 😝

 

What do you think?, is he taking it as an Object or what is it that makes it work?

 

Thanks Alex.

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: viernes, 7 de febrero de 2020 0:35
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I’m not sure I understood your response.  If you have an example of your class that extends ObjectProxy, we can help you get it to work in Royale.

 

Thanks,

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 3:04 PM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

xD, you confused and I, hallucinated.

It works well with IE, Chrome and Firefox.

 

I am aware that "we should not leave it that way", but the lack of time and knowledge makes me "conform", for now ...

 

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: jueves, 6 de febrero de 2020 18:39
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I’m confused about what your plan is.  I believe that something has to change.  I’m not sure Royale should just implement an ObjectProxy on top of JavaScript proxy if it doesn’t work on IE.

 

Do you need to support IE?  Once we know that, if you can show us a reduced example of how that object worked, we can help you emulate it for your application.

 

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 9:34 AM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

Thanks for answering, Alex.

 

The truth is that it is a transversal object, we use it throughout the application so that the texts appear in the language that the user selects.

I have to say that as it works, of course, I imagine that we are working with a masked Object type, so the performance will not be the best.

For now, we are going to leave it that way, because I do not feel prepared to look at, or modify, not a single line of code outside my project: P (If someone experienced decides to do something about it, I offer to help in debugging)

 

Thanks Alex.

Greetings.

 

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: jueves, 6 de febrero de 2020 18:16
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I don’t think we’ve emulated ObjectProxy.  All Proxy usage (even ArrayCollection) is problematic in JavaScript because the JS runtime does not know about our Proxy implementation so you have to strongly type access to the instances.    If you only have a few accesses it is doable.  There is a JavaScript Proxy implementation, but there is no support for IE.

 

If you are not using Internet Explorer, you can try creating your own data class based on JavaScript Proxy.  If you need IE support, let’s discuss what that class did and see if there is some other way to do it.

 

-Alex

 

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 8:21 AM
To: "[hidden email]" <[hidden email]>
Subject: ObjectProxy

 

Hi,

I have passed a class that I had, in my Flex project, to load language xml, into an objectproxy and accessed after obj.namevar mode.

When we instantiate the ObjectProxy object, the system throws an “ObjectProxy not implemented” trace.

The "js" that is created:

 

cid:image001.png@01D5DD11.5D0CF350

 

It seems that the trace is informative ...

I'm going to see the ObjectProxy.as class and see that everything is commented:

 

cid:image002.jpg@01D5DD11.9DAB9D30

 

I am "confused", is the ObjectProxy implemented?

 

Thanks.

Hiedra.

 

 

Reply | Threaded
Open this post in threaded view
|

RE: ObjectProxy

hiedra

Exactly, sorry, I hadn't understood you ...

When we modify a specific idref value "it doesn't work", just like when we modify an element of an Array, the binding is not launched.

But when we change the whole object it does work and with that "for now" it works for us.

 

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: viernes, 7 de febrero de 2020 2:51
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I don’t think Bindings will be updated if you change an individual property’s value at runtime using the current code.  But otherwise, I think you’ll be ok.

 

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 5:18 PM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

Yes we need to change the value, because users can change the language throughout the session, and we have all the values bindeados, but hey, that is how it works ...

That's why I told you, I'm going to leave it like this for now. Also, I wouldn't know where to start :(

 

Hiedra

 

De: Alex Harui <[hidden email]>
Enviado el: viernes, 7 de febrero de 2020 2:11
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I’m pretty sure the reason it works is because of the loop were the XML is examined and idref is populated.  I’ll bet even in the Flex version it would work using Object instead of ObjectProxy.  ObjectProxy mainly exists to detect changes to properties on plain object and trigger bindings.  Unless the values in idref change at runtime, you don’t really need ObjectProxy.

 

HTH,

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 4:06 PM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

Sorry, look ...

LanManager.as receives an XML file and loads it into an objectproxy [idref]; exposes the getRef function (ref: String = "") that will return the text associated with the "ref" parameter in the loaded language xml:

 

package com.iest.wnetsuiteplus.utils

{

import org.apache.royale.events.EventDispatcher;

import mx.utils.ObjectProxy;

            import mx.rpc.events.ResultEvent;

            import com.iest.wnetsuiteplus.vo.DataLanManager;

            import org.apache.royale.events.Event;

           

            /** Language Manager based on an asociative array */

            [Bindable]

            public class LanManager extends EventDispatcher

            {

 

                        public var lanId:String;

                        private var pairsObj:DataLanManager;

                        public var idref:ObjectProxy;

                       

                        public function LanManager() {                            

                                    reset();

                        }

                       

                        /** Deletes all the data but the idref */

                        public function reset():void

                        {

                                    pairsObj = new DataLanManager();

                                    idref = new ObjectProxy(pairsObj);

                        }

                       

                        /** Once the xml is loaded, it will be parsed to populate the

                         * "words" array and it will dispatch an Event of type "XML_PARSED" constant */

                        public function xmlLoaderHandler(e:ResultEvent):void

                        {

                                    var nodes:XMLList = e.result.children();

                                    trace("Got "+nodes.length()+" items");

                                   

                                    for each(var node:XML in nodes)

                                    {

                                               var ref:String = [hidden email];

                                               ref = ref.toLowerCase();

                                               var text:String = [hidden email];

                                               idref[ref] = text;

                                    }

                                   

                                    dispatchEvent(new Event("idrefPUpdate"));

                        }

 

                        [Bindable(event="idrefPUpdate")]

                        public function getRef(ref:String="",outDefault:Boolean = true):String

                        {

                                    var paramref:String = ref.toLowerCase();

                                    var res:String=paramref;

                                              

                                    if(idref[paramref]){

                                               res = idref[paramref];

                                    }else{

                                               if(!outDefault){

                                                           res = null;

                                                            return res;

                                               }

                                    }

                                    return res;

                        }

                       

            }

 

}

 

Although objectProxy is supposed to give an error, it "works" and I imagine it is because it is taking it as an "Object".

 

We use it like this:          <j:Label localId="popupCurrPass" text="{langModel.lang.getRef('pwdact')}"/>

 

Surely you see "Binding" the Binding, but in Royale it does not work with functions and in this way it does work 😝

 

What do you think?, is he taking it as an Object or what is it that makes it work?

 

Thanks Alex.

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: viernes, 7 de febrero de 2020 0:35
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I’m not sure I understood your response.  If you have an example of your class that extends ObjectProxy, we can help you get it to work in Royale.

 

Thanks,

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 3:04 PM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

xD, you confused and I, hallucinated.

It works well with IE, Chrome and Firefox.

 

I am aware that "we should not leave it that way", but the lack of time and knowledge makes me "conform", for now ...

 

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: jueves, 6 de febrero de 2020 18:39
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I’m confused about what your plan is.  I believe that something has to change.  I’m not sure Royale should just implement an ObjectProxy on top of JavaScript proxy if it doesn’t work on IE.

 

Do you need to support IE?  Once we know that, if you can show us a reduced example of how that object worked, we can help you emulate it for your application.

 

-Alex

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 9:34 AM
To: "[hidden email]" <[hidden email]>
Subject: RE: ObjectProxy

 

Thanks for answering, Alex.

 

The truth is that it is a transversal object, we use it throughout the application so that the texts appear in the language that the user selects.

I have to say that as it works, of course, I imagine that we are working with a masked Object type, so the performance will not be the best.

For now, we are going to leave it that way, because I do not feel prepared to look at, or modify, not a single line of code outside my project: P (If someone experienced decides to do something about it, I offer to help in debugging)

 

Thanks Alex.

Greetings.

 

Hiedra.

 

De: Alex Harui <[hidden email]>
Enviado el: jueves, 6 de febrero de 2020 18:16
Para: [hidden email]
Asunto: Re: ObjectProxy

 

I don’t think we’ve emulated ObjectProxy.  All Proxy usage (even ArrayCollection) is problematic in JavaScript because the JS runtime does not know about our Proxy implementation so you have to strongly type access to the instances.    If you only have a few accesses it is doable.  There is a JavaScript Proxy implementation, but there is no support for IE.

 

If you are not using Internet Explorer, you can try creating your own data class based on JavaScript Proxy.  If you need IE support, let’s discuss what that class did and see if there is some other way to do it.

 

-Alex

 

 

From: Maria Jose Esteve <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Thursday, February 6, 2020 at 8:21 AM
To: "[hidden email]" <[hidden email]>
Subject: ObjectProxy

 

Hi,

I have passed a class that I had, in my Flex project, to load language xml, into an objectproxy and accessed after obj.namevar mode.

When we instantiate the ObjectProxy object, the system throws an “ObjectProxy not implemented” trace.

The "js" that is created:

 

cid:image001.png@01D5DD11.5D0CF350

 

It seems that the trace is informative ...

I'm going to see the ObjectProxy.as class and see that everything is commented:

 

cid:image002.jpg@01D5DD11.9DAB9D30

 

I am "confused", is the ObjectProxy implemented?

 

Thanks.

Hiedra.