If you step into dispatchEvent, where does it go?
From: Serkan Taş <[email protected]>
Reply-To: "[email protected]" <[email protected]>
Date: Sunday, February 24, 2019 at 11:49 AM
To: "[email protected]" <[email protected]>
Subject: Re: Work on Emulation
Hi Alex,
After overriding the method in HTTPService, I watched that it is not called.
according to the code below,
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpResult);
the method httpResult is called so the changes I made had no effect.
Thanks,
Serkan
14.02.2019 23:08 tarihinde Alex Harui yazdı:
I don’t think we have an example to reference.
It should be something like:
Override public function dispatchEvent(event:Event):Boolean
{
If (event.type == “httpStatus”)
{
Var newEvent:HTTPStatusEvent = new HTTPStatusEvent(…)
// assign other properties If needed
Super.dispatchEvent(newEvent);
}
}
From: Serkan Taş
<[email protected]><mailto:[email protected]>
Reply-To: "[email protected]"<mailto:[email protected]>
<[email protected]><mailto:[email protected]>
Date: Thursday, February 14, 2019 at 11:54 AM
To: "[email protected]"<mailto:[email protected]>
<[email protected]><mailto:[email protected]>
Subject: Re: Work on Emulation
Are there any similar implementation that you may advice me to check as sample ?
14.02.2019 22:36 tarihinde Alex Harui yazdı:
So the progressHandler in URLLoader is dispatching a ValueEvent, not the
HTTPStatusEvent you want. The emulation HTTPService should override what gets
dispatched. You could override dispatchEvent and dispatch the right thing.
HTH,
-Alex
From: Serkan Taş
<[email protected]><mailto:[email protected]>
Reply-To: "[email protected]"<mailto:[email protected]>
<[email protected]><mailto:[email protected]>
Date: Thursday, February 14, 2019 at 11:30 AM
To: "[email protected]"<mailto:[email protected]>
<[email protected]><mailto:[email protected]>
Subject: Re: Work on Emulation
Found it :
[cid:[email protected]]
14.02.2019 22:28 tarihinde Serkan Taş yazdı:
Alex,
I am not sure that I know how to capture call stack in Firefox Dev Edition.
Thanks,
Serkan
14.02.2019 22:23 tarihinde Alex Harui yazdı:
In Royale in the browser, some events aren’t what you think they are. If you
listen for a org.apache.royale.events.MouseEvent, the browser dispatches a
browser MouseEvent and Royale runs code to catch that and convert it to
org.apache.royale.events.MouseEvent.
I suspect that the browser is sending its low-level event and Royale code needs
to be added to convert it to a Royale HTTPStatusEvent. That’s why I suggested
checking the call stack as it might be possible to copy the MouseEventConverter
patterns to do the conversion.
HTH,
-Alex
From: Serkan Taş
<[email protected]><mailto:[email protected]>
Reply-To: "[email protected]"<mailto:[email protected]>
<[email protected]><mailto:[email protected]>
Date: Thursday, February 14, 2019 at 11:14 AM
To: "[email protected]"<mailto:[email protected]>
<[email protected]><mailto:[email protected]>
Subject: Re: Work on Emulation
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ş
<[email protected]><mailto:[email protected]>
Reply-To: "[email protected]"<mailto:[email protected]>
<[email protected]><mailto:[email protected]>
Date: Tuesday, February 12, 2019 at 11:52 AM
To: "[email protected]"<mailto:[email protected]>
<[email protected]><mailto:[email protected]>
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:[email protected]]
This is where it fires window :
[cid:[email protected]]
It is normally expected that the status holds real value, but here it is not,
httpStatus contains the value in "value" as below :
[cid:[email protected]]
As the HTTPStatusEvent is emulated, I am not sure how to go to solve the issue.
Thanks,
Serkan