package classes { public class FVC_Event extends flash.events::Event { //========================= Variables public static const PARSE_ERROR : String = "parse_error"; public static const PARSE_FINISH : String = "parse_finish"; public var kbn : String; public var message : String; //========================= Methods public static function FVC_Event() { this.PARSE_FINISH = "parse_finish"; this.PARSE_ERROR = "parse_error"; return; } public function FVC_Event(arg0:String, arg1:String = "OWARI") { super(arg0); this.kbn = arg0; this.message = arg1; return; } public function toString() : String { return formatToString("AlarmEvent", "type", "bubbles", "cancelable", "eventPhase", "kbn", "message"); } } public class FlashVerChecker extends flash.display::Sprite { //========================= Variables private var platform : String; private var timer : Timer; private var cntStep : Number; private var version : String; private var major_ver : String; public var fpError : MovieClip; private var minor_ver : String; private var ver : String; public var pltLoading : MovieClip; private var flgResult : Boolean; public var pltMSG : MovieClip; public var pltCheckResult : MovieClip; private var fvcread : FVC_ReadXML; private var internal_build_num : String; private var build_num : String; //========================= Methods public static function FlashVerChecker() { return; } public function FlashVerChecker() { super(); this.ver = Capabilities.version; this.platform = ver.split(" ")[0]; this.version = ver.split(" ")[1]; this.major_ver = version.split(",")[0]; this.minor_ver = version.split(",")[1]; this.build_num = version.split(",")[2]; this.internal_build_num = version.split(",")[3]; this.pltFPErrMsgDefine(); this.pltMSG.visible = false; this.pltCheckResultDefine(); if(Number(this.major_ver) < 9) { this.fpError.visible = true; this.pltLoading.visible = false; } else { this.fvcread = new FVC_ReadXML(); fvcread.addEventListener(FVC_Event.PARSE_FINISH, this.rtnParse); fvcread.addEventListener(FVC_Event.PARSE_ERROR, this.rtnParseError); fvcread.parseXML(); } return; } internal function pltCheckResultDefine() { plt = null; onDspDetail = null; onDtlBtnOver = null; onDtlBtnOut = null; onRtnMain = null; onRtnBtnOver = null; onRtnBtnOut = null; getFlashPlayer = null; onDspDetail = function() { plt.pltMain.visible = false; plt.glass.visible = false; plt.pltDetail.visible = true; return; }; onDtlBtnOver = function() { gotoAndStop("OVER"); return; }; onDtlBtnOut = function() { gotoAndStop("UP"); return; }; onRtnMain = function() { plt.pltMain.visible = true; plt.glass.visible = true; plt.pltDetail.visible = false; return; }; onRtnBtnOver = function() { gotoAndStop("OVER"); return; }; onRtnBtnOut = function() { gotoAndStop("UP"); return; }; getFlashPlayer = function() { navigateToURL(new URLRequest(fvcread.objResData.link), "_self"); return; }; plt = this.pltCheckResult; plt.pltMain.visible = true; plt.pltDetail.visible = false; plt.pltMain.btnDetail.buttonMode = true; plt.pltMain.btnDetail.useHandCursor = true; plt.pltMain.btnDetail.txtTitle.text = "詳細"; addEventListener(MouseEvent.MOUSE_DOWN, onDspDetail); addEventListener(MouseEvent.MOUSE_OVER, onDtlBtnOver); addEventListener(MouseEvent.MOUSE_OUT, onDtlBtnOut); plt.pltMain.btnDetail.mouseChildren = false; plt.pltDetail.btnReturn.buttonMode = true; plt.pltDetail.btnReturn.useHandCursor = true; plt.pltDetail.btnReturn.txtTitle.text = "戻る"; addEventListener(MouseEvent.MOUSE_DOWN, onRtnMain); addEventListener(MouseEvent.MOUSE_OVER, onRtnBtnOver); addEventListener(MouseEvent.MOUSE_OUT, onRtnBtnOut); plt.pltDetail.btnReturn.mouseChildren = false; plt.pltDetail.btnGetFP.buttonMode = true; plt.pltDetail.btnGetFP.useHandCursor = true; addEventListener(MouseEvent.MOUSE_DOWN, getFlashPlayer); plt.visible = true; plt.pltMain.btnDetail.visible = false; return; } private function rtnParseError(arg0:classes::FVC_Event) { fvcread.removeEventListener(FVC_Event.PARSE_ERROR, this.rtnParseError); this.pltMSG.txtMsg.text = arg0.message; this.pltLoading.visible = false; this.pltMSG.visible = true; return; } private function rtnParse(arg0:classes::FVC_Event) { fvcread.removeEventListener(FVC_Event.PARSE_FINISH, this.rtnParse); this.timer = new Timer(500); timer.addEventListener(TimerEvent.TIMER, this.launchResult); if(arg0.message == "OK") { this.pltCheckResult.pltMain.txtCurrentVersion.text = ; this.pltCheckResult.pltMain.visible = true; this.pltCheckResult.pltDetail.txtCurrentVersion.text = ; this.pltCheckResult.pltDetail.txtLatestVersion.text = this.fvcread.objResData.version; this.pltLoading.visible = false; if(this.version == this.fvcread.objResData.version) { this.flgResult = true; } else { this.flgResult = false; } this.cntStep = 0; timer.start(); } else { this.pltMSG.txtMsg.text = arg0.message; this.pltLoading.visible = false; this.pltMSG.visible = true; } return; } internal function pltFPErrMsgDefine() { pressBtnFlashDL = null; pressBtnFlashDL = function() { navigateToURL(new URLRequest("http://www.adobe.com/go/JP-H-GET-FLASH"), "_self"); return; }; this.fpError.btnFlashDL.buttonMode = true; this.fpError.btnFlashDL.useHandCursor = true; addEventListener(MouseEvent.MOUSE_DOWN, pressBtnFlashDL); this.fpError.txtMSG.text = "Version 9 or later of the Flash Player is required."; this.fpError.visible = false; return; } internal function launchResult(arg0:flash.events::TimerEvent) { if(this.cntStep == 0) { if(this.flgResult) { gotoAndPlay("OK"); } else { gotoAndPlay("NG"); } var loc0:* = this; var loc1:* = this.cntStep + 1; loc0.cntStep = this.cntStep; } else { if(this.cntStep == 1) { timer.stop(); this.pltCheckResult.pltMain.btnDetail.visible = true; } } return; } } public class FVC_ReadXML extends flash.display::Sprite { //========================= Variables internal var objResData : Object; private var xmlLoader : URLLoader; private var url : String; //========================= Methods public static function FVC_ReadXML() { return; } public function FVC_ReadXML() { super(); // Default XML Namespace: "http://oval.mitre.org/XMLSchema/oval-definitions-5#windows"this.url = "http://jvnrss.ise.chuo-u.ac.jp/jtg/ex/oval_flash_player_win.xml?" + getTime(); this.xmlLoader = new URLLoader(); this.xmlLoader.dataFormat = URLLoaderDataFormat.TEXT; xmlLoader.addEventListener(Event.COMPLETE, this.onLoaded); xmlLoader.addEventListener(IOErrorEvent.IO_ERROR, this.ioErrorHandler); return; } internal function ioErrorHandler(arg0:flash.events::IOErrorEvent) { // Default XML Namespace: "http://oval.mitre.org/XMLSchema/oval-definitions-5#windows"xmlLoader.removeEventListener(IOErrorEvent.IO_ERROR, this.ioErrorHandler); dispatchEvent(new FVC_Event(FVC_Event.PARSE_ERROR, "ファイルが読み込めません。")); return; } internal function onLoaded(arg0:flash.events::Event) { xmlData = null; oval = null; rslt = null; event = arg0; xmlLoader.removeEventListener(Event.COMPLETE, this.onLoaded); try { xmlData = new XML(event.target.data); this.objResData = new Object(); if(namespace("") != undefined) { // Default XML Namespace: "http://oval.mitre.org/XMLSchema/oval-definitions-5" } oval = namespace("oval"); this.objResData.link = xmlData.definitions.definition.metadata.reference.ref_url; var loc1:* = 0; var loc2:* = xmlData.states; for(loc1 in loc2) { rslt = loc2.__getNextEnumerablePropertyValue(); if(namespace("") != undefined) { // Default XML Namespace: "http://oval.mitre.org/XMLSchema/oval-definitions-5#windows" } this.objResData.version = rslt.registry_state.value; } if((this.objResData.link == "" || this.objResData.link == undefined || this.objResData.version == "" || this.objResData.version == undefined)) { dispatchEvent(new FVC_Event(FVC_Event.PARSE_FINISH, "検査用データ無し。")); } else { dispatchEvent(new FVC_Event(FVC_Event.PARSE_FINISH, "OK")); } } catch (err:TypeError) { loc1 = err; event = null; trace("*** ERROR *** " + event.message); dispatchEvent(new FVC_Event(FVC_Event.PARSE_ERROR, "解析エラーです。")); } return; } internal function parseXML() { // Default XML Namespace: "http://oval.mitre.org/XMLSchema/oval-definitions-5#windows"xmlLoader.load(new URLRequest(this.url)); return; } } }