windir
04-21-2009, 09:35 PM
Ok so I am loading a "portfolio.swf" into my "index.swf". I have my gallery loading my XML and it parses just fine. My problem is when I'm trying to have a preloader that is located in the _root of the index.swf, using loadMovie(image[this.id]); isn't finding the image or .swf I'm try to add to stage.
Here are some snippets of the code that I'm using in each section:
This is the portfolio.swf loading XML:
onEnterFrame = function () {
loading = (image[this.id]).getBytesLoaded();
filesize = (image[this.id]).getBytesTotal();
};
if (filesize>10) {
percentage = Math.round((loading/filesize)*100);
} else {
percentage = 0;
}
percentage = _root.preloader_mc.displayPercentage.text;
/////////////Load Category Data/////////////
images = new XML();
images.ignoreWhite = true;
images.onLoad = function(success) {
if (success) {
xmlNode = this.firstChild;
image = [];
thumb = [];
roll_over = [];
Xloc = [];
Yloc = [];
_global.desc = [];
total = xmlNode.childNodes.length;
for (var i = 0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
thumb[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
_global.desc[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
roll_over[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
Xloc[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;
Yloc[i] = xmlNode.childNodes[i].childNodes[5].firstChild.nodeValue;
holder_mc.attachMovie("thumb","butj"+i,i+999);
holder_mc["butj"+i].thumb_mc._alpha = 0;
holder_mc["butj"+i].id = i;
holder_mc["butj"+i]._x = i%5*140+25;
holder_mc["butj"+i]._y = Math.floor(i/5)*90;
holder_mc["butj"+i].thumb_mc.loadMovie(thumb[i],1);
MoveNav = new Tween(holder_mc["butj"+i].thumb_mc, "_alpha", Strong.easeOut, holder_mc["butj"+i].thumb_mc._alpha, 100, 1, true);
holder_mc["butj"+i].onRollOver = function() {
MoveNav = new Tween(holder_mc["butj"+[this.id]].thumb_mc, "_alpha", Strong.easeOut, holder_mc["butj"+[this.id]].thumb_mc._alpha, 50, 0.5, true);
};
holder_mc["butj"+i].onRollOut = function() {
MoveNav = new Tween(holder_mc["butj"+[this.id]].thumb_mc, "_alpha", Strong.easeOut, holder_mc["butj"+[this.id]].thumb_mc._alpha, 100, 3, true);
};
holder_mc["butj"+i].onRelease = function() {
_global.desc[z] = _global.desc[this.id];
_global.image[1] = _global.image[this.id];
_root.big_symbol._width = Stage.width+30;
_root.big_symbol._height = Stage.height+30;
_root.big_symbol._x = 0;
_root.big_symbol._y = 0;
_root.big_symbol._visible = true;
trace(image[this.id]);
_root.preloader_mc.gotoAndStop(2);
var tweenAlphaPreloader:Tween = new Tween(_root.preloader_mc, "_alpha", Strong.easeIn, 100, 0, 1, true);
tweenAlphaPreloader.stop();
contentLoaded = function () {
tweenAlphaPreloader.start();
tweenAlphaPreloader["onMotionFinished"] = function () {
};
};
And here is what I have the preloader doing:
if (percentage == 100) {
var tweenAlphaPreloader:Tween = new Tween(_parent.preloader_mc, "_alpha", Strong.easeIn, 100, 0, 1, true);
tweenAlphaPreloader.stop();
tweenAlphaPreloader.start();
tweenAlphaPreloader["onMotionFinished"] = function () {
_parent.swfHolder.loadMovie(image[this.id]);
};
}
When I play the move like this, I'm getting "undefined" for the loadMovie.
Any help is greatly appreciated!
Here are some snippets of the code that I'm using in each section:
This is the portfolio.swf loading XML:
onEnterFrame = function () {
loading = (image[this.id]).getBytesLoaded();
filesize = (image[this.id]).getBytesTotal();
};
if (filesize>10) {
percentage = Math.round((loading/filesize)*100);
} else {
percentage = 0;
}
percentage = _root.preloader_mc.displayPercentage.text;
/////////////Load Category Data/////////////
images = new XML();
images.ignoreWhite = true;
images.onLoad = function(success) {
if (success) {
xmlNode = this.firstChild;
image = [];
thumb = [];
roll_over = [];
Xloc = [];
Yloc = [];
_global.desc = [];
total = xmlNode.childNodes.length;
for (var i = 0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
thumb[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
_global.desc[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
roll_over[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
Xloc[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;
Yloc[i] = xmlNode.childNodes[i].childNodes[5].firstChild.nodeValue;
holder_mc.attachMovie("thumb","butj"+i,i+999);
holder_mc["butj"+i].thumb_mc._alpha = 0;
holder_mc["butj"+i].id = i;
holder_mc["butj"+i]._x = i%5*140+25;
holder_mc["butj"+i]._y = Math.floor(i/5)*90;
holder_mc["butj"+i].thumb_mc.loadMovie(thumb[i],1);
MoveNav = new Tween(holder_mc["butj"+i].thumb_mc, "_alpha", Strong.easeOut, holder_mc["butj"+i].thumb_mc._alpha, 100, 1, true);
holder_mc["butj"+i].onRollOver = function() {
MoveNav = new Tween(holder_mc["butj"+[this.id]].thumb_mc, "_alpha", Strong.easeOut, holder_mc["butj"+[this.id]].thumb_mc._alpha, 50, 0.5, true);
};
holder_mc["butj"+i].onRollOut = function() {
MoveNav = new Tween(holder_mc["butj"+[this.id]].thumb_mc, "_alpha", Strong.easeOut, holder_mc["butj"+[this.id]].thumb_mc._alpha, 100, 3, true);
};
holder_mc["butj"+i].onRelease = function() {
_global.desc[z] = _global.desc[this.id];
_global.image[1] = _global.image[this.id];
_root.big_symbol._width = Stage.width+30;
_root.big_symbol._height = Stage.height+30;
_root.big_symbol._x = 0;
_root.big_symbol._y = 0;
_root.big_symbol._visible = true;
trace(image[this.id]);
_root.preloader_mc.gotoAndStop(2);
var tweenAlphaPreloader:Tween = new Tween(_root.preloader_mc, "_alpha", Strong.easeIn, 100, 0, 1, true);
tweenAlphaPreloader.stop();
contentLoaded = function () {
tweenAlphaPreloader.start();
tweenAlphaPreloader["onMotionFinished"] = function () {
};
};
And here is what I have the preloader doing:
if (percentage == 100) {
var tweenAlphaPreloader:Tween = new Tween(_parent.preloader_mc, "_alpha", Strong.easeIn, 100, 0, 1, true);
tweenAlphaPreloader.stop();
tweenAlphaPreloader.start();
tweenAlphaPreloader["onMotionFinished"] = function () {
_parent.swfHolder.loadMovie(image[this.id]);
};
}
When I play the move like this, I'm getting "undefined" for the loadMovie.
Any help is greatly appreciated!