diff --git a/src/Master.as b/src/Master.as index 6728d6e..5787949 100644 --- a/src/Master.as +++ b/src/Master.as @@ -356,7 +356,6 @@ public function tuveShowIW(vid:Number):void { if (tuveIW == null) { tuveIW = new infoWindow(); - tuveIW.tvSizable = false; tuveIW.tvMaster = this; @@ -380,7 +379,6 @@ public function tuveShowTW():void { if (tuveTW == null) { tuveTW = new tipsWindow(); - tuveTW.tvSizable = false; tuveTW.tvMaster = this; diff --git a/src/tipsWindow.mxml b/src/tipsWindow.mxml index e700ab1..d7be1b8 100644 --- a/src/tipsWindow.mxml +++ b/src/tipsWindow.mxml @@ -14,7 +14,7 @@ "/list Will show you all the current channels and current videos.", "If you know any Unicorns, send them our way.", "Double clicking on someone or /msg someone msg, Will start an IM with them.", - "Pop-up windows can be moved or closed via the translucent title bar.", + "Pop-up windows can be moved or closed via the title bar.", "When girls are around, always have an altoid.", "Clicking on the bracketed text in the chat window will bring up more info about the artist.", "You can change your nick by doing /nick YourNewNick", diff --git a/src/tuveNetwork.as b/src/tuveNetwork.as index 1416521..b341ab2 100644 --- a/src/tuveNetwork.as +++ b/src/tuveNetwork.as @@ -45,15 +45,14 @@ /* Send data to the socket */ public function sendData(data:String):void { - tvSocket.writeUTFBytes(data); + tvSocket.writeUTFBytes(data + "\n"); tvSocket.flush(); } /* End sendData */ /* Let's auth to the network */ private function doNetAuth(event:Event):void { tvNetCon = true; - tvSocket.writeUTFBytes("CLIENT " + tvMaster.version + "\n"); - tvSocket.flush(); + sendData("CLIENT " + tvMaster.version); } /* End doNetAuth */ private function doNetSuccess():void { @@ -61,12 +60,10 @@ tvMaster.userList = new XMLList(); tvMaster.masterObject.userDispList.dataProvider = tvMaster.userList; - tvSocket.writeUTFBytes("join " + tvMaster.currentChannel + "\n"); - tvSocket.flush(); + sendData("JOIN " + tvMaster.currentChannel); attempts = 0; tvMaster.masterObject.chatWindow.htmlText += "

[" + tvMaster.fmtdDate() + "] Connected to server.

"; - } private function onConnectError(event:IOErrorEvent):void { @@ -87,7 +84,7 @@ var tmpString:String; var fc:Boolean = false; - event.bytesLoaded + //event.bytesLoaded _data = this.tvSocket.readUTFBytes(this.tvSocket.bytesAvailable); _dataArray = _data.split("\n"); @@ -172,8 +169,7 @@ } } /* End JOIN */ else if (data.indexOf("GETVIDEO") == 0) { - tvSocket.writeUTFBytes("QUEUE EMPTY\n"); - tvSocket.flush(); + sendData("QUEUE EMPTY"); } /* End GETVIDEO */ else if (data.indexOf("PAUSE") == 0) { curTime = tvMaster.tvSyncNS.time; @@ -307,8 +303,7 @@ if (Number(dataArray[1]) == 1) Alert.show(dataArray[2]); - tvSocket.writeUTFBytes("IDENT " + tvMaster.userName + ":" + tvMaster.tvSO.data.myID + "\n"); - tvSocket.flush(); + sendData("IDENT " + tvMaster.userName + ":" + tvMaster.tvSO.data.myID); } /* End CLIENT */ } /*End big for */ } diff --git a/src/tvWindow.as b/src/tvWindow.as index 040f6c1..fd4e4d6 100644 --- a/src/tvWindow.as +++ b/src/tvWindow.as @@ -19,29 +19,14 @@ ***************************************************************/ package { - import flash.events.MouseEvent; import flash.geom.Point; - import mx.containers.Panel; import mx.controls.Button; import mx.core.Application; import mx.events.FlexEvent; - import mx.managers.CursorManager; - import mx.managers.CursorManagerPriority; public class tvWindow extends Panel { - - /* Mouse Pointers */ - [Embed(source="assets/leftObliqueSize.gif")] - private static var leftObliqueSize:Class; - [Embed(source="assets/rightObliqueSize.gif")] - private static var rightObliqueSize:Class; - [Embed(source="assets/horizontalSize.gif")] - private static var horizontalSize:Class; - [Embed(source="assets/verticalSize.gif")] - private static var verticalSize:Class; - /* The close button */ private var closeButton:Button; [Embed(source="assets/closeButtonUp.gif")] @@ -50,52 +35,19 @@ private var closeButtonOver:Class; [Embed(source="assets/closeButtonDown.gif")] private var closeButtonDown:Class; - /* The min button */ - private var minButton:Button; - [Embed(source="assets/minButtonUp.gif")] - private var minButtonUp:Class; - [Embed(source="assets/minButtonOver.gif")] - private var minButtonOver:Class; - [Embed(source="assets/minButtonDown.gif")] - private var minButtonDown:Class; - /* The max button */ - private var maxButton:Button; - [Embed(source="assets/maxButtonUp.gif")] - private var maxButtonUp:Class; - [Embed(source="assets/maxButtonOver.gif")] - private var maxButtonOver:Class; - [Embed(source="assets/maxButtonDown.gif")] - private var maxButtonDown:Class; - [Embed(source="assets/restButtonUp.gif")] - private var restButtonUp:Class; - [Embed(source="assets/restButtonOver.gif")] - private var restButtonOver:Class; - [Embed(source="assets/restButtonDown.gif")] - private var restButtonDown:Class; - - private var mMC:Boolean = false; - - private var _pwMin:Boolean = false; private var _stageY: Number; private var _startY: Number; private var _startX: Number; private var _dragStartX: Number; private var _dragStartY: Number; - private var oWidth:Number; - private var oHeight:Number; - //public var myPod:Podz; - public var closeable:Boolean = true; - private var resizePoint:Point = new Point(); - private var resizeType:Number = 0; - public var tvSizable:Boolean = true; - + + /* Previous x,y width and height before maximized */ - private var oldX:Number = 0; - private var oldY:Number = 0; - private var oldWidth:Number = 0; - private var oldHeight:Number = 0; - private var pwAttached:Boolean = false; + //private var oldX:Number = 0; + //private var oldY:Number = 0; + //private var oldWidth:Number = 0; + //private var oldHeight:Number = 0; public var sW:Boolean = false; @@ -111,8 +63,6 @@ private function pwInit(event:FlexEvent):void { if (sW == false) { this.addEventListener(MouseEvent.MOUSE_DOWN, mouseClickHandler, false); - this.addEventListener(MouseEvent.MOUSE_MOVE, oMouseMove, false); - this.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler,true); pwAttachButtons(); } } @@ -122,9 +72,7 @@ */ public function pwAttachButtons():void { - var nC:Boolean = false; - - if ((closeButton == null) && (nC == false)) { + if (closeButton == null) { closeButton = new Button(); closeButton.width=10; closeButton.height=10; @@ -134,228 +82,30 @@ closeButton.addEventListener(MouseEvent.CLICK, closeButtonHandler); titleBar.addChild(closeButton); } - else if ((closeButton != null) && (closeable == false)) { - titleBar.removeChild(closeButton); - closeButton.removeEventListener(MouseEvent.CLICK,closeButtonHandler); - closeButton = null; - } - if ((maxButton == null) && (tvSizable == true)) { - maxButton = new Button(); - maxButton.width=10; - maxButton.height=10; - maxButton.setStyle("upSkin", maxButtonUp); - maxButton.setStyle("overSkin", maxButtonOver); - maxButton.setStyle("downSkin", maxButtonDown); - maxButton.addEventListener(MouseEvent.CLICK, maxButtonHandler); - titleBar.addChild(maxButton); - } - - if ((minButton == null) && (tvSizable == true)) { - minButton = new Button(); - minButton.width=10; - minButton.height=10; - minButton.setStyle("upSkin", minButtonUp); - minButton.setStyle("overSkin", minButtonOver); - minButton.setStyle("downSkin", minButtonDown); - minButton.addEventListener(MouseEvent.CLICK, minButtonHandler); - titleBar.addChild(minButton); - } - - pwAttached = true; alignButtons(); } /* end addButtons */ - - - // Event handler for mouse over moves - private function oMouseMove(event:MouseEvent):void { - var contentPoint:Point = event.currentTarget.globalToContent(new Point(event.stageX, event.stageY)); - - if (_pwMin == true) - return; - - if ((contentPoint.y > event.currentTarget.height - 40) && (contentPoint.x > event.currentTarget.width - 30)){ - CursorManager.removeCursor(CursorManager.currentCursorID); - CursorManager.setCursor(leftObliqueSize,CursorManagerPriority.MEDIUM, -6, -6); - mMC = true; - } - else if ((contentPoint.y < -15) && (contentPoint.x > event.currentTarget.width - 5)) { - CursorManager.removeCursor(CursorManager.currentCursorID); - CursorManager.setCursor(rightObliqueSize,CursorManagerPriority.MEDIUM, -6, -6); - mMC = true; - } - else if (mMC == true) { - CursorManager.removeCursor(CursorManager.currentCursorID); - mMC = false; - } - } /* End oMouseMose */ - - // Event handler to do actual resize - private function pwDoResize(event:MouseEvent):void { - var xPlus:Number = Application.application.parent.mouseX - resizePoint.x; - var yPlus:Number = Application.application.parent.mouseY - resizePoint.y; - var newY:Number; - - switch (resizeType) { - case 1: - this.width = oWidth + xPlus > 0 ? oWidth + xPlus : this.width; - this.height = oHeight + yPlus > 0 ? oHeight + yPlus : this.height; - break; - case 2: - this.width = oWidth + xPlus > 0 ? oWidth + xPlus : this.width; - - newY = _startY + event.stageY - _stageY; - if (newY >= 1) { - this.y = newY; - this.height = oHeight - yPlus > 0 ? oHeight - yPlus : this.height; - } - - break; - } - /* re-align the buttons */ - alignButtons(); - } - - // Event handler to end resize - private function pwEndResize(event:MouseEvent):void { - var xPlus:Number = Application.application.parent.mouseX - resizePoint.x; - var yPlus:Number = Application.application.parent.mouseY - resizePoint.y; - var newY:Number; - - event.stopImmediatePropagation(); - - Application.application.parent.removeEventListener(MouseEvent.MOUSE_MOVE, pwDoResize, true); - Application.application.parent.removeEventListener(MouseEvent.MOUSE_UP, pwEndResize, true); - - switch (resizeType) { - case 1: - this.width = oWidth + xPlus > 0 ? oWidth + xPlus : this.width; - this.height = oHeight + yPlus > 0 ? oHeight + yPlus : this.height; - break; - case 2: - this.width = oWidth + xPlus > 0 ? oWidth + xPlus : this.width; - - newY = _startY + event.stageY - _stageY; - if (newY >= 1) { - this.y = newY; - this.height = oHeight - yPlus > 0 ? oHeight - yPlus : this.height; - } - - break; - } - /* re-align the buttons */ - alignButtons(); - - /* Unset resizeType incase event is still in propagation */ - resizeType = 0; - - } /* End pwEndResize */ - - private function mouseOutHandler(event:MouseEvent):void { - CursorManager.removeCursor(CursorManager.currentCursorID); - } // Event handler for mouse click private function mouseClickHandler(event:MouseEvent):void { var contentPoint:Point = event.currentTarget.globalToContent(new Point(event.stageX, event.stageY)); - //podParent.setChildIndex(event.currentTarget,podParent.numChildren-1); + this.parentDocument.setChildIndex(event.currentTarget,this.parentDocument.numChildren-1); - if ((contentPoint.y > this.height - 40) && (contentPoint.x > this.width - 30) && (tvSizable == true)){ - _dragStartX = event.localX; - _dragStartY = event.localY; - - oWidth = event.currentTarget.width; - oHeight = event.currentTarget.height; - - resizePoint = event.currentTarget.localToGlobal(new Point(event.currentTarget.mouseX,event.currentTarget.mouseY)); - - resizeType = 1; - - Application.application.parent.addEventListener(MouseEvent.MOUSE_UP, pwEndResize, true); - Application.application.parent.addEventListener(MouseEvent.MOUSE_MOVE, pwDoResize, true); - } - else if ((contentPoint.y < -15) && (contentPoint.x > this.width - 5) && (tvSizable == true)) { - _dragStartX = event.localX; - _dragStartY = event.localY; - - _startY = event.currentTarget.y; - _stageY = event.stageY; - - oWidth = event.currentTarget.width - oHeight = event.currentTarget.height; - resizePoint = event.currentTarget.localToGlobal(new Point(event.currentTarget.mouseX,event.currentTarget.mouseY)); - resizeType = 2; - Application.application.parent.addEventListener(MouseEvent.MOUSE_UP, pwEndResize, true); - Application.application.parent.addEventListener(MouseEvent.MOUSE_MOVE, pwDoResize, true); - } - else if ((contentPoint.y < 0) && (contentPoint.x < (event.currentTarget.width - 5))) { + if ((contentPoint.y < 0) && (contentPoint.x < (event.currentTarget.width - 5))) { Application.application.parent.addEventListener(MouseEvent.MOUSE_UP, podEndMove, true); Application.application.parent.addEventListener(MouseEvent.MOUSE_MOVE, podDoMove, true); _startX = event.currentTarget.x; _startY = event.currentTarget.y; _dragStartX = event.stageX; _dragStartY = event.stageY; - } - - + } } /* End hMouseClick */ public function closeButtonHandler(event:MouseEvent):void{ dispatchEvent(new FlexEvent("closeWindow")); } /* end buttonCloseHandler */ - private function minButtonHandler(event:MouseEvent):void { - this.oldHeight = this.height; - this.oldWidth = this.width; - this.oldY = this.y; - - this.height = this.titleBar.height; - - maxButton.setStyle("upSkin", restButtonUp); - maxButton.setStyle("overSkin", restButtonOver); - maxButton.setStyle("downSkin", restButtonDown); - - _pwMin = true; - - } /* End minButtonHandler() */ - - private function maxButtonHandler(event:MouseEvent):void { - if (this.oldY != 0) { - if (_pwMin != true) { - this.x = this.oldX; - this.y = this.oldY; - } - else - _pwMin = false; - - this.height = this.oldHeight; - this.width = this.oldWidth; - this.oldY = 0; - maxButton.setStyle("upSkin", maxButtonUp); - maxButton.setStyle("overSkin", maxButtonOver); - maxButton.setStyle("downSkin", maxButtonDown); - } - else { - this.oldX = this.x; - this.oldY = this.y; - this.oldHeight = this.height; - this.oldWidth = this.width; - this.width = this.parentDocument.width - 2; - this.height = this.parentDocument.height - 23; - this.y = 1; - this.x = 1; - maxButton.setStyle("upSkin", restButtonUp); - maxButton.setStyle("overSkin", restButtonOver); - maxButton.setStyle("downSkin", restButtonDown); - } - - resizeType = 0; - - this.titleBar.width = this.width; - alignButtons(); - } /* End maxButtonHandler() */ - /****************************************************** * Private functions to the new container class * @@ -367,14 +117,6 @@ closeButton.move(titleBar.width - (bcnt * 16), (titleBar.height - 10) / 2); bcnt++; } - if (maxButton != null) { - maxButton.move(titleBar.width - (bcnt * 16), (titleBar.height - 10) / 2); - bcnt++; - } - if (minButton != null) { - minButton.move(titleBar.width - (bcnt * 16), (titleBar.height - 10) / 2); - bcnt++; - } } /*************/ diff --git a/src/ubChattin.mxml b/src/ubChattin.mxml index 2906654..8388d77 100644 --- a/src/ubChattin.mxml +++ b/src/ubChattin.mxml @@ -57,10 +57,10 @@ borderThickness: 0; } +