How do I initialize these vars?
The following code is a combination of samples taken from red5. Basically I'm trying to combine a live caller with a chat box based on shared objects. I'm not a flash developer and don't really understand what's going on here.
// ** AUTO-UI IMPORT STATEMENTS **
import org.red5.utils.Connector;
import org.red5.samples.simplechat.BasicChat;
// ** END AUTO-UI IMPORT STATEMENTS **
import com.neoarchaic.ui.Tooltip;
import org.red5.net.Stream;
//import org.red5.utils.Delegate;
import com.blitzagency.xray.util.XrayLoader;
class org.red5.samples.livestream.subscriber.Main extends MovieClip {
// Constants:
public static var CLASS_REF = org.red5.samples.livestream.subscriber.Main;
public static var LINKAGE_ID:String = "org.red5.samples.livestream.subscriber.Main";
// Public Properties:
// Private Properties:
private var stream:Stream;
private var cam:Camera;
// UI Elements:
// ** AUTO-UI ELEMENTS **
private var connector:Connector;
private var publish_video:Video;
private var chat:BasicChat;
// ** END AUTO-UI ELEMENTS **
private var uri:String = "rtmpt://localhost/oflaDemo";
// Initialization:
private function Main() {XrayLoader.loadConnector("xray.swf");}
private function onLoad():Void { configUI(); }
// Public Methods:
// Semi-Private Methods:
// Private Methods:
private function configUI():Void
{
// setup the tooltip defaults
Tooltip.options = {size:10, font:"_sans", corner:0};
// setup cam
cam = Camera.get();
// get notified of connection changes
connector.addEventListener("connectionChange", this);
// set the uri
Connector.red5URI = uri;
// initialize the connector
connector.configUI();
connector.makeConnection();
}
private function connectionChange(evtObj:Object):Void
{
if(evtObj.connected)
{
// setup stream
// XXX: odd hack needed for flashIDE.
var conn = evtObj.connection;
var x = new Stream(conn);
stream = x;
stream.play("red5StreamDemo", -1);
publish_video.attachVideo(stream);
trace(chat);
// register the NetConnection that GlobalObject will need
chat.registerConnection(conn);
// connect the shared object
chat.connectSO();
}
}
}
I dont think it is var chat
initialized anywhere as it trace(chat)
prints 'undefined'. However, var connector
and var publish_video
it seems to collect their items from the scene.
This sample code included those two and worked fine, but I can't get my additions to behave the same.
I've added an instance of BasicChat to the stage (I'm using Flash CS4) and have spent the last many hours playing around with it with various properties, layers and groupings to no avail.
Can anyone suggest why mine is var chat
n't collecting his copy from the scene?
a source to share