Issue on resize Event with Apache Royale SDK 0.9.6

喜欢而已 提交于 2019-12-13 04:36:30

问题


How to handle parent container resize Event or at least browser resize Event ?

I try this code, but handleResize is never call :

package 
{
    //import org.apache.royale.html.Group;
    import org.apache.royale.jewel.Group;
    import org.apache.royale.core.BrowserResizeListener;

    public class Slideshow extends Group
    {
            public function Slideshow(){
                super();

                this.addBead(new BrowserResizeListener());
                this.addEventListener("sizeChanged",handleResize);
            }

            protected function handleResize():void{
                // this is never called
                trace(this.height)
                trace(this.width)
            }
    }
}

Thanks for any help


回答1:


Here's an example of listening to window resize:

<?xml version="1.0" encoding="utf-8"?>
<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                applicationComplete="applicationCompleteHandler()"
                xmlns:js="library://ns.apache.org/royale/basic"
                >
                <fx:Script>
                    <![CDATA[
                        import org.apache.royale.html.SimpleAlert;

                        private function applicationCompleteHandler():void
                        {
                            myInitialView.addEventListener("sizeChanged", sizeChangedHandler)
                        }

                        private function sizeChangedHandler(event:Event):void
                        {
                            SimpleAlert.show("Application size is: " + this.width + " " + this.height, this);
                        }
                    ]]>
                </fx:Script>
    <js:beads>
        <js:BrowserResizeHandler/>
    </js:beads>

    <js:valuesImpl>
        <js:SimpleCSSValuesImpl />
    </js:valuesImpl>    

    <js:initialView>
        <js:View id="myInitialView" width="100%" height="100%">
            <js:Label text="Hello World"/>  
        </js:View>
    </js:initialView>
</js:Application>


来源:https://stackoverflow.com/questions/58525420/issue-on-resize-event-with-apache-royale-sdk-0-9-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!