royale-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harbs <harbs.li...@gmail.com>
Subject Re: Release version acting different to debug version
Date Mon, 27 Nov 2017 07:17:11 GMT
Yes. This is something I discussed in my “migrating” talk.

It’s a limitation with the Google compiler. Any untyped objects can be renamed.

There are two ways to deal with this.

The first is to use bracket notation on untyped objects.
The second is to only use typed objects.

Harbs

> On Nov 27, 2017, at 5:33 AM, Justin Mclean <justin@classsoftware.com> wrote:
> 
> Hi,
> 
> This simple example that makes JSON call and displays the results:
> 
> <?xml version="1.0" encoding="utf-8"?>
> <js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>                xmlns:js="library://ns.apache.org/royale/basic"
>                applicationComplete="callSever()">
> 
>    <js:beads>
>        <js:ApplicationDataBinding />
>    </js:beads>
> 
>    <fx:Script><![CDATA[        
>        import org.apache.royale.events.Event;
>        import org.apache.royale.net.HTTPConstants;
>        import org.apache.royale.net.HTTPService;
> 
>        protected var service:HTTPService;
> 
>        [Bindable] protected var description:String;
>        [Bindable] protected var homepage:String;
> 
>        public function callSever():void {
>            service = new HTTPService();
>            service.url = "https://projects.apache.org/json/projects/flex.json";
>            service.method = HTTPConstants.POST;
>            service.addEventListener(Event.COMPLETE, projectInfo);
>            service.send();
>        }
> 
>        public function projectInfo(event:Event):void {
>            var info:Object = JSON.parse(service.data);
>            var status:int = service.status;
> 
>            if (status == 200) {
>                description = info.shortdesc;
>                homepage = info.homepage;
>            }
>            service.removeEventListener(Event.COMPLETE, projectInfo);
>            service = null;
>        }
>        ]]></fx:Script>
> 
>    <js:valuesImpl>
>        <js:SimpleCSSValuesImpl/>
>    </js:valuesImpl>
> 
>    <js:initialView>
>        <js:View>
>            <js:VContainer>
>                <js:Label text="Project info" />
>                <js:MultilineLabel text="{description}" width="500" />
>                <js:Label text="{homepage}" />
>            </js:VContainer>
>        </js:View>
>    </js:initialView>
> 
> </js:Application>
> 
> 
> Works as expected in debug and displays:
> Project info
> Apache Flex® is a highly productive, open source application framework for building
and maintaining expressive web applications that deploy consistently on all major browsers,
desktops and devices (including smartphones, tablets and tv).
> http://flex.apache.org
> 
> The release version however displays:
> Project info
> undefined
> http://flex.apache.org
> 
> In both case the JSON is correctly asked for and returned. A console.log(info.shortdesc);
gives undefined in the production version but console.log(info[“shortdesc”]) works. Is
this a known issue? Is seems odd that homepage works while shortdesc doesn’t.
> 
> Thanks,
> Justin
> 
> 


Mime
View raw message