flashxml.txt

来自「请认真阅读您的文件包然后写出其具体功能(至少要20个字)。尽量不要让站长把时间都」· 文本 代码 · 共 2,207 行 · 第 1/5 页

TXT
2,207
字号

_global:全局
_level:场景
parent:上一级
root:根级
this:当前级

global:在哪写都一样
parent:在元件库中写表示他的上一级 如果在场景中写。没用或表示他被加载的上1级。
root:在哪写都一样,都表示场景
this:在元件中表示当前元件 在场景表示场景。





a.向前prevBtn,向后nextBtn,剪辑textMcD是由一个动态文本text
和一按钮组成,接钮又是一方框组成分4层,背景框
b.向前prevBtn,向后nextBtn各分2帧,第一帧stop()
c.剪辑textMcD也分2帧,第一帧stop()
d.场景第一帧动作
function loadEnd() {
	node = this.firstChild.childNodes;
	textNum = node.length;
	bText = [];
	bText_link = [];
	var i = 0;
	while (i<textNum) {
		bText[i] = node[i].firstChild.firstChild.nodeValue;
		bText_link[i] = node[i].firstChild.nextSibling.firstChild.nodeValue;
		i++;
	}
	loadEndOk = true;
}
function rightMoving() {
	var i = 1;
	while (i<=textNum) {
		var mc = this.textMcD["textMc"+i];
		if (mc.stageVar == textNum) {
			mc.stageVar = 1;
			mc._x = posx[1];
		} else {
			mc.stageVar++;
		}
		i++;
	}
	delTimer = 0;
}
function leftMoving() {
	var i = 1;
	while (i<=textNum) {
		var mc = this.textMcD["textMc"+i];
		if (mc.stageVar == 1) {
			mc.stageVar = textNum;
			mc._x = posx[stageView];
		} else {
			mc.stageVar--;
		}
		i++;
	}
	delTimer = 0;
}
var speed = 0.10;
var frameTime = 100;
System.useCodepage = true;
textBanner = new XML();
textBanner.onLoad = loadEnd;
textBanner.ignoreWhite = true;
textBanner.load("textBanner.xml");
this.textMcD.textMc._visible = 0;
var wSize = (this.textMcD.textMc._width+50);
var loadEndOk = false;
posx = [];
this.textMcD.textMc.onEnterFrame = function() {
	if (loadEndOk == true) {
		var i = 1;
		while (i<=textNum) {
			var mc = this.duplicateMovieClip("textMc"+i, i);
			if (i == 1) {
				mc._x = mc._x-wSize;
			} else if (i == 2) {
				mc._x = this._x;
			} else {
				mc._x = mc._x+wSize;
			}
			mc.text = bText[i-1];
			mc.onRollOver = function() {
				this.gotoAndStop(2);
				autoMoving = false;
			};
			mc.onRollOut = function() {
				this.gotoAndStop(1);
				autoMoving = true;
			};
			mc.onRelease = function() {
				getURL(bText_link[this._name.slice(6)-1]);
			};
			posx[i] = mc._x;
			mc.stageVar = i;
			i++;
		}
		delete this.onEnterFrame;
	}
};
var count = 0;
var delTimer = 0;
var autoMoving = true;
var stageView = 3;
var distance = "right";
this.onEnterFrame = function() {
	if ((((++count)%frameTime) == 0) && (autoMoving == true)) {
		if (distance == "right") {
			rightMoving();
		} else {
			leftMoving();
		}
	}
	if ((++delTimer)<100) {
		var i = 1;
		while (i<=textNum) {
			var mc = this.textMcD["textMc"+i];
			if (mc.stageVar<=stageView) {
				mc._visible = 1;
				mc._x = mc._x+(speed*(posx[mc.stageVar]-mc._x));
			} else {
				mc._visible = 0;
			}
			i++;
		}
	}
};
this.nextBtn.onRelease = function() {
	distance = "right";
	leftMoving();
};
this.prevBtn.onRelease = function() {
	distance = "left";
	rightMoving();
};
this.nextBtn.onRollOver = (this.prevBtn.onRollOver=function () {
	this.gotoAndStop(2);
	autoMoving = false;
});
this.nextBtn.onRollOut = (this.prevBtn.onRollOut=function () {
	this.gotoAndStop(1);
	autoMoving = true;
	count = 0;
});











a.img1-9_mc,
b.第一张
onClipEvent (load)
{
    this._visible = true;
}
2-9:
onClipEvent (load)
{
    this._alpha = 0;
}
c.剪辑按钮1-9放9个按钮,第1,2帧stop ();按钮上动作
on (press)
{
    _root.setCurrPic(this._name.split("_")[0].substring(this._name.split("_")[0].length - 1));
}
d.
function fadeTPl_1(co, no)
{
    currPicObj = co;
    nextPicObj = no;
    fadingLoop = setInterval(function ()
    {
        if (nextPicObj._alpha >= 100 && currentPic._alpha <= 0)
        {
            clearInterval(fadingLoop);
            currentPic = nextPic;
            isFading = false;
            return;
        } // end if
        currPicObj._alpha = currPicObj._alpha - 10;
        nextPicObj._alpha = nextPicObj._alpha + 10;
    }, 50);
} // End of the function
function getData()
{
    var xmlObj = new XML();
    var _loc1 = "fade_new.xml";
    xmlObj.load(_loc1);
    xmlObj.ignoreWhite = true;
    xmlObj.onLoad = function (success)
    {
        fixData(xmlObj);
    };
} // End of the function
function fixData(o)
{
    var i = 0;
    while (i < o.firstChild.childNodes.length)
    {
        arrImg.push(o.firstChild.childNodes[i].childNodes[2].firstChild);
        arrUrl.push(o.firstChild.childNodes[i].childNodes[1].firstChild);
        arrTitle.push(o.firstChild.childNodes[i].childNodes[0].firstChild);
        arrTitle2.push(o.firstChild.childNodes[i].childNodes[3].firstChild);
        ++i;
    } // end while
    img1_mc.loadMovie(arrImg[0]);
    img2_mc.loadMovie(arrImg[1]);
    linkbutton.onRelease = function ()
    {
        getURL(htmlReplace(arrUrl[0]), "_blank");
        flash.external.ExternalInterface.call("fls_onClick", "0");
    };
    setTitleInfo(arrTitle[0], arrTitle2[0], arrUrl[0]);
    btn1_mc.gotoAndStop(2);
} // End of the function
function preLoadPic(i)
{
    if (i == 9)
    {
        i = 0;
    } // end if
    if (isLoading[i])
    {
        return;
    } // end if
    ++i;
    eval("img" + i + "_mc").loadMovie(arrImg[i - 1]);
    isLoading[i - 1] = true;
} // End of the function
function checkPicLoad(i, o)
{
    o.onEnterFrame = function ()
    {
        if (int(o.getBytesLoaded() / o.getBytesTotal() * 100) >= 100)
        {
            eval("btn" + i + "_mc")._visible = true;
            delete o.onEnterFrame;
        } // end if
    };
} // End of the function
function start()
{
    getData();
} // End of the function
function checkFade()
{
    var i = 1;
    while (i < 10)
    {
        if (eval("btn" + i + "_mc")._visible == false)
        {
            return;
        } // end if
        ++i;
    } // end while
    clearInterval(picLoadLoop);
    startFade();
} // End of the function
function startFade()
{
    fadeLoop = setInterval(picFade, 4000);
} // End of the function
function picFade()
{
    nextPic = currentPic == 9 ? (1) : (parseInt(currentPic) + 1);
    loadFadeTpl(eval("img" + currentPic + "_mc"), eval("img" + nextPic + "_mc"));
} // End of the function
function loadFadeTpl(co, no)
{
    preLoadPic(nextPic);
    isFading = true;
    linkbutton.onRelease = function ()
    {
        getURL(htmlReplace(arrUrl[nextPic - 1]), "_blank");
        flash.external.ExternalInterface.call("fls_onClick", nextPic - 1);
    };
    setTitleInfo(arrTitle[nextPic - 1], arrTitle2[nextPic - 1], arrUrl[nextPic - 1]);
    setButtonColor();
    fadeTPl_1(co, no);
} // End of the function
function setButtonColor()
{
    var i = 1;
    while (i < 10)
    {
        eval("btn" + i + "_mc").gotoAndStop(1);
        ++i;
    } // end while
    eval("btn" + nextPic + "_mc").gotoAndStop(2);
} // End of the function
function setCurrPic(cp)
{
    if (currentPic == cp)
    {
        return;
    } // end if
    if (!isLoading[cp - 1])
    {
        eval("img" + cp + "_mc").loadMovie(arrImg[cp - 1]);
        isLoading[cp - 1] = true;
    } // end if
    if (isFading == false)
    {
        playerStop();
        nextPic = cp;
        loadFadeTpl(eval("img" + currentPic + "_mc"), eval("img" + nextPic + "_mc"));
    }
    else
    {
        trace (isFading);
    } // end else if
} // End of the function
function setTitleInfo(txt, txt2, url)
{
    title_mc.title_txt.text = txt;
    title2_mc.title_txt.text = txt2;
    title_mc.onRelease = function ()
    {
        getURL(url, "_blank");
    };
    title2_mc.onRelease = function ()
    {
        getURL(url, "_blank");
    };
} // End of the function
function playerStop()
{
    clearInterval(fadeLoop);
} // End of the function
function htmlReplace(str)
{
    str = str.toString();
    if (str.indexOf("&amp;") != -1)
    {
        str = str.split("&amp;");
        return (str.join("&"));
    } // end if
    return (str);
} // End of the function
stop ();
Stage.scaleMode = "noScale";
Stage.showMenu = false;
System.useCodepage = false;
var picLoadLoop;
var fadeLoop;
var currentPic = 1;
var nextPic;
var arrUrl = [];
var arrTitle = [];
var arrTitle2 = [];
var arrImg = [];
var isFading = false;
var isLoading = [true, true, false, false, false, false, false, false, false];
var fadingLoop;
var currPicObj;
var nextPicObj;
picLoadLoop = setInterval(checkFade, 500);
start();
---------------------------------------------------------

a.一个剪辑K在场景中放9个,命名1,2,3,4,5,6,7,8,9
b.k中放一个9帧剪辑L,9帧剪辑L:1,2,3,4,5,6,7,8,9
在K第一帧动作
gotoAndStop(this._parent._name);
在L第13帧动作
stop();
c.做一方块为遮罩层,图像设置影辑imageSet为空
d.第一帧动作空白帧
function linkClean(temp)
{
    var _l1 = temp;
    _l1 = String(_l1);
    var _l2 = 0;
    while (_l2 < _l1.length)
    {
        if (_l1.substr(_l2, 5) == "apos;")
        {
            _l1 = _l1.substr(0, _l2 - 1) + "\'" + _l1.substr(_l2 + 5);
        } // end if
        _l2++;
    } // end while
    _l2 = 0;
    while (_l2 < _l1.length)
    {
        if (_l1.substr(_l2, 4) == "amp;")
        {
            _l1 = _l1.substr(0, _l2 - 1) + "&" + _l1.substr(_l2 + 4);
        } // end if
        _l2++;
    } // end while
    return(_l1);
} // End of the function
numOfImage = 9;
widthOfImage = 190;
heightOfImage = 120;
gap = 3000;
leftMargin = 25;
topMargin = 25;
counter = 1;
myXML = new XML();
myXML.load("end.xml");
System.useCodepage = true;
_global.imageURL = new Array();
_global.link = new Array();
_global.targetFrame = new Array();
myXML.ignoreWhite = true;
myXML.onLoad = function (temp)
{
    var _l1 = _global;
    var _l2 = this;
    _l1.playType = Number(String(_l2.childNodes[0].childNodes[0]));
    _l1.gap = Number(String(_l2.childNodes[1].childNodes[0])) * 1000;
    for (i = 1; i <= numOfImage; i++)
    {
        _l1.imageURL[i] = _l2.childNodes[i + 1].childNodes[0].childNodes[0];
        _l1.link[i] = _l2.childNodes[i + 1].childNodes[1].childNodes[0];
        _l1.targetFrame[i] = _l2.childNodes[i + 1].childNodes[2].childNodes[0];
        link[i] = linkClean(link[i]);
    } // end of for
    gotoAndStop(2);
};
stop();
第二帧动作
function fun1()
{
    this[counter].gotoAndStop(1);
    counter++;
    if (counter == numOfImage + 1)
    {
        counter = 1;
    } // end if
    this[counter].gotoAndPlay(2);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?