<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp();" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:backgroundImage>http://www.soulpix.com/download/desktop_pics/ab_acqua_blue.jpg</mx:backgroundImage>
<mx:Script>
<![CDATA[
import mx.managers.SystemManager;
import mx.events.VideoEvent;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
[Bindable]
private var uM:ContextMenu;
[Bindable]
public var videoList:ArrayCollection;
[Bindable]
public var tvMaster:Master = new Master();
/* Entry Point To TUve */
private function initApp():void {
tvMaster.init(this);
this.addEventListener(TextEvent.LINK,doOpenInfo);
tvMaster.tvVidHolder.y = 5;
tvMaster.tvVidHolder.x = 580;
this.addChild(tvMaster.tvVidHolder);
tvMaster.doLogin();
uM = new ContextMenu();
uM.hideBuiltInItems();
var cmi:ContextMenuItem = new ContextMenuItem("Whois",false);
cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,doWhois);
uM.customItems.push(cmi);
cmi = new ContextMenuItem("Kick",false);
cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,doKick);
uM.customItems.push(cmi);
}
private function sendText():void {
var tmpString:String;
if (chatText.text.length > 0 && tvMaster.tvNetwork.tvNetCon == true) {
var myPattern:RegExp = /</g;
tmpString = chatText.text.replace(myPattern,"<");
if (chatText.text.indexOf("/") == 0) {
tvMaster.parseCommand(tmpString);
chatText.text = "";
}
else {
tvMaster.tvNetwork.sendData("MSG " + tvMaster.currentChannel + ":" + tmpString + "\n");
var date:Date = new Date;
chatWindow.htmlText += ("[" + date.toLocaleTimeString() + "] " + tvMaster.userName + ": " + tmpString + "\n");
chatText.text = "";
}
}
} /* End sendText() */
private function doOpenInfo(event:TextEvent):void {
tvMaster.tuveShowIW(Number(event.text));
}
public function updateVolume():void {
var st:SoundTransform = tvMaster.tvNS.soundTransform;
st.volume = (volume.value) * .01;
tvMaster.tvNS.soundTransform = st;
tvMaster.tvSO.data.volume = volume.value;
} /* End updateVolume */
public function findSong():void {
var searchOptV:Object = new Object();
searchOptV.skey = searchBox.text;
searchOptV.sclass = Number(tvMaster.tvClass[selC.selectedIndex].@data);
searchOptV.srating = Number(tvMaster.tvRating[selR.selectedIndex].@data);
searchOptV.stime = tvTime.text;
tvMaster.gateway.call("tuve.findSongs",new Responder(getSongs,tvMaster.onFault),searchOptV);
}
public function getSongs(result:Array):void {
if (result != null) {
tvMaster.songList = null;
tvMaster.songList = new ArrayCollection(result);;
}
else {
tvMaster.songList = null;
tvMaster.songList = new ArrayCollection;
}
tvMaster.tuveShowSW();
}
private function changeChan():void {
tvMaster.tvNetwork.sendData("PART " + tvMaster.currentChannel + "\n");
tvMaster.currentChannel = tvMaster.chanList[selChan.selectedIndex].@data;
tvMaster.tvNetwork.sendData("JOIN " + tvMaster.currentChannel + "\n");
tvMaster.userList = null;
tvMaster.userList = new XMLList();
}
private function changeNick():void {
if (myNick.text.length > 32) {
myNick.text = tvMaster.userName;
}
else {
if (tvMaster.validateNick(myNick.text) == true) {
tvMaster.userName = myNick.text;
tvMaster.tvNetwork.sendData("NICK " + tvMaster.userName + "\n");
}
}
}
private function delSong():void {
tvMaster.masterObject.chatWindow.htmlText += myQueue.selectedItem.artist + " - " + myQueue.selectedItem.title + " Has been removed from your queue.\n"
tvMaster.myQueue.removeItemAt(myQueue.selectedIndex);
}
private function fbSend():void {
var fbData:Object = new Object();
fbData.subject = fbSubject.text;
fbData.message = fbMessage.text;
fbData.username = tvMaster.userName;
tvMaster.gateway.call("tuve.sendFB",new Responder(null,tvMaster.onFault),fbData);
fbData = null;
fbSubject.text = "";
fbMessage.text = "";
Alert.show("Feedback Has Been Sent");
}
private function setTopic():void {
tvMaster.tvNetwork.sendData("TOPIC " + tvMaster.currentChannel + ":" + tvMaster.topicHistory[topicNew.selectedIndex].@label);
}
private function doRandom():void {
if (tvR.selected == true) {
tvMaster.tvNetwork.sendData("MSG " + tvMaster.currentChannel + ":.tv mode +R\n");
tvR.selected = false;
}
else {
tvMaster.tvNetwork.sendData("MSG " + tvMaster.currentChannel + ":.tv mode -R\n");
tvR.selected = true;
}
}
private function doQueue():void {
if (tvQ.selected == true) {
tvMaster.tvNetwork.sendData("MSG " + tvMaster.currentChannel + ":.tv mode +Q\n");
tvQ.selected = false;
}
else {
tvMaster.tvNetwork.sendData("MSG " + tvMaster.currentChannel + ":.tv mode -Q\n");
tvQ.selected = true;
}
}
private function doExclusive():void {
if (tvE.selected == true) {
tvMaster.tvNetwork.sendData("MSG " + tvMaster.currentChannel + ":.tv mode +E\n");
tvE.selected = false;
}
else {
tvMaster.tvNetwork.sendData("MSG " + tvMaster.currentChannel + ":.tv mode -E\n");
tvE.selected = true;
}
}
private function doTime():void {
if (tvTime.text.length == 0)
tvTime.text = "300";
if (tvT.selected == true) {
tvMaster.tvNetwork.sendData("MSG " + tvMaster.currentChannel + ":.tv mode +T "+ tvTime.text + "\n");
tvT.selected = false;
}
else {
tvMaster.tvNetwork.sendData("MSG " + tvMaster.currentChannel + ":.tv mode -T\n");
tvT.selected = true;
}
}
private function doTimeBox():void {
tvMaster.tvNetwork.sendData("MSG " + tvMaster.currentChannel + ":.tv mode +T "+ tvTime.text + "\n");
}
private function doTimeEnter():void {
focusManager.setFocus(chatText);
}
private function doRating():void {
tvMaster.tvNetwork.sendData("MSG " + tvMaster.currentChannel + ":.tv mode +A " + tvMaster.tvRating[selR.selectedIndex].@data + "\n");
selR.selectedIndex = tvMaster.tvCurRating;
}
private function doClass():void {
tvMaster.tvNetwork.sendData("MSG " + tvMaster.currentChannel + ":.tv mode +C " + tvMaster.tvClass[selC.selectedIndex].@data + "\n");
selC.selectedIndex = tvMaster.tvCurClass;
}
public function getInfoRes(result:Array):void {
var tmpCollection:ArrayCollection;
if (result != null) {
tmpCollection = new ArrayCollection(result);
npThumb.source = "/images/" + tmpCollection[0].thumb;
npArtist.text = tmpCollection[0].artist;
npTitle.text = tmpCollection[0].title;
}
}
private function userClick():void {
tvMaster.tvNetwork.sendData('WHOIS ' + userDispList.selectedItem.@data + '\n');
tvMaster.findIM(userDispList.selectedItem.@data);
}
public function doMsg(event:MouseEvent):void {
}
public function doWhois(event:ContextMenuEvent):void {
tvMaster.tvNetwork.sendData("WHOIS " + userDispList.selectedItem.@data + "\n");
}
public function doBan(event:MouseEvent):void {
}
public function doKick(event:ContextMenuEvent):void {
tvMaster.tvNetwork.sendData("KICK " + tvMaster.currentChannel + ":" + userDispList.selectedItem.@data + ":Bye!\n");
}
/* End Of Pie Menu Functions */
]]>
</mx:Script>
<mx:TextArea x="2" width="490" height="490" y="50" mouseUp="tvMaster.setClip(chatWindow)" click="focusManager.setFocus(chatText)" updateComplete="chatWindow.verticalScrollPosition = chatWindow.maxVerticalScrollPosition" editable="false" id="chatWindow" horizontalScrollPolicy="off" borderThickness="1"/>
<mx:VSlider liveDragging="true" width="22" x="990" y="45" id="volume" snapInterval="1" value="75" maximum="100" change="updateVolume()" height="220"/>
<mx:Label textAlign="center" x="575" y="315" id="songTitle" width="400" color="#ffffff"/>
<mx:List id="userDispList" itemRollOver="userDispList.selectedIndex = event.rowIndex;" contextMenu="{uM}" y="50" height="490" width="75" x="494" dataProvider="{tvMaster.userList}" labelField="@label" doubleClickEnabled="true" doubleClick="userClick()" />
<mx:TextInput enter="sendText()" x="2" width="514" y="542" id="chatText" focusAlpha="0" height="22"/>
<mx:Button x="520" label="Send" y="542" click="sendText()" width="47"/>
<mx:TextInput x="74" y="566" width="493" enter="findSong()" id="searchBox" focusAlpha="0" />
<mx:Button x="2" y="566" label="Search" click="findSong()" width="70"/>
<mx:Image id="loud" source="@Embed('audio-volume-high3.png')" x="990" y="5" click="volume.value = 100; updateVolume();" />
<mx:Image id="mute" source="@Embed('audio-volume-low3.png')" x="990" y="273" click="volume.value = 0; updateVolume();" />
<mx:TabNavigator x="575" y="360" width="445" height="225" id="mainNav" creationPolicy="all">
<mx:Canvas label="My Queue" width="100%" height="100%">
<mx:DataGrid width="100%" height="100%" id="myQueue" dataProvider="{tvMaster.myQueue}" doubleClick="delSong()" doubleClickEnabled="true">
<mx:columns>
<mx:DataGridColumn headerText="Artist" dataField="artist"/>
<mx:DataGridColumn headerText="Title" dataField="title"/>
</mx:columns>
</mx:DataGrid>
</mx:Canvas>
<mx:Canvas id="nowplaying" label="Now Playing">
<mx:Image id="npThumb" source="http://www.ubixonline.com/images/none.gif" width="100" height="100" scaleContent="true" horizontalAlign="center" verticalAlign="middle"/>
<mx:Label text="Artist: " x="108" y="10" fontWeight="bold" color="#000000"/>
<mx:Label id="npArtist" x="158" y="10" width="100%" text="NA" />
<mx:Label text="Title:" x="108" y="36" color="#000000" fontWeight="bold"/>
<mx:Label id="npTitle" x="158" y="36" width="100%" text="NA"/>
<mx:Button x="108" y="62" label="Buy" click="mainNav.selectedIndex = 2;"/>
<mx:HRule x="10" y="105" width="100%"/>
<mx:Label x="10" y="108" text="Biography:"/>
<mx:LinkButton y="160" label="More Info" x="184.5" click="tvMaster.tuveShowIW(tvMaster.vid);"/>
</mx:Canvas>
<mx:Canvas id="buy" label="Buy">
</mx:Canvas>
<mx:Canvas id="feedback" label="FeedBack" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:Form width="100%" height="100%" >
<mx:FormItem label="Subject">
<mx:TextInput id="fbSubject" width="340"/>
</mx:FormItem>
<mx:FormItem label="Message">
<mx:TextArea id="fbMessage" width="340" height="106"/>
</mx:FormItem>
<mx:FormItem>
<mx:Button label="Submit" id="fbSubmit" click="fbSend()" />
</mx:FormItem>
</mx:Form>
</mx:Canvas>
<mx:Canvas label="Settings">
</mx:Canvas>
<mx:Canvas label="Help" width="100%" height="100%">
<mx:TextArea>
</mx:TextArea>
</mx:Canvas>
</mx:TabNavigator>
<mx:ComboBox x="2" y="2" width="120" dataProvider="{tvMaster.chanList}" id="selChan" labelField="@label" change="changeChan()" />
<mx:Label x="419" y="2" id="myNick" text="{tvMaster.userName}" textAlign="right" width="152" color="#ffffff" fontFamily="Georgia" fontSize="11" fontWeight="bold"/>
<mx:ComboBox x="2" y="26" width="567" id="topicNew" dataProvider="{tvMaster.topicHistory}" labelField="@label" change="setTopic()" />
<mx:Label id="tvTimer" x="575" y="336" text="(000)" width="400" color="#ffffff" textAlign="center"/>
<mx:Button id="tvR" x="124" y="2" label="R" toggle="true" width="20" toolTip="Random Play" click="doRandom()" />
<mx:Button id="tvQ" x="146" y="2" label="Q" toggle="true" width="20" toolTip="Queues Enabled" click="doQueue()" />
<mx:Button id="tvT" x="190" y="2" label="T" toggle="true" width="20" toolTip="Time Limit" click="doTime()"/>
<mx:Button id="tvE" x="168" y="2" label="E" toggle="true" width="20" toolTip="Exclusive Content" click="doExclusive()"/>
<mx:TextInput x="212" y="2" maxChars="10" id="tvTime" width="50" enter="doTimeEnter()" focusOut="doTimeBox()" />
<mx:ComboBox x="264" y="2" width="60" id="selR" dataProvider="{tvMaster.tvRating}" labelField="@label" change="doRating()" />
<mx:ComboBox x="326" y="2" width="115" id="selC" dataProvider="{tvMaster.tvClass}" labelField="@label" change="doClass()" />
</mx:Application>