diff --git a/.actionScriptProperties b/.actionScriptProperties new file mode 100644 index 0000000..8d401ac --- /dev/null +++ b/.actionScriptProperties @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.flexProperties b/.flexProperties new file mode 100644 index 0000000..baf7241 --- /dev/null +++ b/.flexProperties @@ -0,0 +1,2 @@ + + diff --git a/.project b/.project new file mode 100644 index 0000000..3588f4d --- /dev/null +++ b/.project @@ -0,0 +1,18 @@ + + + SuperTUve + + + + + + com.adobe.flexbuilder.project.flexbuilder + + + + + + com.adobe.flexbuilder.project.flexnature + com.adobe.flexbuilder.project.actionscriptnature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..a90f545 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +#Wed Nov 21 06:38:56 EST 2007 +eclipse.preferences.version=1 +encoding/=utf-8 diff --git a/Login.mxml b/Login.mxml new file mode 100644 index 0000000..f16a3dc --- /dev/null +++ b/Login.mxml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Master.as b/Master.as new file mode 100644 index 0000000..c0e9d60 --- /dev/null +++ b/Master.as @@ -0,0 +1,131 @@ +/**************************************************************** + * Master.as, by Christopher Olsen + * Copyright 2007 Christopher Olsen + * Mark Iuzzolino + * + * This is the Master class used by the TUve player + * + * $Id$ + ***************************************************************/ + +package { + + import flash.net.NetConnection; + //import flash.net.NetStream; + //import mx.collections.ArrayCollection; + //import flash.net.Responder; + //import mx.controls.Alert; + //import mx.controls.Image; + //import flash.utils.Timer; + //import flash.events.TimerEvent; + import mx.events.FlexEvent; + //import flash.media.*; + //import mx.core.UIComponent; + //import flash.net.ObjectEncoding; + //import flash.events.NetStatusEvent; + //import flash.events.SecurityErrorEvent; + //import flash.events.AsyncErrorEvent; + //import flash.net.SharedObject; + //import mx.formatters.NumberFormatter; + //import flash.system.System; + //import mx.controls.TextArea; + + + public class Master { + + /* Variables */ + public var gateway:NetConnection; // AMF Gateway + public var masterObject:Object; // Parent reference + + [Bindable] + public var userName:String; // User Infomation + + public var tvCurRating:Number; + [Bindable] + public var tvRating:XMLList = + <> + + + + + + ; + + public var tvCurClass:Number; + [Bindable] + public var tvClass:XMLList = + <> + + + + + + + ; + + public var currentChannel:String; + + [Bindable] + public var channels:XMLList; + + [Bindable] + private var metaData:Object = {duration:0}; + + /* Pop Up Windows */ + private var tuveVW:videoWindow; + + + /* Initialization Routine */ + public function init(mO:Object):Boolean { + + /* Set Master Object */ + masterObject = mO; + + /* Initialize the AMF gateway */ + gateway = new NetConnection(); + gateway.connect("/amfphp/gateway.php"); + + return(true); + } /* End init */ + + /* AMF Fault Handler */ + public function onFault(fault:String):void { + //Alert.show("Error: " + fault.toString()); + trace(fault); + } + + /* Video Window Functions */ + + /* This function opens up the video window */ + public function tuveShowVW():void { + if (tuveVW == null) { + tuveVW = new videoWindow(); + tuveVW.tvMaster = this; + tuveVW.x = ((masterObject.width - tuveVW.width) / 2); + tuveVW.y = ((masterObject.height - tuveVW.height) /2 ); + tuveVW.addEventListener("closeWindow",tuveCloseVW,false,0,true); + masterObject.addChild(tuveVW); + } + } /* End tuveShowLW() */ + + /* This function closes the channel list window */ + public function tuveCloseVW(event:FlexEvent):void { + if (tuveVW != null) { + masterObject.removeChild(tuveVW); + tuveVW = null; + } + } /* End tuveCloseLW */ + /* End Video Window Functions */ + + public function validateNick(str:String):Boolean { + var pattern:RegExp = /^[a-zA-Z0-9]*$/; + var result:Object = pattern.exec(str); + if(result == null) { + return false; + } + return true; + } + + } /* End Master */ + + } /* End package */ \ No newline at end of file diff --git a/SuperTUve.mxml b/SuperTUve.mxml new file mode 100644 index 0000000..7b252d9 --- /dev/null +++ b/SuperTUve.mxml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + ; + + /* Private Vars */ + private var login:Login; + + /* End Vars */ + + private function initApp():void { + tvMaster.init(this); + + login = PopUpManager.createPopUp(this,Login,true) as Login; + login.funcs = this; + PopUpManager.centerPopUp(login); + } + + /* Authentication Handlers */ + public function authUser(username:String,password:String):void { + var authUser:Object = new Object(); + authUser.username = username; + authUser.password = password; + tvMaster.gateway.call("tuve.userAuth",new Responder(checkAuth,tvMaster.onFault), authUser); + authUser = null; + } /* End authUser */ + + private function checkAuth(result:Array):void { + if (result != null) { + var menuString:String; + PopUpManager.removePopUp(login); + } + } /* End checkAuth */ + /* End Authentication Handlers */ + + /* Menu Functions */ + public function doMenuClick():void { + if (mainMenu.selectedIndex != -1) { + switch (Number(tvMBC[mainMenu.selectedIndex].@data)) { + default: + break; + } + } + } + public function doMenuItem(event:MenuEvent):void { + switch (Number(event.item.@data)) { + case 1: + tvMaster.tuveShowVW(); + break; + default: + break; + } + } + /* End Menu Functions */ + + ]]> + + + + + + + diff --git a/assets/closeButtonDown.gif b/assets/closeButtonDown.gif new file mode 100644 index 0000000..fe9228f --- /dev/null +++ b/assets/closeButtonDown.gif Binary files differ diff --git a/assets/closeButtonOver.gif b/assets/closeButtonOver.gif new file mode 100644 index 0000000..e57dd73 --- /dev/null +++ b/assets/closeButtonOver.gif Binary files differ diff --git a/assets/closeButtonUp.gif b/assets/closeButtonUp.gif new file mode 100644 index 0000000..913e4e5 --- /dev/null +++ b/assets/closeButtonUp.gif Binary files differ diff --git a/assets/horizontalSize.gif b/assets/horizontalSize.gif new file mode 100644 index 0000000..7611108 --- /dev/null +++ b/assets/horizontalSize.gif Binary files differ diff --git a/assets/icon_left.png b/assets/icon_left.png new file mode 100644 index 0000000..9de1384 --- /dev/null +++ b/assets/icon_left.png Binary files differ diff --git a/assets/icon_left_disabled.png b/assets/icon_left_disabled.png new file mode 100644 index 0000000..2d61333 --- /dev/null +++ b/assets/icon_left_disabled.png Binary files differ diff --git a/assets/icon_right.png b/assets/icon_right.png new file mode 100644 index 0000000..3f9abcc --- /dev/null +++ b/assets/icon_right.png Binary files differ diff --git a/assets/icon_right_disabled.png b/assets/icon_right_disabled.png new file mode 100644 index 0000000..bf787ac --- /dev/null +++ b/assets/icon_right_disabled.png Binary files differ diff --git a/assets/leftObliqueSize.gif b/assets/leftObliqueSize.gif new file mode 100644 index 0000000..5fdea2e --- /dev/null +++ b/assets/leftObliqueSize.gif Binary files differ diff --git a/assets/maxButtonDown.gif b/assets/maxButtonDown.gif new file mode 100644 index 0000000..d3f3405 --- /dev/null +++ b/assets/maxButtonDown.gif Binary files differ diff --git a/assets/maxButtonOver.gif b/assets/maxButtonOver.gif new file mode 100644 index 0000000..b1294ee --- /dev/null +++ b/assets/maxButtonOver.gif Binary files differ diff --git a/assets/maxButtonUp.gif b/assets/maxButtonUp.gif new file mode 100644 index 0000000..d835ac0 --- /dev/null +++ b/assets/maxButtonUp.gif Binary files differ diff --git a/assets/minButtonDown.gif b/assets/minButtonDown.gif new file mode 100644 index 0000000..2bb9f2a --- /dev/null +++ b/assets/minButtonDown.gif Binary files differ diff --git a/assets/minButtonOver.gif b/assets/minButtonOver.gif new file mode 100644 index 0000000..c9e2ad1 --- /dev/null +++ b/assets/minButtonOver.gif Binary files differ diff --git a/assets/minButtonUp.gif b/assets/minButtonUp.gif new file mode 100644 index 0000000..7a7cd4d --- /dev/null +++ b/assets/minButtonUp.gif Binary files differ diff --git a/assets/restButtonDown.gif b/assets/restButtonDown.gif new file mode 100644 index 0000000..2369e50 --- /dev/null +++ b/assets/restButtonDown.gif Binary files differ diff --git a/assets/restButtonOver.gif b/assets/restButtonOver.gif new file mode 100644 index 0000000..64ce8f2 --- /dev/null +++ b/assets/restButtonOver.gif Binary files differ diff --git a/assets/restButtonUp.gif b/assets/restButtonUp.gif new file mode 100644 index 0000000..916fb25 --- /dev/null +++ b/assets/restButtonUp.gif Binary files differ diff --git a/assets/rightObliqueSize.gif b/assets/rightObliqueSize.gif new file mode 100644 index 0000000..88ade5e --- /dev/null +++ b/assets/rightObliqueSize.gif Binary files differ diff --git a/assets/verticalSize.gif b/assets/verticalSize.gif new file mode 100644 index 0000000..1f0ad6e --- /dev/null +++ b/assets/verticalSize.gif Binary files differ diff --git a/html-template/AC_OETags.js b/html-template/AC_OETags.js new file mode 100644 index 0000000..65d1755 --- /dev/null +++ b/html-template/AC_OETags.js @@ -0,0 +1,269 @@ +// Flash Player Version Detection - Rev 1.5 +// Detect Client Browser type +// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved. +var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; +var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; +var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; + +function ControlVersion() +{ + var version; + var axo; + var e; + + // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry + + try { + // version will be set for 7.X or greater players + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); + version = axo.GetVariable("$version"); + } catch (e) { + } + + if (!version) + { + try { + // version will be set for 6.X players only + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); + + // installed player is some revision of 6.0 + // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29, + // so we have to be careful. + + // default to the first public version + version = "WIN 6,0,21,0"; + + // throws if AllowScripAccess does not exist (introduced in 6.0r47) + axo.AllowScriptAccess = "always"; + + // safe to call for 6.0r47 or greater + version = axo.GetVariable("$version"); + + } catch (e) { + } + } + + if (!version) + { + try { + // version will be set for 4.X or 5.X player + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); + version = axo.GetVariable("$version"); + } catch (e) { + } + } + + if (!version) + { + try { + // version will be set for 3.X player + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); + version = "WIN 3,0,18,0"; + } catch (e) { + } + } + + if (!version) + { + try { + // version will be set for 2.X player + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); + version = "WIN 2,0,0,11"; + } catch (e) { + version = -1; + } + } + + return version; +} + +// JavaScript helper required to detect Flash Player PlugIn version information +function GetSwfVer(){ + // NS/Opera version >= 3 check for Flash plugin in plugin array + var flashVer = -1; + + if (navigator.plugins != null && navigator.plugins.length > 0) { + if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { + var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; + var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; + var descArray = flashDescription.split(" "); + var tempArrayMajor = descArray[2].split("."); + var versionMajor = tempArrayMajor[0]; + var versionMinor = tempArrayMajor[1]; + if ( descArray[3] != "" ) { + tempArrayMinor = descArray[3].split("r"); + } else { + tempArrayMinor = descArray[4].split("r"); + } + var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0; + var flashVer = versionMajor + "." + versionMinor + "." + versionRevision; + } + } + // MSN/WebTV 2.6 supports Flash 4 + else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4; + // WebTV 2.5 supports Flash 3 + else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3; + // older WebTV supports Flash 2 + else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2; + else if ( isIE && isWin && !isOpera ) { + flashVer = ControlVersion(); + } + return flashVer; +} + +// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available +function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) +{ + versionStr = GetSwfVer(); + if (versionStr == -1 ) { + return false; + } else if (versionStr != 0) { + if(isIE && isWin && !isOpera) { + // Given "WIN 2,0,0,11" + tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"] + tempString = tempArray[1]; // "2,0,0,11" + versionArray = tempString.split(","); // ['2', '0', '0', '11'] + } else { + versionArray = versionStr.split("."); + } + var versionMajor = versionArray[0]; + var versionMinor = versionArray[1]; + var versionRevision = versionArray[2]; + + // is the major.revision >= requested major.revision AND the minor version >= requested minor + if (versionMajor > parseFloat(reqMajorVer)) { + return true; + } else if (versionMajor == parseFloat(reqMajorVer)) { + if (versionMinor > parseFloat(reqMinorVer)) + return true; + else if (versionMinor == parseFloat(reqMinorVer)) { + if (versionRevision >= parseFloat(reqRevision)) + return true; + } + } + return false; + } +} + +function AC_AddExtension(src, ext) +{ + if (src.indexOf('?') != -1) + return src.replace(/\?/, ext+'?'); + else + return src + ext; +} + +function AC_Generateobj(objAttrs, params, embedAttrs) +{ + var str = ''; + if (isIE && isWin && !isOpera) + { + str += ' '; + str += '>'; + } else { + str += ' + + + + + + + + \ No newline at end of file diff --git a/html-template/history.js b/html-template/history.js new file mode 100644 index 0000000..ea5a8a7 --- /dev/null +++ b/html-template/history.js @@ -0,0 +1,48 @@ +// $Revision$ +// Vars +Vars = function(qStr) { + this.numVars = 0; + if(qStr != null) { + var nameValue, name; + var pairs = qStr.split('&'); + var pairLen = pairs.length; + for(var i = 0; i < pairLen; i++) { + var pair = pairs[i]; + if( (pair.indexOf('=')!= -1) && (pair.length > 3) ) { + var nameValue = pair.split('='); + var name = nameValue[0]; + var value = nameValue[1]; + if(this[name] == null && name.length > 0 && value.length > 0) { + this[name] = value; + this.numVars++; + } + } + } + } +} +Vars.prototype.toString = function(pre) { + var result = ''; + if(pre == null) { pre = ''; } + for(var i in this) { + if(this[i] != null && typeof(this[i]) != 'object' && typeof(this[i]) != 'function' && i != 'numVars') { + result += pre + i + '=' + this[i] + '&'; + } + } + if(result.length > 0) result = result.substr(0, result.length-1); + return result; +} +function getSearch(wRef) { + var searchStr = ''; + if(wRef.location.search.length > 1) { + searchStr = new String(wRef.location.search); + searchStr = searchStr.substring(1, searchStr.length); + } + return searchStr; +} +var lc_id = Math.floor(Math.random() * 100000).toString(16); +if (this != top) +{ + top.Vars = Vars; + top.getSearch = getSearch; + top.lc_id = lc_id; +} diff --git a/html-template/history.swf b/html-template/history.swf new file mode 100644 index 0000000..e6e03ec --- /dev/null +++ b/html-template/history.swf Binary files differ diff --git a/html-template/index.template.html b/html-template/index.template.html new file mode 100644 index 0000000..3c046a7 --- /dev/null +++ b/html-template/index.template.html @@ -0,0 +1,107 @@ + + + + +${title} + + + + + + + + + + + + diff --git a/html-template/playerProductInstall.swf b/html-template/playerProductInstall.swf new file mode 100644 index 0000000..bdc3437 --- /dev/null +++ b/html-template/playerProductInstall.swf Binary files differ diff --git a/tvWindow.as b/tvWindow.as new file mode 100644 index 0000000..1b9f46e --- /dev/null +++ b/tvWindow.as @@ -0,0 +1,492 @@ +/**************************************************************** + * ucWindow Class, by Christopher Olsen + * Copyright 2007 Christopher Olsen + * + * This is the PodWindow container + * + * It handles the following: + * Window Resize + * Invokes Windows Close Event + * + * It contains the following: + * Top margin for window move + * Left margine for window move + * Minimum window size + * Max window size + * !! Note: The pod manager can override these values + * + * $Id$ + ***************************************************************/ + +package { + + import flash.events.MouseEvent; + import flash.events.Event; + import mx.controls.Button; + import mx.containers.Panel; + import mx.controls.Image; + import mx.events.FlexEvent + import flash.geom.Point; + import mx.managers.CursorManager; + import mx.managers.CursorManagerPriority; + import mx.core.Application; + import mx.containers.ApplicationControlBar; + import mx.controls.ColorPicker; + import mx.events.ColorPickerEvent; + import mx.events.DragEvent; + import mx.core.DragSource; + import mx.managers.DragManager; + import mx.controls.Alert; + + 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")] + private var closeButtonUp:Class; + [Embed(source="assets/closeButtonOver.gif")] + 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 pwButtonVisible:Boolean = false; + private var pwAttached:Boolean = false; + + private var minY:Number = 23; + + + public function tvWindow() { + super(); + this.addEventListener(FlexEvent.CREATION_COMPLETE, pwInit); + this.addEventListener(MouseEvent.MOUSE_DOWN, mouseClickHandler, false); + this.addEventListener(MouseEvent.MOUSE_MOVE, oMouseMove, false); + this.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler,true); + this.setStyle("borderThicknessTop",0); + this.setStyle("borderThicknessBottom",0); + this.setStyle("borderThicknessLeft",0); + this.setStyle("borderThicknessRight",0); + this.setStyle("headerHeight",20); + this.setStyle("borderAlpha",.75); + this.setStyle("borderColor","#808080"); + } /* end Pod Window */ + + /****************************************************** + * Handlers Section + * + ******************************************************/ + private function pwMouseOver(event:MouseEvent):void { + pwShowButtons(); + } + + private function pwMouseOut(event:MouseEvent):void { + pwHideButtons(); + } + + private function pwInit(event:FlexEvent):void { + titleBar.addEventListener(MouseEvent.MOUSE_OVER, pwMouseOver,false,0,true); + titleBar.addEventListener(MouseEvent.MOUSE_OUT, pwMouseOut,false,0,true); + } + + /* + This function attaches the buttons to the PodWindow + */ + + public function pwAttachButtons():void { + var nC:Boolean = false; + + /* + if (myPod != null) + nC = myPod.podzMaster.podzManager.nC; + */ + + if ((closeButton == null) && (nC == false)) { + closeButton = new Button(); + closeButton.width=10; + closeButton.height=10; + closeButton.focusEnabled=false; + closeButton.setStyle("upSkin", closeButtonUp); + closeButton.setStyle("overSkin", closeButtonOver); + closeButton.setStyle("downSkin", closeButtonDown); + 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.focusEnabled=false; + 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.focusEnabled=false; + 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 >= minY) { + 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 >= minY) { + 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))) { + 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 = minY; + 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 + * + *****************************************************/ + public function pwHideButtons():void { + + if (closeButton != null) + closeButton.visible = false; + + if (maxButton != null) + maxButton.visible = false; + + if (minButton != null) + minButton.visible = false; + + pwButtonVisible = false; + } + + public function pwShowButtons():void { + if (pwAttached == false) + pwAttachButtons(); + + if (closeButton != null) + closeButton.visible = true; + + if (maxButton != null) + maxButton.visible = true; + + if (minButton != null) + minButton.visible = true; + + pwButtonVisible = true; + } + + private function alignButtons():void { + var bcnt:Number = 1; + + if (closeButton != null) { + 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++; + } + + + if (pwButtonVisible == true) + pwShowButtons(); + else + pwHideButtons(); + } + + /*************/ + private function podDoMove(event:MouseEvent):void { + var newY:Number; + var newX:Number; + event.stopImmediatePropagation(); + + newY = _startY + event.stageY - _dragStartY; + newX = _startX + event.stageX - _dragStartX; + + if (newY > minY && newX > 1) + move(newX,newY); + else if (newY > minY && newX < 1) + move(1,newY); + else if (newY < minY && newX < 1) + move(1,minY); + else + move(newX,minY); + } /* End podDoMove */ + + // Event handler to end moving + private function podEndMove(event:MouseEvent):void { + var newY:Number; + var newX:Number; + + event.stopImmediatePropagation(); + Application.application.parent.removeEventListener(MouseEvent.MOUSE_MOVE, podDoMove, true); + Application.application.parent.removeEventListener(MouseEvent.MOUSE_UP, podEndMove, true); + + newY = _startY + event.stageY - _dragStartY; + newX = _startX + event.stageX - _dragStartX; + + if (newY > minY && newX > 1) + move(newX,newY); + else if (newY > minY && newX < 1) + move(1,newY); + else if (newY < minY && newX < 1) + move(1,minY); + else + move(newX,minY); + } /* End podEndMove */ + /*************/ + + } /* end class */ + + } /* end package */ \ No newline at end of file diff --git a/videoWindow.mxml b/videoWindow.mxml new file mode 100644 index 0000000..70e8f18 --- /dev/null +++ b/videoWindow.mxml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file