zoukankan
html css js c++ java
flash读取XML 背景自动适应大小
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;
}
查看全文
相关阅读:
装备购买 线性基+贪心
花园 状压DP+矩阵快速幂
数学作业 递推+矩阵快速幂
石头游戏 构造+矩阵快速幂
sumdiv 算术基本定理的推论
huffman
Integer 类型比较大小
java 中的 String 相加
Java 中的 static 关键字
JAVA 基础
原文地址:https://www.cnblogs.com/nasa/p/687231.html
最新文章
类的内置方法
绑定方法、非绑定方法与反射、内置方法
多态性与鸭子类型
组合与封装
继承与派生
面向对象编程
常用内置模块与包
面试题总结
on_delete的相关使用说明
Django内置用户类AbstractUser与内置认证校验系统
热门文章
重点:models.py文件中的字段和类型解析
Django中blank=True和null=True的区别
印象最深的问题Your STATICFILES_DIRS setting is not a tuple or list; " ImproperlyConfigured: Your STATICFILES_DIRS setting is not a tuple or list; perhaps you forgot a trailing comma?
解决 Nginx: [error] open() "/usr/local/Nginx/logs/Nginx.pid" failed(2:No such file or directory)
warning: LF will be replaced by CRLF in ...... The file will have its original line endings in your working directory. 报错导致的git add . 不成功
报错RuntimeError: Model class apps.user.models.User doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
Django报错django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient?
BSGS&&ExBSGS
CRT&&ExCRT
HDOJ3949 XOR 线性基
Copyright © 2011-2022 走看看