PDA

View Full Version : Loaded picsGallery inside main.swf doesn't load pics


StArXpLoSeR
11-14-2003, 05:17 AM
I have a Main movie with a navigation bar.. and i load external swf into a mc called "content_mc". All my movie work so far but now, i'm loading my gallery.swf in the content_mc, it appears but doesn't load my pictures... ( on my picsGallery, I load all my JPGs dynamicaly) but when I test the gallery.swf alone it works... what is my problem? here is my code


//myPicsGallery is called: teacherspics.swf which is in a "teachers" folder..


on (release) {
gotoandplay ("library")
loadmovie("/teachers/teacherspics.swf",content)

}
/*
this code is pretty simple and worked for me so far...
should i use an other method
(Sorry, English isn't my native Language)
Thank you


Do you need the code of the teacherspics.swf ?

if you do here it is :
*/
// "sized/" is my folder path....MC instance is "photo"
//stagewidth/2:
var absX = 315;
//stageheight/2:
var absY = 150;
this.pathToPics = "";
this.pArray = ["1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg", "7.jpg", "8.jpg", "9.jpg", "10.jpg", "11.jpg", "12.jpg", "13.jpg", "14.jpg", "15.jpg", "16.jpg", "17.jpg", "18.jpg", "19.jpg", "20.jpg", "21.jpg", "22.jpg", "23.jpg", "24.jpg", "25.jpg", "26.jpg", "27.jpg", "28.jpg", "29.jpg", "30.jpg", "31.jpg"];
this.fadeSpeed = 50;
this.pIndex = 0;
//loading en setting x/y for first picture
loadMovie(this.pathToPics+this.pArray[0], _root.photo);
_root.photo._x = absX-170;//first picture = 700 width
_root.photo._y = absY-70;//first picture = 456 height
MovieClip.prototype.changePhoto = function(d) {
this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex<0) {
this.pIndex += this.pArray.length;
}
this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
}
};
MovieClip.prototype.loadPhoto = function() {
var p = _root.photo;
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
var i, l, t;
l = this.photo.getBytesLoaded();
t = this.photo.getBytesTotal();
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
this.photo._x = absX-this.photo._width/2;
this.photo._y = absY-this.photo._height/2;
} else {
//trace(l/t);
}
};
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
}
};
this.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
this.changePhoto(-1);
} else if (Key.getCode() == Key.RIGHT) {
this.changePhoto(1);
}
};
Key.addListener(this);


thank you

farafiro
11-16-2003, 06:04 AM
when u load a swf into another MC or swf, and use the word "_root" in it, it referes to the MAIN TIME LINE which it's loaded into,not its time line
so, either change all the "_root" to this
or add this script into the first line of itthis._lockroot = true

StArXpLoSeR
11-17-2003, 01:58 PM
thank you so much, i'm gonna try right now!
thank you again