Combined Code
frame 1 {
Stage.align = '';
Stage.scaleMode = 'noScale';
volumeoff.enabled = false;
volumeoff._visible = false;
var nc = new NetConnection();
var nsnc = new NetConnection();
var volumenum = 100;
nc.onStatus = function (info) {
trace(info.code);
};
nc.init = function () {
so = SharedObject.getRemote('ucSO', nc.uri, false);
so.onSync = function (info) {
txt.text = so.data.count;
};
so.connect(nc);
ns = new NetStream(nsnc);
ns.setBufferTime(3);
ns.play('livestream');
v._visible = false;
v.attachVideo(ns);
snd = new Sound();
snd.attachAudio(ns);
snd.setVolume(100);
snd.start();
ns.onStatus = function (info) {
trace(info.code);
switch (info.code) {
case 'NetStream.Play.UnpublishNotify':
case 'NetStream.Buffer.Empty':
v._visible = false;
snd.setVolume(0);
break;
case 'NetStream.Buffer.Full':
v._visible = true;
snd.setVolume(volumenum);
}
};
};
volumeon.onPress = function () {
if (volumenum > 0) {
volumenum -= 25;
snd.setVolume(volumenum);
} else {
volumeon.enabled = false;
volumeon._visible = false;
volumeoff.enabled = true;
volumeoff._visible = true;
}
};
volumeoff.onPress = function () {
if (volumenum == 0) {
volumenum = 100;
snd.setVolume(100);
volumeon.enabled = true;
volumeon._visible = true;
volumeoff.enabled = false;
volumeoff._visible = false;
}
};
nc.connect('rtmp://lolwtfrudoin.mooo.com/ViewerHandler');
nsnc.connect('rtmp://lolwtfrudoin.mooo.com/live');
}