typeofdoug
Programmer
I've created (with help) a series of buttons that scroll a movieClip's x-position according to an arrayIndex. With variables, these buttons also cycle through their up and down state as the user clicks from one to the next. I'd like for them to also load an external flash movie into a "loader" movie clip. More precisely, a different external swf for each button.
I don't know how to include the loadMovie script into the (beyond my skills) action script that controls my x-postion buttons. I've tried to write the bellow code for each button, but it stops my x-position scroll.
I know this is not vert clear. Here is my complete code.
Here is a link to my file
<
I'll appreciate any help you are able to offer and am happy to answer questions if you need me to be more clear. Thanks
I don't know how to include the loadMovie script into the (beyond my skills) action script that controls my x-postion buttons. I've tried to write the bellow code for each button, but it stops my x-position scroll.
Code:
controller_mc.but1.onRelease = function() {
loadMovie("chapterTest.swf", "_root.loader");
};
I know this is not vert clear. Here is my complete code.
Code:
//finds current x pos and sets speed to new x pos
Movieclip.prototype.scrollme1 = function(xPos) {
cX = this._x;
difX = cX-xPos;
this._x = cX-(difX/5);
};
Movieclip.prototype.scrollme2 = function(xPos) {
cX = this._x;
difX = cX-xPos;
this._x = cX-(difX/6);
};
//the three timline arrays
//variable starting value
arrayIndex = 0;
//timeline stopping postions
timeline1Xpos = new Array(2800, 2100, 1400, 700, 0, -700, -1400, -2100, -2800);
//scrolling animation
timeline1.onEnterFrame = function() {
this.scrollme1(timeline1Xpos[arrayIndex]);
};
//variable starting value
arrayIndex = 0;
//timeline stopping postions
timeline2Xpos = new Array(2800, 2100, 1400, 700, 0, -700, -1400, -2100, -2800);
//scrolling animation
timeline2.onEnterFrame = function() {
this.scrollme2(timeline2Xpos[arrayIndex]);
};
//buttons that scroll the timeline to specific x positions
//but1,2,3,4,5,6,7,8, all here
for (var i = 1; i<=8; i++) {
controller_mc.but1.gotoAndStop("down");
controller_mc["but"+i].i = i;
controller_mc["but"+i].onRollOver = function() {
this.frameHold = this._currentframe;
this.gotoAndStop("over");
};
controller_mc["but"+i].onRollOut = function() {
this.gotoAndStop(this.frameHold);
};
controller_mc["but"+i].onRelease = function() {
butRelease(this);
};
}
function butRelease(obj) {
this = obj;
arrayIndex = this.i-1;
for (var mc in this._parent) {
var thisHold = this;
if ((this._parent[mc] == thisHold) && (this._parent[mc]._name.indexOf("but") != -1)) {
this._parent[mc].gotoAndStop("down");
} else {
this._parent[mc].gotoAndStop("up");
}
}
this.frameHold = this._currentframe;
}
//timeline forward and backward buttons
controller_mc.goForward.onRelease = function() {
if (arrayIndex<7) {
butRelease(this._parent["but"+(arrayIndex+2)]);
}
};
controller_mc.goBack.onRelease = function() {
if (arrayIndex>0) {
butRelease(this._parent["but"+(arrayIndex)]);
}
};
//external links
controller_mc.but1.onRelease = function() {
loadMovie("chapterTest.swf", "_root.loader");
};
timeline1.link01.onRelease = function() {
loadMovie("linkTest.swf", "_root.loader");
};
Here is a link to my file
<
I'll appreciate any help you are able to offer and am happy to answer questions if you need me to be more clear. Thanks