Unexpected results in trying to set custom settings for the area.

  • Hi Klaus,

    I got strange results in trying to set custom settings for the area.
    I try to set the area.x to 50% and the area.with to half of stagewidth (the rest of the stage width)...
    Like this:

    Code
    set(area.x,50%);
    sub(area.width,stagewidth,area.pixelx);


    But, in this code, the resulting area is not as I expect:


    with this code, the area is displayed correctly beginning at the middle of the screen but the width is displayed only half (the other half it is out of the screen).
    The resulting trace are:

    Adding in line 12 a wait(0); inside the action that sets the area:


    Using this wait(0); the area displays correctly beginning at the middle of the screen and the width is egal to half of the stagewidth as expected.
    And the resulting trace are:

    only at the end of the trace, the area variables are as expected...
    *question* *question* *question* I am doing something wrong *confused*

    SAlut.

  • Hi,

    the "area.pixel*" values were not updated immediately,
    they will be updated during the next screen refresh (or during a browser resize) and then also the onresize event will be called,
    (note - inside then onresize event the area values can be adjusted/changed again, but then there will be no second onresize event),

    best regards,
    Klaus

  • Hi,

    the "area.pixel*" values were not updated immediately,
    they will be updated during the next screen refresh (or during a browser resize) and then also the onresize event will be called,
    (note - inside then onresize event the area values can be adjusted/changed again, but then there will be no second onresize event),

    best regards,
    Klaus

    There seems to be a bug with the area variables.
    Using the trace plugin, you can see when using window maximize/minimize the calculated values are for the previous state, not the current state.
    Is there a way to force an update to these variables onresize?
    The stage variables are fine.

  • Hi,

    There seems to be a bug with the area variables.

    which bug?


    Is there a way to force an update to these variables onresize?

    in the onresize event itself, the values are already updated,
    but when changing the the area values inside the onresize event again there is no second onresize event,
    a wait(0) or delayedcall(0,..) could help to wait until the screen has been redrawn and the pixel values are updated again, but when changing the area values inside the onresize event it would be better the calculate all values manually, e.g. %50 width would mean mul(yourwidth, stagewidth, 0.5);

    best regards,
    Klaus

  • Well in the examples where you are tracing the area.pixelwidth etc.
    Dragging the window shows the area pixel width correctly.
    However, on using the browser windows maximize and minimize, the trace shows incorrectly.

    For instance a 400px window then maximize shows area.pixelwidth = 400px not 1920
    Then when you unmaximize it will show 1920.
    Yes, manual calculations aren't so terrible HOWEVER, it can be difficult to calculated heights that have been removed do to the additions of browser toolbars etc.


    So for a real world example, if you have a panorama set to occupy an area 80% width and height of the stage, and you want a graphic element 75% height of the area, and the user maximizes the screen, your element will be calculated wrong using area.pixelheight which is one step behind.
    Or I'm probably mis-understanding proper usage of area.pixel[]. Im assuming its the area of space where the panorama is drawn.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!