Testing the versions of Flash Player and SWF

by Fumio
♥0 | Line 42 | Modified 2012-09-25 16:10:37 | MIT License
play

ActionScript3 source code

/**
 * Copyright Fumio ( http://wonderfl.net/user/Fumio )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/1Gs3
 */

package {
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.utils.getTimer;
	import flash.system.Capabilities;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	import flash.text.TextFormatAlign;
	[SWF(width = "240",height = "180")]
	public class FlashVersion extends Sprite {
		private var my_txt:TextField = new TextField();
		private var label_txt:TextField = new TextField();
		private var my_fmt:TextFormat = new TextFormat();
		public function FlashVersion() {
			// Creating a TextField for display
			createTextField();
			// Starting Test
			testVersion();
		}
		private function testVersion():void {
			var version_str:String = Capabilities.version;
			loaderInfo.addEventListener(Event.COMPLETE, getSwfVersion);
			xTrace("player", version_str);
		}
		private function getSwfVersion(eventObject:Event):void {
			var nSwfVersion:uint = loaderInfo.swfVersion
			xTrace("swf", String(nSwfVersion));
		}
		private function createTextField():void {
			addChild(my_txt);
			addChild(label_txt);
			my_fmt.align = TextFormatAlign.RIGHT;
			my_txt.x +=  50;
			my_txt.defaultTextFormat = my_fmt;
			my_txt.autoSize = TextFieldAutoSize.RIGHT;
			label_txt.autoSize = TextFieldAutoSize.LEFT;
		}
		private function xTrace(label_str:String, _str:String):void {
			my_txt.appendText(_str + "\n");
			label_txt.appendText((label_str + ":" + "\n"));
		}
	}
}

Forked