You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Harbs <ha...@gmail.com> on 2019/10/02 10:42:19 UTC

Beads and events

BrowserResizeListener dispatches a sizeChanged event on the view when the browser is resized.

Someone is struggling with how to use it:

https://stackoverflow.com/questions/58128204/how-do-i-get-the-application-width-height-based-on-browser-height-width <https://stackoverflow.com/questions/58128204/how-do-i-get-the-application-width-height-based-on-browser-height-width>

I’d really like to tell them to just specify a `sizeChanged` handler in the MXML of the view, but View (or ViewBase) does not have that event metadata. I’m tempted to add it, but it would only work if the app specifies the resize bead.

This is really a general problem of how to specify events in MXML when the events are dependent on beads. I’m not sure what the correct answer is to this problem.

Thoughts?
Harbs

Re: Beads and events

Posted by Alex Harui <ah...@adobe.com.INVALID>.
I agree there is a general problem.

In many cases, when you add a bead explicitly, the handler should be specified on the bead itself:

<js:Application>
  <js:beads>
    <js:BrowserResizeListener sizeChanged="doSomething()" />

In theory, the main scenario when folks run into this is when beads are assigned in CSS.

The "simplest" answer is subclassing and adding the event metadata.  I have not tried adding event metadata in mx:metadata and see if the compiler picks up the new event or not.  If not, it might be worth investigating why.

-Alex

On 10/2/19, 3:42 AM, "Harbs" <ha...@gmail.com> wrote:

    BrowserResizeListener dispatches a sizeChanged event on the view when the browser is resized.
    
    Someone is struggling with how to use it:
    
    https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F58128204%2Fhow-do-i-get-the-application-width-height-based-on-browser-height-width&amp;data=02%7C01%7Caharui%40adobe.com%7Cfa5643679a3f4993657f08d747253b24%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C1%7C637056097547237008&amp;sdata=Rdw25yCxO%2FQG0eRs2A%2BfOfdTXKMX%2BTTJL25mqDtpF%2Bc%3D&amp;reserved=0 <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F58128204%2Fhow-do-i-get-the-application-width-height-based-on-browser-height-width&amp;data=02%7C01%7Caharui%40adobe.com%7Cfa5643679a3f4993657f08d747253b24%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C1%7C637056097547237008&amp;sdata=Rdw25yCxO%2FQG0eRs2A%2BfOfdTXKMX%2BTTJL25mqDtpF%2Bc%3D&amp;reserved=0>
    
    I’d really like to tell them to just specify a `sizeChanged` handler in the MXML of the view, but View (or ViewBase) does not have that event metadata. I’m tempted to add it, but it would only work if the app specifies the resize bead.
    
    This is really a general problem of how to specify events in MXML when the events are dependent on beads. I’m not sure what the correct answer is to this problem.
    
    Thoughts?
    Harbs