From: Yishay Weiss<mailto:yishayj...@hotmail.com>
Sent: Wednesday, February 22, 2017 8:07 AM
To: Justin Mclean<mailto:jus...@classsoftware.com>
Subject: RE: [FlexJS] resize event not working?


Looks like you’re using a flash event instead of the flexjs one.



From: Justin Mclean<mailto:jus...@classsoftware.com>
Sent: Wednesday, February 22, 2017 6:12 AM
To: dev@flex.apache.org<mailto:dev@flex.apache.org>
Subject: [FlexJS] resize event not working?



Hi,

This code doesn’t seem to work - anyone have any ideas why?

I tried with and with out the bead and also tried “this.” instead of “view.”

<?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[
        import flash.events.Event;

        public function init():void {
            view.addEventListener("resize", resized);
        }

        public function resized(event:flash.events.Event):void {
            trace("resized to " + view.x + " " + view.y);
        }
        ]]></fx:Script>
    <js:valuesImpl>
        <js:SimpleCSSValuesImpl/>
    </js:valuesImpl>

    <js:initialView>
        <js:View id="view" percentWidth="100" percentHeight="100">
            <js:Label text="Resize Me" />
        </js:View>
    </js:initialView>

</js:Application>


BTW this:

public function init():void {
    this.addEventListener(flash.events.Event.RESIZE, resized);
}

Also gives this warning when compiling:

WARNING - variable flash is undeclared
  this.addEventListener(flash.events.Event.RESIZE, 
org.apache.flex.utils.Language.closure(this.resized, this, 'resized'));

Thanks,
Justin

Reply via email to