Skip to content

Instantly share code, notes, and snippets.

@marinalohova
Last active April 7, 2016 20:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marinalohova/aaa33ef4d69e767bea3bd2a5a9841d99 to your computer and use it in GitHub Desktop.
Save marinalohova/aaa33ef4d69e767bea3bd2a5a9841d99 to your computer and use it in GitHub Desktop.
org.red5.utils.Connector
// UI Elements:
// ** AUTO-UI ELEMENTS **
private var alert:SimpleDialog;
private var connect:IconButton;
private var disconnect:IconButton;
private var light:ConnectionLight;
private var uri:TextInput;
// ** END AUTO-UI ELEMENTS **
public function configUI():Void
{
// instantiate the con qnection
connection = new Connection();
// register the connection with the light so it can add a listener
light.registerNC(connection);
// hide disconnect button
disconnect._visible = false;
// set the URI
uri.text = red5URI;
// setup the buttons
connect.addEventListener("click", Delegate.create(this, makeConnection));
disconnect.addEventListener("click", Delegate.create(this, closeConnection));
connect.tooltip = "Connect to Red5";
disconnect.tooltip = "Disconnect from Red5";
// add listener for connection changes
connection.addEventListener("success", Delegate.create(this, manageButtons));
connection.addEventListener("close", Delegate.create(this, manageButtons));
}
public function makeConnection(evtObj:Object):Void
{
if(uri.length > 0)
{
var goodURI = connection.connect(uri.text, getTimer());
if(!goodURI) alert.show("Please check connection URI String and try again.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment