I can’t seem to figure out how to instead of load external jpg’s, attachMovies that reside in the library with instance names mc1, mc2, etc. I did not write this code, simply trying to modify it, can anyone help?
#include "lmc_tween_as1.as"
stop();
//======================================================================
// OBJECTS
var menuElements = new Array();
var pictures = new Array();
pictures[0] = "mc1";
pictures[1] = this["mc2"];
pictures[2] = this["mc"+3];
pictures[3] = "image4_import.jpg";
pictures[4] = "image1_import.jpg";
pictures[5] = "image2_import.jpg";
pictures[6] = "image3_import.jpg";
pictures[7] = "image4_import.jpg";
pictures[8] = "image1_import.jpg";
pictures[9] = "image2_import.jpg";
var thumbs = new Array();
thumbs[0] = "thumb1.jpg";
thumbs[1] = "thumb2.jpg";
thumbs[2] = "thumb3.jpg";
thumbs[3] = "thumb4.jpg";
thumbs[4] = "thumb1.jpg";
thumbs[5] = "thumb2.jpg";
thumbs[6] = "thumb3.jpg";
thumbs[7] = "thumb4.jpg";
thumbs[8] = "thumb1.jpg";
thumbs[9] = "thumb2.jpg";
//======================================================================
// CONSTANTS
var CENTER_X = Stage.width / 2;
var CENTER_Y = Stage.height - 50;
var MENU_SIZE = pictures.length;
//======================================================================
// VARIABLES
_global.depthCount = 0;
var textDepth = depthCount * 2;
text.swapDepths(100);
var menuSpacing = 2;
//======================================================================
// PROTOTYPES
MovieClip.prototype.drawRoundRect = function(w, h, r, st, sc, fc) {
if(st != 0) this.lineStyle(st, sc);
this.beginFill(fc);
this.moveTo(r, 0);
this.lineTo(w-r, 0);
this.curveTo(w, 0, w, r);
this.lineTo(w, h-r);
this.curveTo(w, h, w-r, h);
this.lineTo(r, h);
this.curveTo(0, h, 0, h-r);
this.lineTo(0, r);
this.curveTo(0, 0, r, 0);
this.endFill();
}
//======================================================================
// FUNCTIONS
function nextDepth() {
_global.depthCount++;
return _global.depthCount;
}
function loadImage(imageName) {
with(imageHolder) {
_alpha = 0;
alphaTo(100, 0.5, "easeOutQuad", 0.5);
}
//imageHolder.loadMovie(imageName);
imageHolder.attachMovie(imageName);
imageHolder._parent.onEnterFrame = function() {
var total = Math.round(imageHolder.getBytesTotal() / 1024);
var loaded = Math.round(imageHolder.getBytesLoaded() / 1024);
if(total != 0 && loaded >= total) {
imageHolder.setMask(imageMask);
delete this.onEnterFrame;
}
};
}
//======================================================================
// GENERAL CODE
createEmptyMovieClip("imageMask", nextDepth());
imageMask._x = 25;
imageMask._y = 25;
createEmptyMovieClip("imageHolder", nextDepth());
imageHolder._x = 25;
imageHolder._y = 25;
imageMask.drawRoundRect(375, 170, 20, 0, 0xFFFFFF, 0x000000);
imageMask._alpha = 0;
loadImage(pictures[0]);
menuHolder = createEmptyMovieClip("menuHolder", nextDepth());
menuHolder._y = CENTER_Y;
menuHolder.onEnterFrame = function() {
var width = 0;
for(i = 0; i < MENU_SIZE; i++) {
var xxm = menuElements*._xmouse;
var yym = menuElements*._ymouse;
var xm = Math.sqrt(xxm * xxm + yym * yym);
if(xm < 50) {
menuElements*._xscale = menuElements*._yscale += ((200 - xm) - menuElements*._yscale) / 3;
} else {
menuElements*._xscale = menuElements*._yscale += (100 - menuElements*._yscale) / 3;
}
width += menuElements*._width;
}
width += (MENU_SIZE - 1) * menuSpacing;
var xpos = Math.round(CENTER_X - width / 2);
for(i = 0; i < MENU_SIZE; i++) {
xpos += menuElements[i - 1]._width / 2 + menuSpacing + menuElements*._width / 2;
menuElements*._x = xpos;
}
};
for(i = 0; i < MENU_SIZE; i++) {
menuItem = menuHolder.attachMovie("menuItem", "menu" + i, i);
menuItem._x = CENTER_X - ((MENU_SIZE - 1) * menuSpacing) + i;
menuItem.holder_mc.loadMovie(thumbs*);
menuItem.id = i;
menuItem.onRollOver = function() {
this._parent.selected = this;
this.gotoAndPlay("over");
};
menuItem.onRollOut = function() {
this.gotoAndPlay("out");
};
menuItem.onRelease = function() {
this._parent._parent.imageHolder.alphaTo(0, 0.5, "easeOutQuad", 0, {func: loadImage, args: [pictures[this.id]]});
};
menuElements.push(menuItem);
}
//======================================================================