1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 14:30:56 +01:00
phorge-phorge/support/aphlict/client/src/Aphlict.as
epriestley 76cefde0b3 Show Aphlict connection status in notification menu
Summary:
Fixes T5373. Ref T5281. Several changes:

  - The `marshallExceptions` thing is useful if JS throws an exception when invoked from Flash, so set it. The resulting exceptions are a little odd (not escaped correctly, e.g.) but way better than nothing.
  - Put connection status in the notification menu.
  - When the connection fails, try to provide contextual help where we can.

Test Plan: {F169493}

Reviewers: chad, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T5281, T5373

Differential Revision: https://secure.phabricator.com/D9700
2014-06-23 16:26:16 -07:00

47 lines
954 B
ActionScript

package {
import flash.display.Sprite;
import flash.external.ExternalInterface;
import flash.net.LocalConnection;
public class Aphlict extends Sprite {
/**
* A transport channel used to receive data.
*/
protected var recv:LocalConnection;
/**
* A transport channel used to send data.
*/
protected var send:LocalConnection;
public function Aphlict() {
super();
this.recv = new LocalConnection();
this.recv.client = this;
this.send = new LocalConnection();
}
final protected function externalInvoke(
type:String,
object:Object = null):void {
ExternalInterface.call('JX.Aphlict.didReceiveEvent', type, object);
}
final protected function error(error:Object):void {
this.externalInvoke('error', error.toString());
}
final protected function log(message:String):void {
this.externalInvoke('log', message);
}
}
}