Last active
April 7, 2016 20:51
-
-
Save marinalohova/aaa33ef4d69e767bea3bd2a5a9841d99 to your computer and use it in GitHub Desktop.
org.red5.utils.Connector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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