#FEC-167 #time 0.5h #comment don't start flavor switching if only one flaovr is available

--- plugins/wvPlugin/src/WvMediator.as
+++ plugins/wvPlugin/src/WvMediator.as
@@ -1,436 +1,437 @@
-package
-{
-	import com.kaltura.KalturaClient;
-	import com.kaltura.kdpfl.model.MediaProxy;
-	import com.kaltura.kdpfl.model.SequenceProxy;
-	import com.kaltura.kdpfl.model.ServicesProxy;
-	import com.kaltura.kdpfl.model.type.EnableType;
-	import com.kaltura.kdpfl.model.type.NotificationType;
-	import com.kaltura.kdpfl.model.type.SequenceContextType;
-	import com.kaltura.kdpfl.model.type.StreamerType;
-	import com.kaltura.kdpfl.plugin.WVLoadTrait;
-	import com.kaltura.kdpfl.plugin.WVPluginInfo;
-	import com.kaltura.kdpfl.view.controls.BufferAnimationMediator;
-	import com.kaltura.kdpfl.view.media.KMediaPlayerMediator;
-	import com.kaltura.vo.KalturaFlavorAsset;
-	import com.kaltura.vo.KalturaMediaEntry;
-	import com.kaltura.vo.KalturaWidevineFlavorAsset;
-	import com.widevine.WvNetConnection;
-
-	import flash.events.Event;
-	import flash.events.NetStatusEvent;
-	import flash.events.TimerEvent;
-	import flash.external.ExternalInterface;
-	import flash.utils.Timer;
-	import flash.utils.setTimeout;
-
-	import org.osmf.events.MediaElementEvent;
-	import org.osmf.events.MediaErrorEvent;
-	import org.osmf.traits.MediaTraitType;
-	import org.puremvc.as3.interfaces.INotification;
-	import org.puremvc.as3.patterns.mediator.Mediator;
-
-	public class WvMediator extends Mediator
-	{
-		public static const NAME:String = "WvMediator";
-		public static const NO_WV_BROWSER_PLUGIN:String = "noWidevineBrowserPlugin";
-		/**
-		 * indicates the next flavor should start playback from this position
-		 */
-		private var _pendingSeekTo:Number = 0;
-		/**
-		 * last playhead position
-		 */
-		private var _lastPlayhead:Number;
-		/**
-		 * indicates next play should call wvNetstrea.replay
-		 */
-		private var _isReplay:Boolean;
-		/**
-		 * indicates if the player is currently playing wv netstream
-		 */
-		private var _isWv:Boolean;
-		/**
-		 * after wv netstream has already reported  netstream complete we need to ignore all doSeek requests
-		 */
-		private var _ignoreSeek:Boolean;
-
-		private var _wvPluginInfo:WVPluginInfo;
-
-		private var _wvPluginCode:widevinePluginCode;
-
-		private var _bufferLength:Number = 0;
-		private var _mediaProxy:MediaProxy;
-
-		private var _endOfStreamTimer:Timer;
-		private var _shouldSetFlavors:Boolean = false;
-
-		public function WvMediator(wvPluginCode:widevinePluginCode, wvPI:WVPluginInfo)
-		{
-			_wvPluginCode = wvPluginCode;
-			_wvPluginInfo = wvPI;
-			_wvPluginInfo.addEventListener(WVPluginInfo.WVMEDIA_ELEMENT_CREATED, onWVElementCreated, false, 0, true);
-			super(NAME);
-		}
-
-		override public function onRegister():void
-		{
-			_mediaProxy = facade.retrieveProxy(MediaProxy.NAME) as MediaProxy;
-			super.onRegister();
-		}
-
-		override public function listNotificationInterests():Array {
-			return [NotificationType.DO_SEEK,
-					NotificationType.MEDIA_ELEMENT_READY,
-					NotificationType.PLAYER_UPDATE_PLAYHEAD,
-					NotificationType.PLAYER_PLAY_END,
-					NotificationType.PLAYER_PLAYED,
-					NotificationType.DO_PLAY,
-					NotificationType.BUFFER_PROGRESS,
-					NotificationType.CHANGE_MEDIA,
-					NotificationType.DO_PAUSE,
-					NotificationType.DO_SWITCH,
-					NotificationType.ENTRY_READY,
-					NO_WV_BROWSER_PLUGIN];
-		}
-
-		override public function handleNotification(note:INotification):void {
-			switch (note.getName())
-			{
-				case NotificationType.DO_SEEK:
-					if (!_ignoreSeek && _isWv)
-					{
-						var seekTo:Number = note.getBody() as Number;
-						if(_wvPluginInfo && _wvPluginInfo.wvMediaElement && _wvPluginInfo.wvMediaElement.netStream)
-						{
-							//workaround to fix seek issue
-							setTimeout(seekWvStream, 1, seekTo);
-						}
-					}
-
-					break;
-
-				case NotificationType.MEDIA_ELEMENT_READY:
-					//get flavor asset ID
-					if (!(facade.retrieveProxy(SequenceProxy.NAME) as SequenceProxy).vo.isInSequence && _mediaProxy.vo.deliveryType==StreamerType.HTTP)
-					{
-						var flavors:Array = _mediaProxy.vo.kalturaMediaFlavorArray;
-						if (flavors && flavors.length)
-						{
-							var wvAssetId:String;
-							if (_mediaProxy.vo.selectedFlavorId && flavors.length > 1)
-							{
-								for (var i:int = 0; i<flavors.length; i++)
-								{
-									var flavor:KalturaFlavorAsset = flavors[i] as KalturaFlavorAsset;
-									if (flavor.id == _mediaProxy.vo.selectedFlavorId)
-									{
-										if (flavor is KalturaWidevineFlavorAsset)
-										{
-											wvAssetId = flavor.id;
-
-										}
-										break;
-									}
-								}
-							}
-								//if we don't have selected flavor ID we are playing the first one
-							else if (flavors[0] is KalturaWidevineFlavorAsset)
-							{
-								wvAssetId = (flavors[0] as KalturaWidevineFlavorAsset).id;
-							}
-
-							if (wvAssetId)
-							{
-								var kc:KalturaClient = (facade.retrieveProxy(ServicesProxy.NAME) as ServicesProxy).kalturaClient;
-								var emmUrl:String = kc.protocol + kc.domain + "/api_v3/index.php?service=widevine_widevinedrm&action=getLicense&format=widevine&flavorAssetId=" + wvAssetId + "&ks=" +kc.ks;
-								ExternalInterface.call("WVSetEmmURL", emmUrl);
-							}
-
-						}
-					}
-
-					break;
-
-				case NotificationType.PLAYER_UPDATE_PLAYHEAD:
-					//in case we switch flavors we want to save last position
-					if (_isWv && !(facade.retrieveProxy(SequenceProxy.NAME) as SequenceProxy).vo.isInSequence)
-						_lastPlayhead = note.getBody() as Number;
-					break;
-
-				case NotificationType.PLAYER_PLAY_END:
-					if (_isWv)
-						_isReplay = true;
-					break;
-
-				case NotificationType.DO_PLAY:
-					if (_endOfStreamTimer && !_endOfStreamTimer.running)
-					{
-						_endOfStreamTimer.start();
-					}
-					else if (_isWv && _isReplay)
-					{
-						_wvPluginInfo.wvMediaElement.netStream.replay();
-						_isReplay = false;
-					}
-					break;
-
-				case NotificationType.PLAYER_PLAYED:
-					if (_isWv && !(facade.retrieveProxy(SequenceProxy.NAME) as SequenceProxy).vo.isInSequence)
-					{
-						var playerMediator:KMediaPlayerMediator = facade.retrieveMediator(KMediaPlayerMediator.NAME) as KMediaPlayerMediator;
-						//workaround for wv bug, netstream reports end before actual end
-						playerMediator.ignorePlaybackComplete = true;
-					}
-					break;
-
-				case NotificationType.BUFFER_PROGRESS:
-					_bufferLength = note.getBody().newTime;
-					break;
-
-				case NotificationType.CHANGE_MEDIA:
-					_isReplay = false;
-					if (_endOfStreamTimer && _endOfStreamTimer.running)
-					{
-						_ignoreSeek = false;
-						_endOfStreamTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, endOfClip);
-						_endOfStreamTimer.stop();
-						_endOfStreamTimer = null;
-						_wvPluginInfo.wvMediaElement.netStream.pause();
-					}
-					if (_mediaProxy.vo.isFlavorSwitching)
-						_pendingSeekTo = _lastPlayhead;
-					break;
-
-				case NotificationType.DO_PAUSE:
-					if (_endOfStreamTimer && _endOfStreamTimer.running)
-					{
-						_endOfStreamTimer.stop();
-					}
-					break;
-
-				case NotificationType.DO_SWITCH:
-					if (_isWv && _mediaProxy.vo.forceDynamicStream)
-					{
-						var preferedFlavorBR:int = int(note.getBody());
-						var index:int;
-
-						if (preferedFlavorBR==-1)
-						{
-							index = 0;
-							_mediaProxy.vo.autoSwitchFlavors = true;
-						}
-						else
-						{
-							//index is zero based, track is not
-							 index = _mediaProxy.getFlavorByBitrate(preferedFlavorBR) + 1;
-							 //if player was asked to turn auto off we will receive same stream index
-							 if (_wvPluginInfo.wvMediaElement.netStream.getCurrentQualityLevel() == index)
-								  index=1;
-							 _mediaProxy.vo.autoSwitchFlavors = false;
-						}
-
-						_wvPluginInfo.wvMediaElement.netStream.selectTrack(index);
-						sendNotification( NotificationType.SWITCHING_CHANGE_STARTED, {currentIndex : String(index)});
-					}
-					break;
-
-				case NotificationType.ENTRY_READY:
-					//if the first flavor is wv- all flavors are wv
-					if (_mediaProxy.vo.kalturaMediaFlavorArray &&
-						_mediaProxy.vo.kalturaMediaFlavorArray.length &&
-						(_mediaProxy.vo.kalturaMediaFlavorArray[0] is KalturaWidevineFlavorAsset))
-					{
-						_isWv = true;
-						//check if the flavor is packaging mbr
-						if ((_mediaProxy.vo.kalturaMediaFlavorArray[0] as KalturaWidevineFlavorAsset).tags.indexOf(_wvPluginCode.mbrTag)!=-1)
-						{
-							_mediaProxy.vo.forceDynamicStream = true;
-							_shouldSetFlavors = true;
-							// disable flavor selector until we receive bitrates from wv netstream
-							setTimeout(function():void {sendNotification(NotificationType.SWITCHING_CHANGE_STARTED, {newIndex: -1});}, 1);
-						}
-						//if not mbr flavor
-						else
-						{
-							_mediaProxy.vo.forceDynamicStream = false;
-							_shouldSetFlavors = false;
-						}
-					}
-					else
-					{
-						_isWv = false;
-						_mediaProxy.vo.forceDynamicStream = false;
-					}
-					break;
-
-				case NO_WV_BROWSER_PLUGIN:
-					sendNotification( NotificationType.ALERT , {message: _wvPluginCode.alert_missing_plugin, title: _wvPluginCode.alert_title} );
-					sendNotification(NotificationType.ENABLE_GUI, {guiEnabled: false, enableType : EnableType.CONTROLS});
-					break;
-
-			}
-		}
-
-		public function seekWvStream(seekTo:Number): void
-		{
-			var maxSeek:Number = (_mediaProxy.vo.entry as KalturaMediaEntry).duration - _bufferLength;
-			//can't seek to complete end
-			_wvPluginInfo.wvMediaElement.netStream.seek( Math.min(seekTo, maxSeek));
-		}
-
-		private function onWVElementCreated(e : Event) : void
-		{
-			if (_mediaProxy.vo.entry && _mediaProxy.vo.entry is KalturaMediaEntry)
-			{
-				_wvPluginInfo.wvMediaElement.w = (_mediaProxy.vo.entry as KalturaMediaEntry).width;
-				_wvPluginInfo.wvMediaElement.h = (_mediaProxy.vo.entry as KalturaMediaEntry).height;
-
-			}
-			_wvPluginInfo.wvMediaElement.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus, false, 0, true);
-			_wvPluginInfo.wvMediaElement.addEventListener(MediaElementEvent.TRAIT_ADD, onTraitAdd, false, 0, true);
-		}
-
-		private function onTraitAdd(e: MediaElementEvent) : void
-		{
-			if (e.traitType == MediaTraitType.SEEK)
-			{
-				//seek to previous flavor last playhead position
-				if (_pendingSeekTo)
-				{
-					seekWvStream(_pendingSeekTo);
-					_pendingSeekTo = 0;
-				}
-			//	_wvPluginInfo.wvMediaElement.removeEventListener(MediaElementEvent.TRAIT_ADD, onTraitAdd);
-			}
-			else if (e.traitType == MediaTraitType.LOAD)
-			{
-				(_wvPluginInfo.wvMediaElement.getTrait(MediaTraitType.LOAD) as WVLoadTrait).drmNetConnection.addEventListener(WvNetConnection.DO_CONNECT_FAILED, onConnectFail, false, 0, true);
-			}
-
-		}
-
-		private function onConnectFail(e: Event) : void
-		{
-			var errEvent:MediaErrorEvent = new MediaErrorEvent(MediaErrorEvent.MEDIA_ERROR);
-			_mediaProxy.vo.media.dispatchEvent(errEvent);
-		}
-
-		/**
-		 * wvMediaElement bubbles up all netstatus event. Display proper KDP alerts accordingly.
-		 * @param e
-		 *
-		 */
-		private function onNetStatus(e: NetStatusEvent):void
-		{
-			trace ("widevinePlugin > onNetStatus:" ,e.info.code, e.info.details);
-			var err:String;
-
-			switch (e.info.code)
-			{
-				case "NetStream.Wv.EmmError":
-					err = _wvPluginCode.alert_emm_error;
-					break;
-				case "NetStream.Wv.EmmExpired":
-					err = _wvPluginCode.alert_emm_expired;
-					break;
-
-				case "NetStream.Wv.LogError":
-					err = _wvPluginCode.alert_log_error;
-					if (e.info.details)
-						err = err.replace("{0}", e.info.details);
-					break;
-
-				case "NetStream.Wv.EmmFailed":
-					err = _wvPluginCode.alert_emm_falied;
-					break;
-
-				case "NetStream.Wv.DcpStop":
-					err = _wvPluginCode.alert_dcp_stop;
-					break;
-
-				case "NetStream.Wv.DcpAlert":
-					sendNotification( NotificationType.ALERT , {message: _wvPluginCode.alert_dcp_alert, title: _wvPluginCode.warning_title} );
-					break;
-
-				// workaround- playComplete is sent before stream ended.
-				case "NetStream.Play.Complete":
-					_ignoreSeek = true;
-					_endOfStreamTimer = new Timer(1000, Math.ceil(_wvPluginInfo.wvMediaElement.netStream.bufferLength));
-					_endOfStreamTimer.addEventListener(TimerEvent.TIMER_COMPLETE, endOfClip, false, 0, true);
-					_endOfStreamTimer.start();
-					break;
-
-				case "NetStream.Wv.SwitchUp":
-				case "NetStream.Wv.SwitchDown":
-					_wvPluginInfo.wvMediaElement.netStream.parseTransitionMsg(e.info.details);
-					//first time we get bitrates info - save it to kalturaflavorarray
-					if (_mediaProxy.vo.forceDynamicStream && _shouldSetFlavors)
-					{
-
-						var bitrates:Array = _wvPluginInfo.wvMediaElement.netStream.getBitrates();
-						if (bitrates)
-						{
-							var flvArray:Array = new Array();
-							for (var i:int = 0; i<bitrates.length; i++)
-							{
-								var fa : KalturaFlavorAsset = new KalturaFlavorAsset();
-								fa.bitrate = bitrates[i] * 8 / 1024;
-								flvArray.push(fa);
-							}
-							_mediaProxy.vo.kalturaMediaFlavorArray = flvArray;
-						}
-						_mediaProxy.vo.autoSwitchFlavors = true;
-						_shouldSetFlavors = false;
-					}
-
-
-					var newIndx:int = _wvPluginInfo.wvMediaElement.netStream.getCurrentQualityLevel() - 1;
-					_mediaProxy.vo.preferedFlavorBR = _mediaProxy.vo.kalturaMediaFlavorArray[newIndx].bitrate;
-					sendNotification( NotificationType.SWITCHING_CHANGE_COMPLETE, {newIndex : newIndx , newBitrate: _mediaProxy.vo.preferedFlavorBR}  );
-					break;
-
-
-				/*	case "NetStream.Buffer.Empty":
-
-				break;
-
-				case "NetStream.Seek.Notify":
-
-				break;
-
-				case "NetStream.Buffer.Full":
-
-				break;
-
-
-
-				case "NetStream.Wv.EmmSuccess":
-
-				break;*/
-			}
-
-			if (err)
-			{
-				sendNotification( NotificationType.ALERT , {message: err, title: _wvPluginCode.alert_title} );
-				sendNotification( NotificationType.DO_PAUSE);
-				sendNotification(NotificationType.ENABLE_GUI, {guiEnabled: false, enableType : EnableType.CONTROLS});
-				(facade.retrieveMediator(BufferAnimationMediator.NAME) as BufferAnimationMediator).spinner.visible = false;
-
-			}
-		}
-
-		/**
-		 * this workaround fixes widevine known issue: stream reports complete before its time.
-		 *
-		 */
-		private function endOfClip(e:TimerEvent = null) : void
-		{
-			sendNotification(NotificationType.PLAYBACK_COMPLETE, {context: SequenceContextType.MAIN});
-			_ignoreSeek = false;
-			_endOfStreamTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, endOfClip);
-			_endOfStreamTimer = null;
-		}
-
-	}
+package
+{
+	import com.kaltura.KalturaClient;
+	import com.kaltura.kdpfl.model.MediaProxy;
+	import com.kaltura.kdpfl.model.SequenceProxy;
+	import com.kaltura.kdpfl.model.ServicesProxy;
+	import com.kaltura.kdpfl.model.type.EnableType;
+	import com.kaltura.kdpfl.model.type.NotificationType;
+	import com.kaltura.kdpfl.model.type.SequenceContextType;
+	import com.kaltura.kdpfl.model.type.StreamerType;
+	import com.kaltura.kdpfl.plugin.WVLoadTrait;
+	import com.kaltura.kdpfl.plugin.WVPluginInfo;
+	import com.kaltura.kdpfl.view.controls.BufferAnimationMediator;
+	import com.kaltura.kdpfl.view.media.KMediaPlayerMediator;
+	import com.kaltura.vo.KalturaFlavorAsset;
+	import com.kaltura.vo.KalturaMediaEntry;
+	import com.kaltura.vo.KalturaWidevineFlavorAsset;
+	import com.widevine.WvNetConnection;
+
+	import flash.events.Event;
+	import flash.events.NetStatusEvent;
+	import flash.events.TimerEvent;
+	import flash.external.ExternalInterface;
+	import flash.utils.Timer;
+	import flash.utils.setTimeout;
+
+	import org.osmf.events.MediaElementEvent;
+	import org.osmf.events.MediaErrorEvent;
+	import org.osmf.traits.MediaTraitType;
+	import org.puremvc.as3.interfaces.INotification;
+	import org.puremvc.as3.patterns.mediator.Mediator;
+
+	public class WvMediator extends Mediator
+	{
+		public static const NAME:String = "WvMediator";
+		public static const NO_WV_BROWSER_PLUGIN:String = "noWidevineBrowserPlugin";
+		/**
+		 * indicates the next flavor should start playback from this position
+		 */
+		private var _pendingSeekTo:Number = 0;
+		/**
+		 * last playhead position
+		 */
+		private var _lastPlayhead:Number;
+		/**
+		 * indicates next play should call wvNetstrea.replay
+		 */
+		private var _isReplay:Boolean;
+		/**
+		 * indicates if the player is currently playing wv netstream
+		 */
+		private var _isWv:Boolean;
+		/**
+		 * after wv netstream has already reported  netstream complete we need to ignore all doSeek requests
+		 */
+		private var _ignoreSeek:Boolean;
+
+		private var _wvPluginInfo:WVPluginInfo;
+
+		private var _wvPluginCode:widevinePluginCode;
+
+		private var _bufferLength:Number = 0;
+		private var _mediaProxy:MediaProxy;
+
+		private var _endOfStreamTimer:Timer;
+		private var _shouldSetFlavors:Boolean = false;
+
+		public function WvMediator(wvPluginCode:widevinePluginCode, wvPI:WVPluginInfo)
+		{
+			_wvPluginCode = wvPluginCode;
+			_wvPluginInfo = wvPI;
+			_wvPluginInfo.addEventListener(WVPluginInfo.WVMEDIA_ELEMENT_CREATED, onWVElementCreated, false, 0, true);
+			super(NAME);
+		}
+
+		override public function onRegister():void
+		{
+			_mediaProxy = facade.retrieveProxy(MediaProxy.NAME) as MediaProxy;
+			super.onRegister();
+		}
+
+		override public function listNotificationInterests():Array {
+			return [NotificationType.DO_SEEK,
+					NotificationType.MEDIA_ELEMENT_READY,
+					NotificationType.PLAYER_UPDATE_PLAYHEAD,
+					NotificationType.PLAYER_PLAY_END,
+					NotificationType.PLAYER_PLAYED,
+					NotificationType.DO_PLAY,
+					NotificationType.BUFFER_PROGRESS,
+					NotificationType.CHANGE_MEDIA,
+					NotificationType.DO_PAUSE,
+					NotificationType.DO_SWITCH,
+					NotificationType.ENTRY_READY,
+					NO_WV_BROWSER_PLUGIN];
+		}
+
+		override public function handleNotification(note:INotification):void {
+			switch (note.getName())
+			{
+				case NotificationType.DO_SEEK:
+					if (!_ignoreSeek && _isWv)
+					{
+						var seekTo:Number = note.getBody() as Number;
+						if(_wvPluginInfo && _wvPluginInfo.wvMediaElement && _wvPluginInfo.wvMediaElement.netStream)
+						{
+							//workaround to fix seek issue
+							setTimeout(seekWvStream, 1, seekTo);
+						}
+					}
+
+					break;
+
+				case NotificationType.MEDIA_ELEMENT_READY:
+					//get flavor asset ID
+					if (!(facade.retrieveProxy(SequenceProxy.NAME) as SequenceProxy).vo.isInSequence && _mediaProxy.vo.deliveryType==StreamerType.HTTP)
+					{
+						var flavors:Array = _mediaProxy.vo.kalturaMediaFlavorArray;
+						if (flavors && flavors.length)
+						{
+							var wvAssetId:String;
+							if (_mediaProxy.vo.selectedFlavorId && flavors.length > 1)
+							{
+								for (var i:int = 0; i<flavors.length; i++)
+								{
+									var flavor:KalturaFlavorAsset = flavors[i] as KalturaFlavorAsset;
+									if (flavor.id == _mediaProxy.vo.selectedFlavorId)
+									{
+										if (flavor is KalturaWidevineFlavorAsset)
+										{
+											wvAssetId = flavor.id;
+
+										}
+										break;
+									}
+								}
+							}
+								//if we don't have selected flavor ID we are playing the first one
+							else if (flavors[0] is KalturaWidevineFlavorAsset)
+							{
+								wvAssetId = (flavors[0] as KalturaWidevineFlavorAsset).id;
+							}
+
+							if (wvAssetId)
+							{
+								var kc:KalturaClient = (facade.retrieveProxy(ServicesProxy.NAME) as ServicesProxy).kalturaClient;
+								var emmUrl:String = kc.protocol + kc.domain + "/api_v3/index.php?service=widevine_widevinedrm&action=getLicense&format=widevine&flavorAssetId=" + wvAssetId + "&ks=" +kc.ks;
+								ExternalInterface.call("WVSetEmmURL", emmUrl);
+							}
+
+						}
+					}
+
+					break;
+
+				case NotificationType.PLAYER_UPDATE_PLAYHEAD:
+					//in case we switch flavors we want to save last position
+					if (_isWv && !(facade.retrieveProxy(SequenceProxy.NAME) as SequenceProxy).vo.isInSequence)
+						_lastPlayhead = note.getBody() as Number;
+					break;
+
+				case NotificationType.PLAYER_PLAY_END:
+					if (_isWv)
+						_isReplay = true;
+					break;
+
+				case NotificationType.DO_PLAY:
+					if (_endOfStreamTimer && !_endOfStreamTimer.running)
+					{
+						_endOfStreamTimer.start();
+					}
+					else if (_isWv && _isReplay)
+					{
+						_wvPluginInfo.wvMediaElement.netStream.replay();
+						_isReplay = false;
+					}
+					break;
+
+				case NotificationType.PLAYER_PLAYED:
+					if (_isWv && !(facade.retrieveProxy(SequenceProxy.NAME) as SequenceProxy).vo.isInSequence)
+					{
+						var playerMediator:KMediaPlayerMediator = facade.retrieveMediator(KMediaPlayerMediator.NAME) as KMediaPlayerMediator;
+						//workaround for wv bug, netstream reports end before actual end
+						playerMediator.ignorePlaybackComplete = true;
+					}
+					break;
+
+				case NotificationType.BUFFER_PROGRESS:
+					_bufferLength = note.getBody().newTime;
+					break;
+
+				case NotificationType.CHANGE_MEDIA:
+					_isReplay = false;
+					if (_endOfStreamTimer && _endOfStreamTimer.running)
+					{
+						_ignoreSeek = false;
+						_endOfStreamTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, endOfClip);
+						_endOfStreamTimer.stop();
+						_endOfStreamTimer = null;
+						_wvPluginInfo.wvMediaElement.netStream.pause();
+					}
+					if (_mediaProxy.vo.isFlavorSwitching)
+						_pendingSeekTo = _lastPlayhead;
+					break;
+
+				case NotificationType.DO_PAUSE:
+					if (_endOfStreamTimer && _endOfStreamTimer.running)
+					{
+						_endOfStreamTimer.stop();
+					}
+					break;
+
+				case NotificationType.DO_SWITCH:
+					if (_isWv && _mediaProxy.vo.forceDynamicStream)
+					{
+						var preferedFlavorBR:int = int(note.getBody());
+						var index:int;
+
+						if (preferedFlavorBR==-1)
+						{
+							index = 0;
+							_mediaProxy.vo.autoSwitchFlavors = true;
+						}
+						else
+						{
+							//index is zero based, track is not
+							 index = _mediaProxy.getFlavorByBitrate(preferedFlavorBR) + 1;
+							 //if player was asked to turn auto off we will receive same stream index
+							 if (_wvPluginInfo.wvMediaElement.netStream.getCurrentQualityLevel() == index)
+								  index=1;
+							 _mediaProxy.vo.autoSwitchFlavors = false;
+						}
+
+						_wvPluginInfo.wvMediaElement.netStream.selectTrack(index);
+						if (_mediaProxy.vo.kalturaMediaFlavorArray && _mediaProxy.vo.kalturaMediaFlavorArray.length > 1)
+							sendNotification( NotificationType.SWITCHING_CHANGE_STARTED, {currentIndex : String(index)});
+					}
+					break;
+
+				case NotificationType.ENTRY_READY:
+					//if the first flavor is wv- all flavors are wv
+					if (_mediaProxy.vo.kalturaMediaFlavorArray &&
+						_mediaProxy.vo.kalturaMediaFlavorArray.length &&
+						(_mediaProxy.vo.kalturaMediaFlavorArray[0] is KalturaWidevineFlavorAsset))
+					{
+						_isWv = true;
+						//check if the flavor is packaging mbr
+						if ((_mediaProxy.vo.kalturaMediaFlavorArray[0] as KalturaWidevineFlavorAsset).tags.indexOf(_wvPluginCode.mbrTag)!=-1)
+						{
+							_mediaProxy.vo.forceDynamicStream = true;
+							_shouldSetFlavors = true;
+							// disable flavor selector until we receive bitrates from wv netstream
+							setTimeout(function():void {sendNotification(NotificationType.SWITCHING_CHANGE_STARTED, {newIndex: -1});}, 1);
+						}
+						//if not mbr flavor
+						else
+						{
+							_mediaProxy.vo.forceDynamicStream = false;
+							_shouldSetFlavors = false;
+						}
+					}
+					else
+					{
+						_isWv = false;
+						_mediaProxy.vo.forceDynamicStream = false;
+					}
+					break;
+
+				case NO_WV_BROWSER_PLUGIN:
+					sendNotification( NotificationType.ALERT , {message: _wvPluginCode.alert_missing_plugin, title: _wvPluginCode.alert_title} );
+					sendNotification(NotificationType.ENABLE_GUI, {guiEnabled: false, enableType : EnableType.CONTROLS});
+					break;
+
+			}
+		}
+
+		public function seekWvStream(seekTo:Number): void
+		{
+			var maxSeek:Number = (_mediaProxy.vo.entry as KalturaMediaEntry).duration - _bufferLength;
+			//can't seek to complete end
+			_wvPluginInfo.wvMediaElement.netStream.seek( Math.min(seekTo, maxSeek));
+		}
+
+		private function onWVElementCreated(e : Event) : void
+		{
+			if (_mediaProxy.vo.entry && _mediaProxy.vo.entry is KalturaMediaEntry)
+			{
+				_wvPluginInfo.wvMediaElement.w = (_mediaProxy.vo.entry as KalturaMediaEntry).width;
+				_wvPluginInfo.wvMediaElement.h = (_mediaProxy.vo.entry as KalturaMediaEntry).height;
+
+			}
+			_wvPluginInfo.wvMediaElement.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus, false, 0, true);
+			_wvPluginInfo.wvMediaElement.addEventListener(MediaElementEvent.TRAIT_ADD, onTraitAdd, false, 0, true);
+		}
+
+		private function onTraitAdd(e: MediaElementEvent) : void
+		{
+			if (e.traitType == MediaTraitType.SEEK)
+			{
+				//seek to previous flavor last playhead position
+				if (_pendingSeekTo)
+				{
+					seekWvStream(_pendingSeekTo);
+					_pendingSeekTo = 0;
+				}
+			//	_wvPluginInfo.wvMediaElement.removeEventListener(MediaElementEvent.TRAIT_ADD, onTraitAdd);
+			}
+			else if (e.traitType == MediaTraitType.LOAD)
+			{
+				(_wvPluginInfo.wvMediaElement.getTrait(MediaTraitType.LOAD) as WVLoadTrait).drmNetConnection.addEventListener(WvNetConnection.DO_CONNECT_FAILED, onConnectFail, false, 0, true);
+			}
+
+		}
+
+		private function onConnectFail(e: Event) : void
+		{
+			var errEvent:MediaErrorEvent = new MediaErrorEvent(MediaErrorEvent.MEDIA_ERROR);
+			_mediaProxy.vo.media.dispatchEvent(errEvent);
+		}
+
+		/**
+		 * wvMediaElement bubbles up all netstatus event. Display proper KDP alerts accordingly.
+		 * @param e
+		 *
+		 */
+		private function onNetStatus(e: NetStatusEvent):void
+		{
+			trace ("widevinePlugin > onNetStatus:" ,e.info.code, e.info.details);
+			var err:String;
+
+			switch (e.info.code)
+			{
+				case "NetStream.Wv.EmmError":
+					err = _wvPluginCode.alert_emm_error;
+					break;
+				case "NetStream.Wv.EmmExpired":
+					err = _wvPluginCode.alert_emm_expired;
+					break;
+
+				case "NetStream.Wv.LogError":
+					err = _wvPluginCode.alert_log_error;
+					if (e.info.details)
+						err = err.replace("{0}", e.info.details);
+					break;
+
+				case "NetStream.Wv.EmmFailed":
+					err = _wvPluginCode.alert_emm_falied;
+					break;
+
+				case "NetStream.Wv.DcpStop":
+					err = _wvPluginCode.alert_dcp_stop;
+					break;
+
+				case "NetStream.Wv.DcpAlert":
+					sendNotification( NotificationType.ALERT , {message: _wvPluginCode.alert_dcp_alert, title: _wvPluginCode.warning_title} );
+					break;
+
+				// workaround- playComplete is sent before stream ended.
+				case "NetStream.Play.Complete":
+					_ignoreSeek = true;
+					_endOfStreamTimer = new Timer(1000, Math.ceil(_wvPluginInfo.wvMediaElement.netStream.bufferLength));
+					_endOfStreamTimer.addEventListener(TimerEvent.TIMER_COMPLETE, endOfClip, false, 0, true);
+					_endOfStreamTimer.start();
+					break;
+
+				case "NetStream.Wv.SwitchUp":
+				case "NetStream.Wv.SwitchDown":
+					_wvPluginInfo.wvMediaElement.netStream.parseTransitionMsg(e.info.details);
+					//first time we get bitrates info - save it to kalturaflavorarray
+					if (_mediaProxy.vo.forceDynamicStream && _shouldSetFlavors)
+					{
+
+						var bitrates:Array = _wvPluginInfo.wvMediaElement.netStream.getBitrates();
+						if (bitrates)
+						{
+							var flvArray:Array = new Array();
+							for (var i:int = 0; i<bitrates.length; i++)
+							{
+								var fa : KalturaFlavorAsset = new KalturaFlavorAsset();
+								fa.bitrate = bitrates[i] * 8 / 1024;
+								flvArray.push(fa);
+							}
+							_mediaProxy.vo.kalturaMediaFlavorArray = flvArray;
+						}
+						_mediaProxy.vo.autoSwitchFlavors = true;
+						_shouldSetFlavors = false;
+					}
+
+
+					var newIndx:int = _wvPluginInfo.wvMediaElement.netStream.getCurrentQualityLevel() - 1;
+					_mediaProxy.vo.preferedFlavorBR = _mediaProxy.vo.kalturaMediaFlavorArray[newIndx].bitrate;
+					sendNotification( NotificationType.SWITCHING_CHANGE_COMPLETE, {newIndex : newIndx , newBitrate: _mediaProxy.vo.preferedFlavorBR}  );
+					break;
+
+
+				/*	case "NetStream.Buffer.Empty":
+
+				break;
+
+				case "NetStream.Seek.Notify":
+
+				break;
+
+				case "NetStream.Buffer.Full":
+
+				break;
+
+
+
+				case "NetStream.Wv.EmmSuccess":
+
+				break;*/
+			}
+
+			if (err)
+			{
+				sendNotification( NotificationType.ALERT , {message: err, title: _wvPluginCode.alert_title} );
+				sendNotification( NotificationType.DO_PAUSE);
+				sendNotification(NotificationType.ENABLE_GUI, {guiEnabled: false, enableType : EnableType.CONTROLS});
+				(facade.retrieveMediator(BufferAnimationMediator.NAME) as BufferAnimationMediator).spinner.visible = false;
+
+			}
+		}
+
+		/**
+		 * this workaround fixes widevine known issue: stream reports complete before its time.
+		 *
+		 */
+		private function endOfClip(e:TimerEvent = null) : void
+		{
+			sendNotification(NotificationType.PLAYBACK_COMPLETE, {context: SequenceContextType.MAIN});
+			_ignoreSeek = false;
+			_endOfStreamTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, endOfClip);
+			_endOfStreamTimer = null;
+		}
+
+	}
 }


Check whether s_c and s_r exist before checking for connectedness.

--- swfcat.as
+++ swfcat.as
@@ -429,19 +429,19 @@
         s_r.addEventListener(Event.CONNECT, relay_connected);
         s_r.addEventListener(Event.CLOSE, function (e:Event):void {
             log("Relay: closed.");
-            if (s_c.connected)
+            if (s_c && s_c.connected)
                 s_c.close();
             dispatchEvent(new Event(Event.COMPLETE));
         });
         s_r.addEventListener(IOErrorEvent.IO_ERROR, function (e:IOErrorEvent):void {
             log("Relay: I/O error: " + e.text + ".");
-            if (s_c.connected)
+            if (s_c && s_c.connected)
                 s_c.close();
             dispatchEvent(new Event(Event.COMPLETE));
         });
         s_r.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function (e:SecurityErrorEvent):void {
             log("Relay: security error: " + e.text + ".");
-            if (s_c.connected)
+            if (s_c && s_c.connected)
                 s_c.close();
             dispatchEvent(new Event(Event.COMPLETE));
         });
@@ -460,19 +460,19 @@
         s_c.addEventListener(Event.CONNECT, client_connected);
         s_c.addEventListener(Event.CLOSE, function (e:Event):void {
             log("Client: closed.");
-            if (s_r.connected)
+            if (s_r && s_r.connected)
                 s_r.close();
             dispatchEvent(new Event(Event.COMPLETE));
         });
         s_c.addEventListener(IOErrorEvent.IO_ERROR, function (e:IOErrorEvent):void {
             log("Client: I/O error: " + e.text + ".");
-            if (s_r.connected)
+            if (s_r && s_r.connected)
                 s_r.close();
             dispatchEvent(new Event(Event.COMPLETE));
         });
         s_c.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function (e:SecurityErrorEvent):void {
             log("Client: security error: " + e.text + ".");
-            if (s_r.connected)
+            if (s_r && s_r.connected)
                 s_r.close();
             dispatchEvent(new Event(Event.COMPLETE));
         });


RTSPClient: Do not log potential binary data

--- src/com/axis/rtspclient/RTSPClient.as
+++ src/com/axis/rtspclient/RTSPClient.as
@@ -246,7 +246,6 @@
         return false;
       }

-      Logger.log('RTSP IN:', data.toString());
       if (parsed.headers['content-length']) {
         if (data.bytesAvailable < parsed.headers['content-length']) {
           return false;
@@ -254,6 +253,9 @@

         /* RTSP commands contain no heavy body, so it's safe to read everything */
         data.readBytes(oBody, 0, parsed.headers['content-length']);
+        Logger.log('RTSP IN:', oBody.toString());
+      } else {
+        Logger.log('RTSP IN:', data.toString());
       }

       requestReset();


Implemented pause/resume and swap in SignalSlot

--- src/org/osflash/signals/SignalSlot.as
+++ src/org/osflash/signals/SignalSlot.as
@@ -4,40 +4,43 @@
      * The SignalSlot class represents a signal slot.
      *
      * @author Robert Penner
+	 * @author Joa Ebert
+	 * @private
      */
 	internal final class SignalSlot implements ISignalSlot
 	{
-		//
-		// Note: We define all properties as internal here so we
-		// can access them without the overhead of an implicit getter.
-		//
+		/**
+		 * Private backing variable for the signal property.
+		 * @private
+		 */
+		private var _signal:ISignal;

 		/**
-		 * The pseudo-private next SignalSlot in the pool of SignalSlot objects.
+		 * Private backing variable for the paused property.
 		 * @private
 		 */
-		internal var _nextInPool: SignalSlot;
+		private var _paused:Boolean;

 		/**
-		 * The pseudo-private signal variable.
-		 * @private
-		 */
-		internal var _signal:ISignal;
-
-		/**
-		 * The listener associated with this slot.
+		 * Private backing variable for the listener property.
+		 *
+		 * Visible in the signals package for fast access.
 		 * @private
 		 */
 		internal var _listener:Function;

 		/**
-		 * Whether or not this listener is only executed
+		 * Private backing variable for the isOnce property.
+		 *
+		 * Visible in the signals package for fast access.
 		 * @private
 		 */
 		internal var _isOnce:Boolean;

 		/**
-		 * The priority of this slot.
+		 * Private backing variable for the priority property.
+		 *
+		 * Visible in the signals package for fast access.
 		 * @private
 		 */
 		internal var _priority:int;
@@ -49,9 +52,13 @@
 		 * @param once Whether or not the listener should be executed only once.
 		 * @param signal The signal associated with the slot.
 		 * @param priority The priority of the slot.
+		 *
+		 * @throws ArgumentError An error is thrown if the given listener closure is null.
 		 */
 		public function SignalSlot(listener:Function, once:Boolean = false, signal:ISignal = null, priority:int = 0)
 		{
+			if (null == listener) throw new ArgumentError('Given listener is null.');
+
 			_listener = listener;
 			_isOnce = once;
 			_signal = signal;
@@ -63,8 +70,11 @@
 		 */
 		public function execute(valueObjects:Array):void
 		{
-			if (_isOnce) _signal.remove(_listener);
-			_listener.apply(null, valueObjects);
+			if (!_paused)
+			{
+				if (_isOnce) _signal.remove(_listener);
+				_listener.apply(null, valueObjects);
+			}
 		}

 		/**
@@ -72,8 +82,11 @@
 		 */
 		public function execute0():void
 		{
-			if (_isOnce) _signal.remove(_listener);
-			_listener();
+			if (!_paused)
+			{
+				if (_isOnce) _signal.remove(_listener);
+				_listener();
+			}
 		}

 		/**
@@ -81,8 +94,11 @@
 		 */
 		public function execute1(value1:Object):void
 		{
-			if (_isOnce) _signal.remove(_listener);
-			_listener(value1);
+			if (!_paused)
+			{
+				if (_isOnce) _signal.remove(_listener);
+				_listener(value1);
+			}
 		}

 		/**
@@ -90,8 +106,11 @@
 		 */
 		public function execute2(value1:Object, value2:Object):void
 		{
-			if (_isOnce) _signal.remove(_listener);
-			_listener(value1, value2);
+			if (!_paused)
+			{
+				if (_isOnce) _signal.remove(_listener);
+				_listener(value1, value2);
+			}
 		}

 		/**
@@ -128,16 +147,44 @@
 			return "[SignalSlot listener: "+_listener+", once: "+_isOnce+", priority: "+_priority+"]";
 		}

+		/**
+		 * @inheritDoc
+		 */
+		public function get paused():Boolean
+		{
+			return _paused;
+		}
+
+		public function set paused(value:Boolean):void
+		{
+			_paused = value;
+		}
+
+		/**
+		 * @inheritDoc
+		 */
 		public function pause():void
 		{
+			_paused = true;
 		}

+		/**
+		 * @inheritDoc
+		 */
 		public function resume():void
 		{
+			_paused = false;
 		}

+		/**
+		 * @inheritDoc
+		 */
 		public function swap(newListener:Function):void
 		{
+			if (null == newListener) throw new ArgumentError(
+					'Given listener is null.\nDid you want to call pause() instead?');
+
+			_listener = newListener;
 		}
 	}
 }


simplifying code

simplifying code

--- WeaveJS/src/weavejs/data/ColumnUtils.as
+++ WeaveJS/src/weavejs/data/ColumnUtils.as
@@ -482,11 +482,9 @@

 		private static function getColumnsFromFormat(format:Object, output:Array):Array
 		{
-			if (JS.isPrimitive(format))
-				return output;
 			if (format is IAttributeColumn)
 				output.push(format);
-			else
+			else if (!JS.isPrimitive(format))
 				for (var prop:String in Object(format))
 					getColumnsFromFormat(format[prop], output);
 			return output;


223 Fixing FormatError, which was broken the first time round, then made worse

--- raw/src/org/yellcorp/format/printf/FormatError.as
+++ raw/src/org/yellcorp/format/printf/FormatError.as
@@ -2,15 +2,19 @@
 {
 public class FormatError extends Error
 {
+    private var _formatString:String;
     private var _charIndex:int;
-    private var _specimen:String;

-    public function FormatError(message:String, specimen:String, charIndex:int = -1)
+    public function FormatError(message:String, formatString:String, charIndex:int = -1)
     {
+        _formatString = formatString;
+        _charIndex = charIndex;
         super(message);
-        _charIndex = charIndex;
-        _specimen = specimen;
-        name = "FormatError";
+    }
+
+    public function get formatString():String
+    {
+        return _formatString;
     }

     public function get charIndex():int
@@ -20,7 +24,7 @@

     public function get specimen():String
     {
-        return _charIndex >= 0 ? _specimen.charAt(_charIndex) : "";
+        return _charIndex >= 0 ? _formatString.charAt(_charIndex) : "";
     }
 }
 }


Transferred from the Adobe Open Source Subversion Repository

Revision: 8481
Author:   smgilson@adobe.com
Date:     2009-07-09T17:28:31.741329Z

Log Message:
-----------
First of several checkins to update the namespace in ASDoc MXML syntax descriptions for Spark components

QE Notes: None
Doc Notes: None
Bugs: -
Checkintests: passed

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/DropDownList.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Group.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/PopUpAnchor.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/DataRenderer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/TextInput.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/HGroup.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/NumericStepper.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Button.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/Slider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/ToggleButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/TextArea.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Spinner.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/VGroup.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/VideoPlayer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/CheckBox.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/TrackBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/HSlider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/HScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Panel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/ButtonBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Application.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/SkinnableDataContainer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/VSlider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/SkinnableContainer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/VScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/List.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ItemRenderer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Scroller.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/Range.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/DataGroup.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1282374 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as
+++ frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as
@@ -77,7 +77,7 @@
  *  attributes of its superclass and adds the following tag attributes:

  *
  *

- *  <ListBase
+ *  <s:ListBase
  *
  *    Properties
  *    arrowKeysWrapFocus="false"


Transferred from the Adobe Open Source Subversion Repository

Revision: 6125
Author:   dloverin@adobe.com
Date:     2009-04-10T15:07:49.535097Z

Log Message:
-----------
Complete Spark WindowedApplication and Spark Window.

* When you turn System Chrome off you do not get Flex Chrome automatically anymore. You need to set the skinClass style to use FlexChromeSkin. This means if System Chrome is not present the WindowedApplication will not have chrome.

* FlexChromeSkin brightens/dims its chrome depending on its active/inactive state.

* The TitleBarSkin was split into two skins, TitleBarSkin and MacTitleBarSkin. TitleBarSkin has just the Windows look. MacTitleBarSkin has the mac look. TitleBar will automatically switch between the skins depending on the OS.

* Implemented titleIcon in TitleBar.

* titleText in the TitleBarSkin and the MacTitleBarSkin is truncated when the text doesn't fit in the Window.

* statusText in FlexChromeSkin is truncated if the text does not fit with the status bar.

QE Notes: Ready for testing.
Doc Notes: None
Bugs:
Reviewer: Ryan, Glenn
tests: checkintests

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/core/Window.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/airframework/src/spark/skins/default/FlexChromeSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/spark/skins/default/MacMinimizeButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/spark/skins/default/MacMaximizeButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/spark/skins/default/CloseButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/spark/skins/default/WindowedApplicationSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/spark/skins/default/TitleBarSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/spark/components/windowClasses/TitleBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/managers/WindowedSystemManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/spark/skins/default/GripperSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/spark-air-manifest.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/defaults.css</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/spark/skins/default/MinimizeButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/events/WindowExistenceEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/spark/components/WindowedApplication.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/spark/skins/default/MaximizeButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/spark/skins/default/RestoreButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/spark/skins/default/MacCloseButtonSkin.mxml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/airframework/src/spark/components/Window.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/airframework/src/spark/skins/default/MacTitleBarSkin.mxml</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1250620 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/airspark/src/spark/components/windowClasses/TitleBar.as
+++ frameworks/projects/airspark/src/spark/components/windowClasses/TitleBar.as
@@ -16,18 +16,17 @@
 import flash.display.NativeWindowDisplayState;
 import flash.events.Event;
 import flash.events.MouseEvent;
-import flash.events.NativeWindowDisplayStateEvent;
-import flash.geom.Rectangle;
 import flash.system.Capabilities;
-import flash.text.TextFormat;
-import flash.text.TextFormatAlign;

 import mx.core.IWindow;
-import mx.styles.StyleManager;

 import spark.components.Button;
 import spark.components.supportClasses.SkinnableComponent;
+import spark.primitives.BitmapImage;
 import spark.primitives.SimpleText;
+import spark.skins.*;
+import spark.skins.default.MacTitleBarSkin;
+import spark.skins.default.TitleBarSkin;

 /**
  *  The default title bar for a WindowedApplication or a Window.
@@ -98,6 +97,7 @@
     //  Skin Parts
     //
     //--------------------------------------------------------------------------
+
     //----------------------------------
     //  closeButton
     //----------------------------------
@@ -141,6 +141,20 @@
     public var minimizeButton:Button;

     //----------------------------------
+    //  titleIconImage
+    //----------------------------------
+
+    /**
+     *  The title icon in the TitleBar.
+     *
+     *  @langversion 3.0
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    [SkinPart (required="false")]
+    public var titleIconImage:BitmapImage;
+
+    //----------------------------------
     //  titleTextField
     //----------------------------------

@@ -153,7 +167,6 @@
      */
     [SkinPart (required="false")]
     public var titleText:SimpleText;
-

     //--------------------------------------------------------------------------
     //
@@ -272,9 +285,32 @@

     //--------------------------------------------------------------------------
     //
-    //  Overridden methods
-    //
-    //--------------------------------------------------------------------------
+    //  Overridden methods: SkinnableComponent
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *
+     *  When we are running on the mac, switch to the mac skin and continue the load.
+     *
+     */
+    override protected function loadSkin():void
+    {
+       if (isMac() && getStyle("skinClass") == TitleBarSkin)
+       {
+            setStyle("skinClass", MacTitleBarSkin);
+       }
+
+       super.loadSkin();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden methods: SkinnableContainer
+    //
+    //--------------------------------------------------------------------------
+

     /**
      *  @private
@@ -354,20 +390,22 @@
             titleChanged = false;
         }

-//        if (titleIconChanged)
-//        {
-//            if (titleIconObject)
-//            {
-//                removeChild(DisplayObject(titleIconObject));
-//                titleIconObject = null;
-//            }
-//            if (_titleIcon)
-//            {
-//                titleIconObject = new _titleIcon();
-//                addChild(DisplayObject(titleIconObject));
-//            }
-//            titleIconChanged = false;
-//        }
+        if (titleIconChanged)
+        {
+            if (mx_internal::titleIconObject)
+            {
+                titleIconImage.source = null;
+                mx_internal::titleIconObject = null;
+            }
+
+            if (_titleIcon && titleIconImage)
+            {
+                mx_internal::titleIconObject = new _titleIcon();
+                titleIconImage.source = mx_internal::titleIconObject;
+            }
+            titleIconChanged = false;
+        }
+
     }

@@ -400,12 +438,10 @@
      */
     override protected function getCurrentSkinState():String
     {
-        if (isMac())
-            return "mac";
-        else if (window.nativeWindow.displayState == NativeWindowDisplayState.MAXIMIZED)
-            return "maximized";
+        if (window.nativeWindow.displayState == NativeWindowDisplayState.MAXIMIZED)
+            return enabled ? "maximized" : "disabledMaximized";

-        return "normal";
+        return enabled ? "normal" : "disabled";
     }

     //--------------------------------------------------------------------------


Transferred from the Adobe Open Source Subversion Repository

Revision: 23247
Author:   cframpto@adobe.com
Date:     2011-12-20T19:21:13.134833Z

Log Message:
-----------
Remove ADOBE SYSTEMS license and replace with Apache license in headers - frameworks.  A 2nd pass will be needed to get the files not handled up by the scripts.

Modified Paths:
--------------
4959 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1281797 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/components/gridClasses/GridSortField.as
+++ frameworks/projects/spark/src/spark/components/gridClasses/GridSortField.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2010 Adobe Systems Incorporated
-//  All Rights Reserved.
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
 //
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////


Fix error missing first particle when traversing the particles backwards

--- src/org/flintparticles/common/emitters/Emitter.as
+++ src/org/flintparticles/common/emitters/Emitter.as
@@ -934,7 +934,7 @@
 					for( j = 0; j < len; ++j )
 					{
 						action = _actions[j];
-						for ( i = len2; --i; )
+						for ( i = len2 - 1; i >= 0; --i )
 						{
 							particle = _particles[i];
 							action.update( this, particle, time );


Servlet no longer removes URL variables from servletURL constructor param.

--- WeaveData/src/weave/services/Servlet.as
+++ WeaveData/src/weave/services/Servlet.as
@@ -56,8 +56,7 @@
 			if (urlRequestDataFormat != REQUEST_FORMAT_BINARY && urlRequestDataFormat != REQUEST_FORMAT_VARIABLES)
 				throw new Error(getQualifiedClassName(Servlet) + ': urlRequestDataFormat not supported: "' + urlRequestDataFormat + '"');

-			var urlParts:Array = servletURL.split('?');
-			_servletURL = urlParts[0];
+			_servletURL = servletURL;
 			_urlRequestDataFormat = urlRequestDataFormat;
 			METHOD = methodVariableName;
 		}


Updated callback arguments

Updated callback arguments

--- MP3-Flashback.as
+++ MP3-Flashback.as
@@ -44,7 +44,7 @@
  */
 function loadProgress(e:Event) {
 	if (soundFile && soundFile.length > 0) {
-		var percent:Number = Math.floor( (soundFile.bytesLoaded * 100) / soundFile.bytesTotal);
+		var percent:Number = Math.floor(((soundFile.bytesLoaded * 100) / soundFile.bytesTotal) * 100));
 		ExternalInterface.call('$.fn.loadProgress', percent);
 		isLoaded = false;
 	}
@@ -67,7 +67,7 @@
 		var seconds:uint    = Math.floor(soundChannel.position / 1000) % 60;
 		var duration:String = minutes + ':' + seconds;
 		var loaded:Number   = soundFile.bytesLoaded  / soundFile.bytesTotal;
-		var percent:Number  = (soundChannel.position / soundFile.length * loaded);
+		var percent:Number  = Math.floor(((soundChannel.position / soundFile.length * loaded) * 100));
 		ExternalInterface.call('$.fn.playProgress', duration, percent);
 		isPlaying = true;
 	}


- change: Label now does whitespace condensing manually instead of letting the TextField do it. This has become necessary because otherwise, the offsets for :hover are wrong.

git-svn-id: e38e7cdd6ace00d8230583a2d3b43e9a55f5c011@728 bc4816be-ef27-423a-9c4d-fc420be121a2


Yeah, really fix the stupid b0rked Array from trusted JS.

--- flash/org/windmill/astest/ASTest.as
+++ flash/org/windmill/astest/ASTest.as
@@ -51,9 +51,32 @@
       // the loader will call back to this again when
       // it's done, with no args
       if (files) {
-        if (!files is Array) {
-          files = Array.prototype.slice.call(files);
-        }
+        // **** Ugly hack ****
+        // -------------
+        if (!(files is Array)) {
+          // The files param passed in from XPCOM trusted JS
+          // loses its Array-ness -- fails the 'is Array' test,
+          // and has no 'length' property. It's just a generic
+          // Object with integers for keys
+          // In that case, reconstitute the Array by manually
+          // stepping through it until we run out of items
+          var filesTemp:Array = [];
+          var incr:int = 0;
+          var item:*;
+          var keepGoing:Boolean = true;
+          while (keepGoing) {
+            item = files[incr];
+            if (item) {
+              filesTemp.push(item);
+            }
+            else {
+              keepGoing = false;
+            }
+            incr++;
+          }
+          files = filesTemp;
+        }
+        // -------------
         ASTest.loadTestFiles(files);
         return;
       }


Added support for Array() function. Started to add code for if/else/for/while/return.

--- WeaveCore/src/weave/compiler/Compiler.as
+++ WeaveCore/src/weave/compiler/Compiler.as
@@ -53,6 +53,16 @@
 		 */
 		public var debug:Boolean = false;

+		private static const BRANCH_IF:String = 'if';
+		private static const BRANCH_ELSE:String = 'else';
+		private static const BRANCH_FOR:String = 'for';
+		private static const BRANCH_WHILE:String = 'while';
+		private static const BRANCH_RETURN:String = 'return';
+		private static const METHOD_INDEX:int = -1;
+		private static const CONDITION_INDEX:int = 0;
+		private static const TRUE_INDEX:int = 1;
+		private static const FALSE_INDEX:int = 2;
+
 		/**
 		 * This is the prefix used for the function notation of infix operators.
 		 * For example, the function notation for ( x + y ) is ( \+(x,y) ).
@@ -68,21 +78,21 @@
 		 */
 		private static const numberRegex:RegExp = /^(0x[0-9A-Fa-f]+|[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/;

-		/**
+		/**
 		 * This function compiles an expression into a Function that evaluates using variables from a symbolTable.
 		 * Strings may be surrounded by quotation marks (") and literal quotation marks are escaped by two quote marks together ("").
 		 * The escape sequence for a quoted variable name to indicate a quotation mark is two quotation marks together.
 		 * @param expression An expression to compile.
-		 * @param symbolTable This is a lookup table containing custom variables and functions that can be used in the expression.  These values may be changed outside the function after compiling.
+		 * @param symbolTable This is a lookup table containing custom variables and functions that can be used in the expression.  These values may be changed outside the function after compiling.
 		 * @param ignoreRuntimeErrors If this is set to true, the generated function will ignore any Errors caused by the individual function calls in its execution.  Return values from failed function calls will be treated as undefined.
 		 * @param useThisScope If this is set to true, properties of 'this' can be accessed as if they were local variables.
 		 * @param paramNames This specifies local variable names to be associated with the arguments passed in as parameters to the compiled function.
 		 * @param paramDefaults This specifies default values corresponding to the parameter names.  This must be the same length as the paramNames array.
-		 * @return A Function generated from the expression String, or null if the String does not represent a valid expression.
+		 * @return A Function generated from the expression String, or null if the String does not represent a valid expression.
 		 */
 		public function compileToFunction(expression:String, symbolTable:Object, ignoreRuntimeErrors:Boolean, useThisScope:Boolean = false, paramNames:Array = null, paramDefaults:Array = null):Function
-		{
-			var tokens:Array = getTokens(expression);
+		{
+			var tokens:Array = getTokens(expression);
 			//trace("source:", expression, "tokens:" + tokens.join(' '));
 			var compiledObject:ICompiledObject = compileTokens(tokens, true);
 			return compileObjectToFunction(compiledObject, symbolTable, ignoreRuntimeErrors, useThisScope, paramNames, paramDefaults);
@@ -91,17 +101,17 @@
 		/**
 		 * This function will compile an expression into a compiled object representing a function that takes no parameters and returns a value.
 		 * This function is useful for inspecting the structure of the compiled function and decompiling individual parts.
-		 * @param expression An expression to parse.
-		 * @return A CompiledConstant or CompiledFunctionCall generated from the tokens, or null if the tokens do not represent a valid expression.
+		 * @param expression An expression to parse.
+		 * @return A CompiledConstant or CompiledFunctionCall generated from the tokens, or null if the tokens do not represent a valid expression.
 		 */
 		public function compileToObject(expression:String):ICompiledObject
 		{
 			return compileTokens(getTokens(expression), true);
 		}
-
+
 		// TODO: includeLibrary(sourceSymbolTable, destinationSymbolTable) where it copies all the properties of source to destination
-
-		/**
+
+		/**
 		 * avmplus.describeTypeJSON(o:*, flags:uint):Object
 		 */
 		private static const describeTypeJSON:Function = DescribeType.getJSONFunction();
@@ -170,7 +180,7 @@
 		public function includeConstant(constantName:String, constantValue:*):void
 		{
 			constants[constantName] = constantValue;
-		}
+		}

 		/**
 		 * This function gets a list of all the libraries currently being used by the compiler.
@@ -179,7 +189,10 @@
 		public function getAllLibraries():Array
 		{
 			return libraries.concat(); // make a copy
-		}
+		}
+
+		private const BRANCH_LOOKUP:Dictionary = new Dictionary(); // Function or String -> true
+		private const ASSIGN_OP_LOOKUP:Object = new Dictionary(); // Function -> true

 		/**
 		 * While this is set to true, compiler optimizations are enabled.
@@ -356,7 +369,19 @@
 			// create a corresponding function name for each operator
 			for (var op:String in operators)
 				if (operators[op] is Function)
-					constants[OPERATOR_ESCAPE + op] = operators[op];
+					constants[OPERATOR_ESCAPE + op] = operators[op];
+
+			// fill branch reverse-lookup dictionary
+			BRANCH_LOOKUP[BRANCH_IF] = true;
+			BRANCH_LOOKUP[BRANCH_FOR] = true;
+			BRANCH_LOOKUP[BRANCH_WHILE] = true;
+			BRANCH_LOOKUP[constants[OPERATOR_ESCAPE + '?:']] = true;
+			BRANCH_LOOKUP[constants[OPERATOR_ESCAPE + '&&']] = true;
+			BRANCH_LOOKUP[constants[OPERATOR_ESCAPE + '||']] = false;
+
+			// fill assignment operator reverse-lookup dictionary
+			for each (var assigOp:Function in assignmentOperators)
+				ASSIGN_OP_LOOKUP[assigOp] = true;
 		}

 		/**
@@ -899,6 +924,11 @@
 					continue;
 				}

+				if (leftBracket == '(' && token == BRANCH_IF)
+				{
+
+				}
+
 				if (leftBracket == '(' && compiledToken) // if there is a compiled token to the left, this is a function call
 				{
 					if (debug)
@@ -1209,19 +1239,18 @@
 			}

 			// create the variables that will be used inside the wrapper function
-			const METHOD_INDEX:int = -1;
-			const CONDITION_INDEX:int = 0;
-			const TRUE_INDEX:int = 1;
-			const FALSE_INDEX:int = 2;
-			const BRANCH_LOOKUP:Dictionary = new Dictionary();
-			BRANCH_LOOKUP[constants[OPERATOR_ESCAPE + '?:']] = true;
-			BRANCH_LOOKUP[constants[OPERATOR_ESCAPE + '&&']] = true;
-			BRANCH_LOOKUP[constants[OPERATOR_ESCAPE + '||']] = false;
-			const ASSIGN_OP_LOOKUP:Object = new Dictionary();
-			for each (var assigOp:Function in assignmentOperators)
-				ASSIGN_OP_LOOKUP[assigOp] = true;
+
+			const stack:Array = []; // used as a queue of function calls
+			var call:CompiledFunctionCall;
+			var subCall:CompiledFunctionCall;
+			var compiledParams:Array;
+			var result:*;
+			var symbolName:String;
+			var i:int;

 			const builtInSymbolTable:Object = {};
+			for (symbolName in [BRANCH_IF, BRANCH_ELSE, BRANCH_FOR, BRANCH_WHILE, BRANCH_RETURN])
+				builtInSymbolTable[symbolName] = symbolName;
 			const localSymbolTable:Object = {};
 			// set up Array of symbol tables in the correct scope order: built-in, local, params, this, global
 			const allSymbolTables:Array = [
@@ -1233,15 +1262,7 @@
 			];
 			const THIS_SYMBOL_TABLE_INDEX:int = 3;

-			const stack:Array = []; // used as a queue of function calls
-			var call:CompiledFunctionCall;
-			var subCall:CompiledFunctionCall;
-			var compiledParams:Array;
-			var result:*;
-			var symbolName:String;
-			var i:int;
-
-			// this function avoids unnecessary function calls by keeping its own call stack rather than using recursion.
+			// this function avoids unnecessary function call overhead by keeping its own call stack rather than using recursion.
 			var wrapperFunction:Function = function():*
 			{
 				builtInSymbolTable['this'] = this;
@@ -1308,7 +1329,7 @@
 							{
 								symbolName = call.evaluatedParams[0];
 								if (builtInSymbolTable.hasOwnProperty(symbolName))
-									throw new Error("Cannot assign built-in variable: " + symbolName);
+									throw new Error("Cannot assign built-in symbol: " + symbolName);

 								// assignment operator expects parameters like (host, ...chain, value)
 								// if there is no matching local variable and 'this' has a matching one, assign the property of 'this'
@@ -1320,7 +1341,9 @@
 							else if (call.evaluatedMethod is Class)
 							{
 								// type casting
-								if (call.evaluatedParams.length != 1)
+								if (call.evaluatedMethod == Array) // special case for Array
+									result = call.evaluatedParams.concat();
+								else if (call.evaluatedParams.length != 1)
 								{
 									// special case for Object('prop1', value1, ...)
 									if (call.evaluatedMethod === Object)
@@ -1336,7 +1359,7 @@
 								// special case for Class('some.qualified.ClassName')
 								else if (call.evaluatedMethod === Class && call.evaluatedParams[0] is String)
 									result = getDefinitionByName(call.evaluatedParams[0]);
-								else
+								else // all other single-parameter type casting operations
 									result = call.evaluatedMethod(call.evaluatedParams[0]);
 							}
 							else


Incremented version number to 1.3.0

Incremented version number to 1.3.0

--- src/org/mangui/hls/HLS.as
+++ src/org/mangui/hls/HLS.as
@@ -75,7 +75,7 @@
     /** Class that manages the streaming process. **/
     public class HLS extends EventDispatcher {

-		static public const VERSION:String = "1.1.0";
+		static public const VERSION:String = "1.3.0";

         private var _levelLoader : LevelLoader;
         private var _altAudioLevelLoader : AltAudioLevelLoader;


Ignore \r in diffs.

Ignore \r in diffs.

	* build-aux/rst.as (rst_pre): Ignore differences due to \r.

--- build-aux/rst.as
+++ build-aux/rst.as
@@ -86,9 +86,11 @@
 rst_expect ()
 {
   rst_subsubsection "$me: $[2]"
-  if ! diff -u --label="Expected $[1] ($[1].exp)" $[1].exp  \
-	       --label="Effective $[1] ($[2].eff)" $[2].eff \
-	       >$[2].diff; then
+  # --strip-trailing-cr helps to fight \r.
+  if ! diff --strip-trailing-cr -u                              \
+            --label="Expected $[1] ($[1].exp)"  $[1].exp        \
+	    --label="Effective $[1] ($[2].eff)" $[2].eff        \
+	    >$[2].diff; then
     rst_pre "Expected $[1] for $me"      $[1].exp
     rst_pre "Raw effective $[2] for $me" $[2].raw
     rst_pre "Effective $[2] for $me"     $[2].eff


Transferred from the Adobe Open Source Subversion Repository

Revision: 16545
Author:   chiedozi@adobe.com
Date:     2010-06-14T03:42:53.505665Z

Log Message:
-----------
Added MobileApplication, ViewNavigator, PersistenceManager and ViewTransition prototypes to mobile components swc.

mobilecomponents and mobiletheme eclipse projects now link to airglobal.swc instead of playerglobal.swc so that MobileApplication can respond to StageOrientation and NativeApplication events.

QE notes:
Doc notes:
Bugs:
Reviewer:
Tests run: checkintests

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/manifest.xml</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/View.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/.actionScriptProperties</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/ActionBarSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/defaults.css</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/core/managers/PersistenceManager.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/effects/ViewTransition.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/MobileThemeClasses.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/ViewNavigator.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/core/managers/IPersistenceManager.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/effects/IViewTransition.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/MobileApplication.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewData.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/.actionScriptProperties</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/ViewNavigatorSkin.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/effects/SlideViewTransition.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/ActionBar.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/events/FlexEvent.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewNavigatorSection.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/events/ViewNavigatorEvent.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/MobileApplicationSkin.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1264325 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mobilecomponents/src/spark/components/ViewNavigatorApplication.as
+++ frameworks/projects/mobilecomponents/src/spark/components/ViewNavigatorApplication.as
@@ -0,0 +1,275 @@
+package spark.components
+{
+    import flash.desktop.NativeApplication;
+    import flash.display.StageOrientation;
+    import flash.events.Event;
+    import flash.events.KeyboardEvent;
+    import flash.events.StageOrientationEvent;
+    import flash.net.registerClassAlias;
+
+    import spark.components.supportClasses.ViewData;
+    import spark.components.supportClasses.ViewNavigatorSection;
+    import spark.core.managers.IPersistenceManager;
+    import spark.core.managers.PersistenceManager;
+    import spark.events.ViewNavigatorEvent;
+
+    [DefaultProperty("sections")]
+
+    //--------------------------------------
+    //  Events
+    //--------------------------------------
+
+    /**
+     *  @inherit
+     */
+    [Event(name="applicationRestore", type="flash.events.Event")]
+
+    public class MobileApplication extends Application
+    {
+        //--------------------------------------------------------------------------
+        //
+        //  Skin Parts
+        //
+        //--------------------------------------------------------------------------
+
+        [SkinPart(required="false")]
+        public var navigator:ViewNavigator;
+
+        //--------------------------------------------------------------------------
+        //
+        //  Constructor
+        //
+        //--------------------------------------------------------------------------
+        public function MobileApplication()
+        {
+            super();
+        }
+
+        //--------------------------------------------------------------------------
+        //
+        //  Variables
+        //
+        //--------------------------------------------------------------------------
+
+        //--------------------------------------------------------------------------
+        //
+        //  Properties
+        //
+        //--------------------------------------------------------------------------
+
+
+        //----------------------------------
+        //  sessionCachingEnabled
+        //----------------------------------
+
+        private var _sessionCachingEnabled:Boolean = false;
+
+        public function get sessionCachingEnabled():Boolean
+        {
+            return _sessionCachingEnabled;
+        }
+        public function set sessionCachingEnabled(value:Boolean):void
+        {
+            _sessionCachingEnabled = value;
+        }
+
+        //----------------------------------
+        //  persistenceManager
+        //----------------------------------
+        private var _persistenceManager:IPersistenceManager;
+
+        public function get persistenceManager():IPersistenceManager
+        {
+            return _persistenceManager;
+        }
+
+        public function set persistenceManager(value:IPersistenceManager):void
+        {
+            _persistenceManager = value;
+        }
+
+        //----------------------------------
+        //  sections
+        //----------------------------------
+
+        private var _sections:Vector.<ViewNavigatorSection>;
+        private var _sectionsChanged:Boolean = false;
+
+        [ArrayElementType("spark.components.supportClasses.ViewNavigatorSection")]
+        /**
+         *  Returns the stacks vector of the current navigator.
+         */
+        public function get sections():Vector.<ViewNavigatorSection>
+        {
+            if (navigator)
+                return navigator.sections;
+
+            return _sections;
+        }
+
+        /**
+         *  @private
+         */
+        public function set sections(value:Vector.<ViewNavigatorSection>):void
+        {
+            if (navigator)
+                navigator.sections = (value == null) ? value : value.concat();
+            else
+                _sections = value.concat();
+        }
+
+
+        //--------------------------------------------------------------------------
+        //
+        //  Methods
+        //
+        //--------------------------------------------------------------------------
+
+        /**
+         *
+         */
+        protected function deviceKeyDownHandler(event:KeyboardEvent):void
+        {
+            var key:uint = event.keyCode;
+
+            // We want to prevent the default down behavior for back key if navigator
+            // is at root
+            if (key == 94 && navigator.selectedSectionLength > 1)
+                event.preventDefault();
+        }
+
+        /**
+         *
+         */
+        protected function deviceKeyUpHandler(event:KeyboardEvent):void
+        {
+            var key:uint = event.keyCode;
+
+            if (key == 94 && navigator.selectedSectionLength > 1)
+                navigator.popView();
+        }
+
+        public function get isLandscape():Boolean
+        {
+            return systemManager.stage.orientation == StageOrientation.ROTATED_LEFT ||
+                systemManager.stage.orientation == StageOrientation.ROTATED_RIGHT;
+        }
+
+        protected function persistViewData(event:Event = null):void
+        {
+            if (sessionCachingEnabled)
+                persistenceManager.setProperty("sectionData", sections);
+        }
+
+
+        protected function navigator_viewAddHandler(event:ViewNavigatorEvent):void
+        {
+            var view:View = event.view;
+
+            if (view)
+                view.setCurrentState(view.getCurrentViewState(isLandscape), false);
+        }
+
+        protected function orientationChangingHandler(event:StageOrientationEvent):void
+        {
+
+        }
+
+        protected function orientationChangeHandler(event:StageOrientationEvent):void
+        {
+            navigator.activeView.setCurrentState(navigator.activeView.getCurrentViewState(isLandscape), false);
+        }
+
+        protected function applicationActivateHandler(event:Event):void
+        {
+        }
+
+        protected function applicationDeactivateHandler(event:Event):void
+        {
+            // This method called on Android when app run in background
+            if (sessionCachingEnabled)
+            {
+                persistenceManager.setProperty("selectedSection", navigator.selectedIndex);
+                navigator.persistCurrentView();
+                persistenceManager.flush();
+            }
+        }
+
+        //--------------------------------------------------------------------------
+        //
+        //  Overridden methods: UIComponent
+        //
+        //--------------------------------------------------------------------------
+
+        override public function initialize():void
+        {
+            super.initialize();
+
+            // Add device key listeners
+            NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, applicationActivateHandler);
+            NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, applicationDeactivateHandler);
+            NativeApplication.nativeApplication.addEventListener(Event.EXITING, applicationDeactivateHandler);
+
+            systemManager.stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGING, orientationChangingHandler);
+            systemManager.stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, orientationChangeHandler);
+            systemManager.stage.addEventListener(KeyboardEvent.KEY_DOWN, deviceKeyDownHandler);
+            systemManager.stage.addEventListener(KeyboardEvent.KEY_UP, deviceKeyUpHandler);
+
+            // Initialize objects related to session-persistence
+            if (sessionCachingEnabled)
+            {
+                // Register aliases for custom classes that will be written to
+                // persistence store by navigator
+                registerClassAlias("ViewData", ViewData);
+                registerClassAlias("ViewNavigatorSection", ViewNavigatorSection);
+
+                // Create persistence store
+                // Note: The shared object has to be loaded AFTER the class aliases are created
+                persistenceManager = new PersistenceManager();
+                persistenceManager.initialize();
+
+                // Dispatch event for loading persistence data
+                var eventDispatched:Boolean = true;
+                if (hasEventListener("applicationRestore"))
+                    eventDispatched = dispatchEvent(new Event("applicationRestore", false, true))
+
+                if (eventDispatched)
+                {
+                    // Load saved sections
+                    var savedSections:Vector.<ViewNavigatorSection>;
+                    savedSections = persistenceManager.getProperty("sectionData") as Vector.<ViewNavigatorSection>;
+
+                    if (savedSections != null)
+                        sections = savedSections;
+
+                    if (persistenceManager.enabled)
+                    {
+                        navigator.selectedIndex = persistenceManager.getProperty("selectedSection") as Number;
+
+                        if (navigator.tabBar)
+                            navigator.tabBar.selectedIndex = navigator.selectedIndex;
+                    }
+                }
+            }
+        }
+
+        override protected function partAdded(partName:String, instance:Object):void
+        {
+            super.partAdded(partName, instance);
+
+            if (instance == navigator)
+            {
+                navigator.addEventListener(Event.COMPLETE, persistViewData);
+                navigator.addEventListener(ViewNavigatorEvent.VIEW_ADD, navigator_viewAddHandler);
+
+                navigator.sections = _sections;
+                _sections = null;
+            }
+        }
+
+        override protected function partRemoved(partName:String, instance:Object):void
+        {
+            super.partRemoved(partName, instance);
+        }
+    }
+}


Transferred from the Adobe Open Source Subversion Repository

Revision: 23247
Author:   cframpto@adobe.com
Date:     2011-12-20T19:21:13.134833Z

Log Message:
-----------
Remove ADOBE SYSTEMS license and replace with Apache license in headers - frameworks.  A 2nd pass will be needed to get the files not handled up by the scripts.

Modified Paths:
--------------
4959 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1264372 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mobilecomponents/src/spark/components/ViewNavigatorApplication.as
+++ frameworks/projects/mobilecomponents/src/spark/components/ViewNavigatorApplication.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2010 Adobe Systems Incorporated
-//  All Rights Reserved.
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
 //
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////


Transferred from the Adobe Open Source Subversion Repository

Revision: 19169
Author:   chiedozi@adobe.com
Date:     2010-12-08T21:41:44.966503Z

Log Message:
-----------
The ViewMenu now properly closes when the back key is pressed in a TabbedViewNavigatorApplication

QE notes:
Doc notes:
Bugs:SDK-28795
Reviewer: Jason Szeto
Tests run: checkintests
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/ViewNavigatorApplication.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/TabbedViewNavigatorApplication.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1264359 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mobilecomponents/src/spark/components/ViewNavigatorApplication.as
+++ frameworks/projects/mobilecomponents/src/spark/components/ViewNavigatorApplication.as
@@ -647,7 +647,7 @@

         if (viewMenuOpen)
             viewMenuOpen = false;
-        else
+        else if (navigator)
             navigator.backKeyUpHandler();
     }

@@ -658,7 +658,6 @@
     {
         super.saveNavigatorState();

-        // TODO (chiedozi): Rename save to maybe get?
         if (navigator)
             persistenceManager.setProperty("navigatorState", navigator.saveViewData());
     }
@@ -668,8 +667,6 @@
      */
     override protected function loadNavigatorState():void
     {
-        // TODO (chiedozi): Figure out how to refactor this into base class.  Need navigator
-        // to be a part of the base class
         super.loadNavigatorState();

         var savedState:Object = persistenceManager.getProperty("navigatorState");


Transferred from the Adobe Open Source Subversion Repository

Revision: 23246
Author:   cframpto@adobe.com
Date:     2011-12-20T17:40:08.069454Z

Log Message:
-----------
Rollback 23243.  If comment followed header it was stripped as well.

Modified Paths:
--------------
2361 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1264770 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mobilecomponents/src/spark/transitions/CrossFadeViewTransition.as
+++ frameworks/projects/mobilecomponents/src/spark/transitions/CrossFadeViewTransition.as
@@ -1,3 +1,13 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2010 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////

 package spark.transitions
 {