home *** CD-ROM | disk | FTP | other *** search
- class mx.controls.streamingmedia.ScreenAccommodator
- {
- var containee;
- var container;
- var beforeInit;
- var initId;
- var wasAlreadyDisabled;
- var initAction = "nothing";
- function ScreenAccommodator(aContainee)
- {
- this.containee = aContainee;
- this.container = this.getContainingScreen();
- if(this.container != null)
- {
- var _loc2_ = this.container.visible;
- this.beforeInit = false;
- this.container.addEventListener("hide",this);
- this.container.addEventListener("reveal",this);
- if(!_loc2_)
- {
- this.beforeInit = true;
- this.initId = setInterval(this,"disableContainee",50);
- }
- }
- }
- function disableContainee()
- {
- if(this.initAction == "nothing" || this.initAction == "hide")
- {
- mx.controls.streamingmedia.Tracer.trace("ScreenAccommodator.disableContainee: disabling " + this.containee);
- this.containee.enabled = false;
- }
- clearInterval(this.initId);
- this.beforeInit = false;
- }
- function getContainingScreen()
- {
- var _loc4_ = null;
- var _loc3_ = this.containee._parent;
- while(_loc4_ == null && _loc3_ != _root)
- {
- if(_loc3_ instanceof mx.screens.Screen)
- {
- _loc4_ = _loc3_;
- }
- else
- {
- _loc3_ = _loc3_._parent;
- }
- }
- return _loc4_;
- }
- function handleEvent(ev)
- {
- mx.controls.streamingmedia.Tracer.trace("ScreenAccommodator.handleEvent: " + ev.type + " for " + this.containee);
- if(ev.type == "hide")
- {
- if(this.beforeInit)
- {
- this.initAction = "hide";
- }
- else if(this.containee.enabled)
- {
- this.wasAlreadyDisabled = false;
- this.containee.enabled = false;
- }
- else
- {
- this.wasAlreadyDisabled = true;
- }
- }
- else if(ev.type == "reveal")
- {
- if(this.beforeInit)
- {
- this.initAction = "reveal";
- }
- else if(!this.wasAlreadyDisabled && this.containee.visible)
- {
- this.containee.enabled = true;
- }
- }
- }
- }
-