flash 2.0 解析xml文件代码
下面一段关于flash 2.0 解析xml文件代码哦,看看吧也许对你有用的。
var css_str = "a{color:#FFFFFF;text-decoration:underline;}a:hover{text-decoration:underline;color:#EE0435;}";
var my_styleSheet = new TextField.StyleSheet();
System.useCodepage = true;
my_styleSheet.parseCSS(css_str);
topstory_xml = new XML();
topstory_xml.ignoreWhite = true;
topstory_xml.onLoad = function ()
{
var _l1 = this;
the_xml = _l1.firstChild;
for (z = 0; z < the_xml.childNodes.length; z++)
{
tempobject_xml = _l1.firstChild.childNodes[z];
content_mc["story" + z] = new Object();
content_mc["story" + z].image = tempobject_xml.childNodes[0].childNodes[0];
content_mc["story" + z].image_sm = tempobject_xml.childNodes[1].childNodes[0];
content_mc["story" + z].video = tempobject_xml.childNodes[2].childNodes[0];
content_mc["story" + z].captionlines = tempobject_xml.childNodes[3].childNodes[0];
content_mc["story" + z].headline = "<b>" + tempobject_xml.childNodes[4].childNodes[0].toString() + "</b>";
content_mc["story" + z].thecaption = tempobject_xml.childNodes[5].toString();
content_mc["story" + z].photocaption = tempobject_xml.childNodes[6].childNodes.toString();
} // end of for
build_app();
init_story(0);
};
build_app = function ()
{
var _l1 = _root;
for (z = 0; z < 5; z++)
{
_l1["nav" + z].init_num = z;
_l1["nav" + z].image_mc.loadMovie(_l1.content_mc["story" + z].image_sm);
_l1.stage["inner_" + z].loadMovie(_l1.content_mc["story" + z].image);
_l1.stage["inner_bttm_" + z].loadMovie(_l1.content_mc["story" + z].image);
} // end of for
};
scrub = function ()
{
if (_root.inited == 4)
{
init_story(0);
}
else
{
init_story(_root.inited + 1);
} // end if
};
starttimer = function (a)
{
_root.interval_var = setInterval(scrub, 10000);
};
cleartimer = function (a)
{
clearInterval(_root.interval_var);
};
init_story = function (n)
{
var _l1 = n;
var _l2 = _root;
_l2.cleartimer();
p_array = new Array(0, -342, -684, -1026, -1368);
if (_l2.inited != null)
{
_l2["nav" + _l2.inited].gotoAndStop(1);
} // end if
_l2["nav" + _l1].gotoAndStop(2);
indicator_mc.theGoalY = _l2["nav" + _l1]._y;
stage.target_x = p_array[_l1];
_l2.inited = _l1;
if (content_mc["story" + _l1].video == undefined)
{
thebutton._x = -200;
}
else
{
thebutton._x = 8;
} // end if
stage.masker.gotoAndPlay(1);
content_mc.gotoAndStop(1);
_l2.photo_credit = content_mc["story" + _l1].photocaption;
content_mc.gotoAndStop(content_mc["story" + _l1].captionlines + "");
content_mc.headline_txt = content_mc["story" + _l1].headline;
content_mc.content_txt = content_mc["story" + _l1].thecaption;
videolink = content_mc["story" + _l1].video;
_l2.starttimer();
};
topstory_xml.load("zcool.xml");
补充:flash教程,动画技术