var
bg
=
new
Object();
bg.bgdoc_xml = new XML();
bg.parse_XML = function () {
function displayXML() {
if (bg.bgdoc_xml == undefined) {
trace("..undefined");
}
if (bg.bgdoc_xml.loaded == false) {
trace("loaded false");
} else {
//清除从 setInterval() 的调用
clearInterval(rep_int);
//trace("BgXml Load success");
play();
}
}
bg.bgdoc_xml.ignoreWhite = true;
bg.bgdoc_xml.load("background.xml");
bg.bgdoc_xml.onLoad = function(success) {
if (!success) {
trace("background.xml false");
} else {
//每隔200毫秒调用displayXML
rep_int = setInterval(displayXML, 200);
}
};
} ;
//
bg.Init = function () {
//trace("bg.Init");
bg.folder = bg.bgdoc_xml.firstChild.attributes.folder;
bg.path_array = new Array();
for (var i = 0; i<bg.bgdoc_xml.firstChild.childNodes.length; i++) {
bg.path_array.push(bg.folder+bg.bgdoc_xml.firstChild.childNodes[i].attributes.url);
}
bg.nowOrder = random(bg.path_array.length);
bg.start = true;
} ;
bg.show = function () {
//trace("bg.show");
if (bg.nowOrder == undefined) {
bg.nowOrder = 0;
}
var bg_mc = _root.Content_bg;
if (bg_mc == undefined) {
gotoAndPlay("Loadbg");
} else {
bg_mc.bg_content_mc.loadMovie(bg.path_array[bg.nowOrder]);
}
} ;
bg.showPrev = function () {
_root.bg.nowOrder--;
if (_root.bg.nowOrder<0) {
_root.bg.nowOrder = _root.bg.path_array.length-1;
}
bg.show();
} ;
bg.showNext = function () {
_root.bg.nowOrder++;
if (_root.bg.nowOrder>_root.bg.path_array.length-1) {
_root.bg.nowOrder = 0;
}
bg.show();
} ;
bg.Brightness = function () {
var mark_mc = _root.Content_bg.bgmark_mc;
mark_mc.play();
} ;
ff = function () {
var loader = _root.Loader_mc;
bg_mc.onEnterFrame = function() {
var Total = this.bg_content_mc.getBytesTotal();
var Loaded = this.bg_content_mc.getBytesLoaded();
var percent = int(Loaded/Total*100);
loader.gotoAndStop(percent);
trace("Loaded:"+percent);
if (percent>=100) {
this.onEnterFrame = undefined;
if (bg.start) {
bg.start = false;
_root.gotoAndPlay("playMenu");
}
}
};
} ;
var bgListener = new Object();
bgListener.onResize = function () {
//trace("Stage size is now "+Stage.width+" by "+Stage.height);
resizeBg();
} ;
Stage.addListener(bgListener);
function resizeBg() {
var bg_mc = _root.Content_bg;
var bgWidth = bg_mc.bg_content_mc._width;
var bgHeight = bg_mc.bg_content_mc._height;
//scale the background to resize
var maxScale = Math.max(Stage.width*bg_mc.bg_content_mc._xscale/bgWidth, Stage.height*bg_mc.bg_content_mc._yscale/bgHeight);
bg_mc.bg_content_mc._xscale = bg_mc.bg_content_mc._yscale=maxScale;
}
bg.bgdoc_xml = new XML();
bg.parse_XML = function () {
function displayXML() {
if (bg.bgdoc_xml == undefined) {
trace("..undefined");
}
if (bg.bgdoc_xml.loaded == false) {
trace("loaded false");
} else {
//清除从 setInterval() 的调用
clearInterval(rep_int);
//trace("BgXml Load success");
play();
}
}
bg.bgdoc_xml.ignoreWhite = true;
bg.bgdoc_xml.load("background.xml");
bg.bgdoc_xml.onLoad = function(success) {
if (!success) {
trace("background.xml false");
} else {
//每隔200毫秒调用displayXML
rep_int = setInterval(displayXML, 200);
}
};
} ;
//
bg.Init = function () {
//trace("bg.Init");
bg.folder = bg.bgdoc_xml.firstChild.attributes.folder;
bg.path_array = new Array();
for (var i = 0; i<bg.bgdoc_xml.firstChild.childNodes.length; i++) {
bg.path_array.push(bg.folder+bg.bgdoc_xml.firstChild.childNodes[i].attributes.url);
}
bg.nowOrder = random(bg.path_array.length);
bg.start = true;
} ;
bg.show = function () {
//trace("bg.show");
if (bg.nowOrder == undefined) {
bg.nowOrder = 0;
}
var bg_mc = _root.Content_bg;
if (bg_mc == undefined) {
gotoAndPlay("Loadbg");
} else {
bg_mc.bg_content_mc.loadMovie(bg.path_array[bg.nowOrder]);
}
} ;
bg.showPrev = function () {
_root.bg.nowOrder--;
if (_root.bg.nowOrder<0) {
_root.bg.nowOrder = _root.bg.path_array.length-1;
}
bg.show();
} ;
bg.showNext = function () {
_root.bg.nowOrder++;
if (_root.bg.nowOrder>_root.bg.path_array.length-1) {
_root.bg.nowOrder = 0;
}
bg.show();
} ;
bg.Brightness = function () {
var mark_mc = _root.Content_bg.bgmark_mc;
mark_mc.play();
} ;
ff = function () {
var loader = _root.Loader_mc;
bg_mc.onEnterFrame = function() {
var Total = this.bg_content_mc.getBytesTotal();
var Loaded = this.bg_content_mc.getBytesLoaded();
var percent = int(Loaded/Total*100);
loader.gotoAndStop(percent);
trace("Loaded:"+percent);
if (percent>=100) {
this.onEnterFrame = undefined;
if (bg.start) {
bg.start = false;
_root.gotoAndPlay("playMenu");
}
}
};
} ;
var bgListener = new Object();
bgListener.onResize = function () {
//trace("Stage size is now "+Stage.width+" by "+Stage.height);
resizeBg();
} ;
Stage.addListener(bgListener);
function resizeBg() {
var bg_mc = _root.Content_bg;
var bgWidth = bg_mc.bg_content_mc._width;
var bgHeight = bg_mc.bg_content_mc._height;
//scale the background to resize
var maxScale = Math.max(Stage.width*bg_mc.bg_content_mc._xscale/bgWidth, Stage.height*bg_mc.bg_content_mc._yscale/bgHeight);
bg_mc.bg_content_mc._xscale = bg_mc.bg_content_mc._yscale=maxScale;
}