flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: [FlexJS] resize event not working?
Date Wed, 22 Feb 2017 16:18:55 GMT
"Resize" seemed to be reserved by the browser.  Plus, IMO, events should
have more explicit names.  When the width changes, then dispatch
"widthChange" because it may or may not guarantee a "resize" in response.
"sizeChanged" means that someone called an API which set width and height
in the same call.

Of course, this stuff can all be changed if there is a better way.

My 2 cents,
-Alex

On 2/22/17, 5:53 AM, "Peter Ent" <pent@adobe.com> wrote:

>Alex will need to chime in here, but I believe his philosophy has been to
>keep the number of specialized events to a minimum. I'm not 100% sure I
>agree with that since it can be a lot easier to write code when you are
>responding to specific events, but it does expand the final footprint of
>the app having all the code for those classes.
>
>I think FlexJS will always be a challenge between convenient and
>size/performance. 
>
>
>‹peter
>
>On 2/22/17, 3:42 AM, "Harbs" <harbs.lists@gmail.com> wrote:
>
>>I think it¹s to be consistent with widthChanged and heightChanged. There
>>is no ³resize² event anywhere in FlexJS. It¹s probably a good idea to not
>>use the browser names for events.
>>
>>I do believe there should be a ResizeEvent with consts for SIZE_CHANGED,
>>WIDTH_CHANGED and HEIGHT_CHANGED. This does not yet exist.
>>
>>> On Feb 22, 2017, at 9:20 AM, Justin Mclean <justin@classsoftware.com>
>>>wrote:
>>> 
>>> Hi,
>>> 
>>>> Looks like you¹re using a flash event instead of the flexjs one.
>>> 
>>> Thanks for that I tried that as well, but still doesn¹t work.
>>> 
>>> I can see the Resize bead is doing this:
>>> window.addEventListener('resize',
>>>org.apache.flex.utils.Language.closure(this.resizeHandler, this,
>>>'resizeHandler'), false);
>>> 
>>> And dispatches a ³sizeChanged² event like so:
>>> initialView.dispatchEvent('sizeChanged¹);
>>> 
>>> Any reason for the event name change?
>>> 
>>> So this code below will work. But it seems a rather roundabout way of
>>>doing it.
>>> 
>>> <?xml version="1.0" encoding="utf-8"?>
>>> <js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>>>                xmlns:js="library://ns.apache.org/flexjs/basic"
>>>initialize="init()">
>>> 
>>>    <js:beads>
>>>        <js:BrowserResizeHandler />
>>>    </js:beads>
>>> 
>>>    <fx:Script><![CDATA[
>>>        public function init():void {
>>>            initialView.addEventListener("sizeChanged", resized);
>>>        }
>>> 
>>>        public function resized(event:Event):void {
>>>            trace("resized to " + initialView.width + " x " +
>>>initialView.height);
>>>        }
>>>        ]]></fx:Script>
>>>    <js:valuesImpl>
>>>        <js:SimpleCSSValuesImpl/>
>>>    </js:valuesImpl>
>>> 
>>>    <js:initialView>
>>>        <js:View percentWidth="100" percentHeight="100">
>>>            <js:Label text="Resize Me" />
>>>        </js:View>
>>>    </js:initialView>
>>> 
>>> </js:Application>
>>> 
>>> 
>>> 
>>> 
>>> Thanks,
>>> Justin
>>
>

Mime
View raw message