Note : I made that changes, the status getter for the code while working on emulation migration : https://github.com/apache/royale-asjs/commit/2b2fd8e78f80bb430d225a457bea56b643c517cc#diff-c8bd604a6ab0e50cf419257de923650d

14.02.2019 22:13 tarihinde Serkan Taş yazdı:
Hi Alex,

13.02.2019 01:50 tarihinde Alex Harui yazdı:

Hi Serkan,

In the emulation components, you may have to catch certain events and redispatch them with the appropriate type.  In the event handler that calls Alert, what is the type of the event parameter.  Is it an HTTPStatusEvent or a browser event?

Here is the registration :

loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpResult);

It is registered as HTTPStatusEvent. And the handler has the signature :

private function httpResult(event:HTTPStatusEvent):void

If it is an HTTPStatusEvent, then the emulation may be as simple as adding a “status” getter that returns the event’s value property.

As it is HTTPStatusEvent, than it will be enough to implement your advice to the JS section of the code. But when I check the code, there is getter for status :

COMPILE::JS
    public class HTTPStatusEvent extends org.apache.royale.events.Event
    {
        /*  include "../core/Version.as"; */
        public static const HTTP_STATUS:String = "httpStatus";
        private var m_status:int;

//--------------------------------------------------------------------------
        //
        //  Class constants
        //
//--------------------------------------------------------------------------


//--------------------------------------------------------------------------
        //
        //  Constructor
        //
//--------------------------------------------------------------------------

        /**
         *  Constructor.
         *
         *  @param type The event type; indicates the action that caused the event.
         *
         *  @param bubbles Specifies whether the event can bubble
         *  up the display list hierarchy.
         *
         *  @param cancelable Specifies whether the behavior
         *  associated with the event can be prevented.
         *
         *  @langversion 3.0
         *  @playerversion Flash 9
         *  @playerversion AIR 1.1
         *  @productversion Royale 0.9.3
         */
        public function HTTPStatusEvent(type:String, bubbles:Boolean = false,                                         cancelable:Boolean = false, status:int = 0)
        {
            super(type, bubbles, cancelable);
            m_status = status;
        }

        public function get status() : int
        {
            return m_status;
        }

    }

But returns internal m_status, which is in my case is undefined.

Thanks,
Serkan

If it is a browser event, then look at the call stack to see who is dispatching the event.  The code that dispatches the event might need to create an HTTPStatusEvent, copy the browser event properties into it, and then dispatch the HTTPStatusEvent.  If you are not sure, post the call stack.

HTH,

-Alex

*From: *Serkan Taş <serkan....@likyateknoloji.com>
*Reply-To: *"users@royale.apache.org" <users@royale.apache.org>
*Date: *Tuesday, February 12, 2019 at 11:52 AM
*To: *"users@royale.apache.org" <users@royale.apache.org>
*Subject: *Re: Work on Emulation

Hi Alex (only you are interested in emulation, right ?) :)))

While debugging my code, I realized that there is a conflict between in status and httpStatus values of the event HTTPStatusEvent, at least in my mind.

My old flex code, ported to royale, registers and event listener for HTTPStatusEvent.HTTP_STATUS and handler httpResult as below (loader is initialized somewhere) :

loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpResult);

After making http request, the handler returns as below on screen :

cid:part1.78AD6179.FDDC1C04@likyateknoloji.com

This is where it fires window :

cid:part2.FC1F7F03.0A76E9BA@likyateknoloji.com
It is normally expected that the status holds real value, but here it is not, httpStatus contains the value in "value" as below :

cid:part3.E6732EF2.3364FCC2@likyateknoloji.com

As the HTTPStatusEvent is emulated, I am not sure how to go to solve the issue.

Thanks,
Serkan



Reply via email to