home *** CD-ROM | disk | FTP | other *** search
- class mx.controls.streamingmedia.FullScreenToggle extends MovieClip
- {
- var _player;
- var _isFull;
- var _originalPlayerX;
- var _originalPlayerY;
- var _originalPlayerWidth;
- var _originalPlayerHeight;
- var _originalAutosize;
- var _waited;
- var onEnterFrame;
- var _maximize;
- var _minimize;
- function FullScreenToggle()
- {
- super();
- this.init();
- }
- function init()
- {
- this._player = this._parent._parent;
- this._isFull = false;
- this.setEnabled(this._player.enabled);
- }
- function isFullScreen()
- {
- return this._isFull;
- }
- function displayFull(noAction)
- {
- this.gotoAndStop("big");
- this._isFull = true;
- if(!noAction)
- {
- this._originalPlayerX = this._player._x;
- this._originalPlayerY = this._player._y;
- this._originalPlayerWidth = this._player.width;
- this._originalPlayerHeight = this._player.height;
- this._originalAutosize = this._player.autoSize;
- var _loc7_ = this._player.getController();
- if(_loc7_.controllerPolicy == "auto" && _loc7_.expanded)
- {
- mx.controls.streamingmedia.Tracer.trace("FullScreenToggle.displayFull: about to call contract");
- _loc7_.contract();
- }
- _loc7_.setNotAnimating(false);
- this._player.autoSize = false;
- var _loc4_ = this.getContainerInfo();
- this._player.setSize(_loc4_.width,_loc4_.height);
- if(_loc4_.origin)
- {
- var _loc5_ = mx.managers.SystemManager.screen;
- mx.controls.streamingmedia.Tracer.trace("FullScreenToggle.displayFull: scr=(" + _loc5_.x + "," + _loc5_.y + ")");
- this._player._x = _loc5_.x;
- this._player._y = _loc5_.y;
- }
- var _loc6_ = this._player.getBounds(_loc4_.container);
- mx.controls.streamingmedia.Tracer.trace("FullScreenToggle.displayFull: bounds=(" + _loc6_.xMin + "," + _loc6_.yMin + ")");
- if(_loc4_.origin)
- {
- this._player._x += _loc5_.x;
- this._player._y += _loc5_.y;
- }
- else
- {
- this._player._x += _loc4_.x;
- this._player._y += _loc4_.y;
- }
- this._player._x -= _loc6_.xMin;
- this._player._y -= _loc6_.yMin;
- this._waited = false;
- this.onEnterFrame = this.delayedBarRefresh;
- var _loc3_ = this.getOtherToggles();
- var _loc2_ = 0;
- while(_loc2_ < _loc3_.length)
- {
- _loc3_[_loc2_].displayFull(true);
- _loc2_ = _loc2_ + 1;
- }
- }
- }
- function getContainerInfo()
- {
- var _loc4_ = undefined;
- var _loc6_ = this.getScrollViewAncestor(this._player);
- if(_loc6_ == null)
- {
- var _loc5_ = mx.managers.SystemManager.screen;
- _loc4_ = {container:_root,width:_loc5_.width,height:_loc5_.height,x:0,y:0,origin:true};
- }
- else
- {
- var _loc3_ = _loc6_.getViewMetrics();
- _loc4_ = {container:_loc6_,width:_loc6_.width - _loc3_.left - _loc3_.right,height:_loc6_.height - _loc3_.top - _loc3_.bottom,x:_loc3_.left,y:_loc3_.top,origin:false};
- }
- return _loc4_;
- }
- function getScrollViewAncestor(anMC)
- {
- var _loc3_ = undefined;
- if(anMC == _root)
- {
- _loc3_ = null;
- }
- else if(anMC instanceof mx.core.ScrollView)
- {
- _loc3_ = anMC;
- }
- else
- {
- _loc3_ = this.getScrollViewAncestor(anMC._parent);
- }
- return _loc3_;
- }
- function delayedBarRefresh()
- {
- if(!this._waited)
- {
- this._waited = true;
- }
- else
- {
- delete this.onEnterFrame;
- this._player.getController().refreshBars();
- }
- }
- function displayNormal(noAction)
- {
- this.gotoAndStop("small");
- this._isFull = false;
- if(!noAction)
- {
- var _loc4_ = this._player.getController();
- if(_loc4_.controllerPolicy == "auto" && _loc4_.expanded)
- {
- mx.controls.streamingmedia.Tracer.trace("FullScreenToggle.displayNormal: about to call contract");
- _loc4_.contract();
- }
- _loc4_.setNotAnimating(false);
- this._player.autoSize = this._originalAutosize;
- this._player.setSize(this._originalPlayerWidth,this._originalPlayerHeight);
- this._player._x = this._originalPlayerX;
- this._player._y = this._originalPlayerY;
- this._waited = false;
- this.onEnterFrame = this.delayedBarRefresh;
- var _loc3_ = this.getOtherToggles();
- var _loc2_ = 0;
- while(_loc2_ < _loc3_.length)
- {
- _loc3_[_loc2_].displayNormal(true);
- _loc2_ = _loc2_ + 1;
- }
- }
- }
- function toggleDisplay()
- {
- if(this._isFull)
- {
- this.displayNormal();
- }
- else
- {
- this.displayFull();
- }
- }
- function getAllToggles()
- {
- return this._parent.getAllToggles();
- }
- function getOtherToggles()
- {
- var _loc3_ = this.getAllToggles();
- var _loc2_ = 0;
- while(_loc2_ < _loc3_.length)
- {
- if(_loc3_[_loc2_] == this)
- {
- _loc3_.splice(_loc2_,1);
- break;
- }
- _loc2_ = _loc2_ + 1;
- }
- return _loc3_;
- }
- function getPlayer()
- {
- return this._player;
- }
- function getEnabled()
- {
- return this._player.enabled;
- }
- function setEnabled(is)
- {
- mx.controls.streamingmedia.Tracer.trace("FullScreenToggle.setEnabled: " + is);
- this._maximize.setEnabled(is);
- this._minimize.setEnabled(is);
- }
- }
-