我有以下swf脚本:
//----------------------------------------------------------------------
//Frame 1
//----------------------------------------------------------------------
function layout_stage() {
sw = Stage.width;
sh = Stage.height;
center_obj(mcLoad);
tool_pos();
}
function center_obj(x) {
var _local3 = x._width;
var _local2 = x._height;
x._x = (sw - _local3) / 2;
x._y = (sh - _local2) / 2;
}
function tool_pos() {
var _local1 = mcTool._width;
var _local2 = mcs[1][1]._height;
mcTool._x = (sw - _local1) / 2;
mcTool._y = sh - 50;
}
function start_engine() {
setInterval(auto_rotate, 300);
init_scroll();
}
function init_engine() {
if ((!((passedVars = get_parameters()))) || (!varsTest())) {
err_msg("Bad parameters specified!");
} else {
var _local4 = 1;
while (_local4 <= Number(passedVars.rows)) {
var _local6 = new Array();
var _local2 = 1;
while (_local2 <= Number(passedVars.cols)) {
var _local5 = ((_local4 - 1) * passedVars.cols) + _local2;
var _local3 = _root.createEmptyMovieClip((("img" + _local4) + "_") + _local2, img_z + _local5);
_local3._visible = false;
_local3.idn = _local5;
imgLoader.loadClip(((((passedVars.path + passedVars.fname) + "_") + fill_zero(_local2, 2)) + ".") + passedVars.fext, _local3);
_local6[_local2] = _local3;
_local2++;
}
mcs[_local4] = _local6;
_local4++;
}
layout_stage();
show_load(mcs[ypos][xpos], null);
start_engine();
}
}
function rotate_img(xStep, yStep) {
var _local1 = mcs[ypos][xpos];
xpos = xpos + xStep;
ypos = ypos - yStep;
if (ypos > passedVars.rows) {
ypos = passedVars.rows;
}
if (ypos < 1) {
ypos = 1;
}
if (xpos > Number(passedVars.cols)) {
xpos = 1;
}
if (xpos < 1) {
xpos = Number(passedVars.cols);
}
if (!mcs[ypos][xpos].loadOk) {
show_load(mcs[ypos][xpos], _local1);
} else {
_local1._visible = false;
center_obj(mcs[ypos][xpos]);
mcs[ypos][xpos]._visible = true;
}
update_senzors();
updateAfterEvent();
}
function auto_rotate() {
if (((!dragging) && (mcs[ypos][xpos].loadOk)) && (auto_play != 0)) {
rotate_img(auto_play, 0);
}
}
function varsTest() {
var _local1 = true;
if (!passedVars.path) {
_local1 = false;
}
if (!passedVars.cols) {
_local1 = false;
}
if (!passedVars.rows) {
passedVars.rows = 1;
}
if (!passedVars.type) {
passedVars.type = "closed";
}
if (!passedVars.fname) {
passedVars.fname = "seq";
}
if (!passedVars.fext) {
passedVars.fext = "jpg";
}
if (!passedVars.autoplay) {
auto_play = 1;
} else {
auto_play = Number(passedVars.autoplay);
}
return(_local1);
}
function fill_zero(num, pos) {
var _local1 = "";
_local1 = String(num);
while (_local1.length < pos) {
_local1 = "0" + _local1;
}
return(_local1);
}
function get_parameters() {
var _local6 = _root._url;
var _local7 = _local6.lastIndexOf("?");
var _local4 = new Array();
var _local3 = new Array();
if (_local7 != -1) {
var _local8 = _local6.substring(_local7 + 1, _local6.length);
if (_local8 != "") {
_local3 = _local8.split("&");
for (var _local5 in _local3) {
var _local2 = _local3[_local5].split("=");
_local4[_local2[0]] = unescape(_local2[1]);
}
return(_local4);
}
} else {
return(0);
}
}
function c_echo(msg) {
_root.txt_console = _root.txt_console + msg;
}
function err_msg(msg) {
_root.errWnd.txt_msg = msg;
_root.errWnd._visible = true;
center_obj(_root.errWnd);
}
function show_load(mc, omc) {
center_obj(_root.mcLoader);
_root.mcLoader._visible = true;
loaderForMC = mc;
oldMC = omc;
}
function hide_load() {
_root.mcLoader._visible = false;
loaderForMC = null;
oldMC._visible = false;
oldMC = null;
}
function progress_load(lb, tb) {
var _local2 = (100 * lb) / tb;
_root.mcLoader.mcProgress._xscale = _local2;
updateAfterEvent();
}
function update_senzors() {
var _local1 = "";
if (Number(passedVars.rows) > 1) {
_local1 = ("[" + ypos) + "] ";
}
mcTool.txt_info = ((_local1 + xpos) + "/") + passedVars.cols;
if (sliderDrag == 0) {
mcTool.mcSlider._x = sliderMin + (xpos / sliderRatio);
}
}
function init_scroll() {
sliderRatio = Number(passedVars.cols) / sliderDif;
}
stop();
var dataPath = "";
errWnd._visible = false;
mcLoader._visible = false;
mcInfo._visible = false;
mcTool._visible = false;
mcInfo.swapDepths(1000);
mcTool.swapDepths(999);
mcLoader.swapDepths(998);
logo.swapDepths(1001);
var sw = Stage.width;
var sh = Stage.height;
Stage.scaleMode = "noScale";
Stage.align = "TL";
var resListener = new Object();
resListener.onResize = function () {
layout_stage();
};
Stage.addListener(resListener);
var imgLoader = new MovieClipLoader();
var loadedObjs = 0;
var loadListener = new Object();
loadListener.onLoadStart = function (mc) {
mc.loadOk = false;
};
loadListener.onLoadProgress = function (mc, loadedBytes, totalBytes) {
if (mc == loaderForMC) {
progress_load(loadedBytes, totalBytes);
}
};
loadListener.onLoadComplete = function (mc) {
mc._visible = false;
loadedObjs++;
layout_stage();
if (loadedObjs == 1) {
mcTool._visible = true;
}
};
loadListener.onLoadInit = function (mc) {
mc.loadOk = true;
if (mc == loaderForMC) {
hide_load();
}
center_obj(mc);
if (mc == mcs[ypos][xpos]) {
mc._visible = true;
}
};
loadListener.onLoadError = function (mc, err) {
err_msg(("Error: " + err) + newline);
};
imgLoader.addListener(loadListener);
var mcs = new Object();
var pos = 1;
var img_z = 10;
var passedVars = new Array();
var xpos = 1;
var ypos = 1;
var xcount;
var ycount;
var auto_play = 0;
var dragging = 0;
var xmouseStep = 32;
var ymouseStep = 64;
var oldx = _root._xmouse;
var oldy = _root._ymouse;
var mouseListener = new Object();
mouseListener.onMouseWheel = function (delta) {
};
mouseListener.onMouseDown = function () {
dragging = 1;
};
mouseListener.onMouseUp = function () {
dragging = 0;
};
mouseListener.onMouseMove = function () {
var _local2 = 0;
var _local3 = 0;
if (dragging == 1) {
dragging = 2;
oldx = _root._xmouse;
oldy = _root._ymouse;
}
if ((dragging == 2) && (sliderDrag != 1)) {
if ((_root._xmouse - oldx) < (-xmouseStep)) {
_local2 = -1;
}
if ((_root._xmouse - oldx) > xmouseStep) {
_local2 = 1;
}
if ((_root._ymouse - oldy) < (-ymouseStep)) {
_local3 = -1;
}
if ((_root._ymouse - oldy) > ymouseStep) {
_local3 = 1;
}
if ((_local2 != 0) || (_local3 != 0)) {
rotate_img(_local2, _local3);
oldx = _root._xmouse;
oldy = _root._ymouse;
}
}
};
Mouse.addListener(mouseListener);
var smallStep = 10;
var k_frameUp = 38;
var k_frameDown = 40;
var k_frameLeft = 37;
var k_frameRight = 39;
var k_pause = 32;
var k_play = 13;
var k_exitWnd = 27;
var keyListener = new Object();
keyListener.onKeyDown = function () {
switch (Key.getCode()) {
case k_frameRight :
rotate_img(-1, 0);
auto_play = 0;
return;
case k_frameLeft :
rotate_img(1, 0);
auto_play = 0;
return;
case k_frameUp :
rotate_img(0, 1);
auto_play = 0;
return;
case k_frameDown :
rotate_img(0, -1);
auto_play = 0;
}
};
keyListener.onKeyUp = function () {
switch (Key.getCode()) {
case k_play :
if (auto_play == 0) {
auto_play = 1;
} else {
auto_play = -auto_play;
}
return;
case k_pause :
auto_play = 0;
return;
case k_exitWnd :
getURL ("javascript: window.close()");
}
};
Key.addListener(keyListener);
var loaderForMC = null;
var oldMC = null;
var sliderMin = mcTool.mcSlider._x;
var sliderMax = (mcTool.mcSlider._x + 88);
var sliderDrag = 0;
var sliderDif = (sliderMax - sliderMin);
var sliderRatio;
var oldSlidePos = sliderMin;
mcTool.btnPause.onRelease = function () {
auto_play = 0;
};
mcTool.btnExit.onRelease = function () {
getURL ("javascript: window.close()");
};
mcTool.btnLeft.onRelease = function () {
auto_play = -1;
};
mcTool.btnRight.onRelease = function () {
auto_play = 1;
};
mcTool.btnFrameLeft.onRelease = function () {
rotate_img(-1, 0);
auto_play = 0;
};
mcTool.btnFrameRight.onRelease = function () {
rotate_img(1, 0);
auto_play = 0;
};
mcTool.btnWnd.onRelease = function () {
if (_root.mcInfo._visible) {
_root.mcInfo._visible = false;
} else {
center_obj(_root.mcInfo);
_root.mcInfo._visible = true;
}
};
mcTool.mcSlider.onPress = function () {
this.startDrag(false, sliderMin, this._y, sliderMax, this._y);
sliderDrag = 1;
};
mcTool.mcSlider.onRelease = function () {
this.stopDrag();
sliderDrag = 0;
};
mcTool.mcSlider.onEnterFrame = function () {
var _local2 = Math.round((this._x - oldSlidePos) * sliderRatio);
if ((sliderDrag == 1) && (_local2 != 0)) {
rotate_img(_local2, 0);
}
oldSlidePos = this._x;
};
init_engine();
//----------------------------------------------------------------------
//Symbol 11 MovieClip Frame 1
//----------------------------------------------------------------------
stop();
//----------------------------------------------------------------------
//Symbol 9 Button
//----------------------------------------------------------------------
on (release) {
getURL ("javascript: window.close()");
}
如果我像这样调用脚本,我需要弄清楚该文件的名称(即路径):
script.swf路径= /&安培;。COLS = 36&安培; FNAME =旋转
所以,我知道它正在从脚本所在的同一目录中加载一个flash影片,但我似乎无法想象它正在加载它,也不是我需要使用的电影名称来加载它。
答案 0 :(得分:0)
我明白了。如果有以下请求:
script.swf路径= /&安培;。COLS = 36&安培; FNAME =旋转
脚本将查找带有文件名的图像,从rotate_1.jpg到rotate_36.jpg,然后在框架中播放。
就这么简单。