all groups > flash actionscript > april 2006 >
You're in the

flash actionscript

group:

loading external jpeg


loading external jpeg hushhurt
4/29/2006 6:49:19 PM
flash actionscript:
hello, i am new to actionscript, so please bear with me. I am trying to load
an external jpeg list and having issues. here is the code:

i am not sure what the issue is - the first slide displays fine, but everytime
i click the next button, it just flashes and shows the first slide again.

help!

david

var sildeInfoLV:LoadVars = new LoadVars ();
slideInfoLV.load("vars/slide_info.txt"); //loading txt document that gives the
number of slides

var curFrameNum:Number = 0;

function loadFrame() {
_level0.myMCL.loadClip ("frames/frames" + curFrameNum + ".jpg",
this.framesMC);
}
loadFrame();

//next slide btn\\

this.nextSlideBtn.onRelease = function() {
if (curFrameNum < Number(slideInfoLV.totalFrames) - 1) {
curFrameNum++;
} else {
curFrameNum = 0;
}
loadFrame();
}
Re: loading external jpeg kglad
4/29/2006 9:52:49 PM
Re: loading external jpeg hushhurt
4/29/2006 11:32:09 PM
it says it is undefind.
i checked the text file, which is in the "vars" folder that is in the same folder as the swf file - and it states "totalFrames=10"

Re: loading external jpeg kglad
4/30/2006 4:39:34 PM
Re: loading external jpeg hushhurt
5/1/2006 11:36:45 PM
ok - so i did an onLoad handler: slideInfoLV.onLoad = handleLoad;
function handleLoad (success) {
if (success) {
trace ("loaded info");
}
else {
trace ("not loaded info")
}
}
handleLoad();

and it traced "not loaded info"
i have the vars folder in the same directory as my published .swf file.
i had this problem earilier with an external css style sheet - is it my comp?
Re: loading external jpeg kglad
5/2/2006 6:11:47 AM
Re: loading external jpeg hushhurt
5/2/2006 11:11:16 PM
ok - this is the last stab i'm gonna have at it. everything is in the same
directory as my swf file.
on my "_level0.myMCL.loadClip ("frames/frames" + curFrameNum + ".jpg",
this.framesMC);" line. if i replace the var "curFrameNum" and manualy place the
jpg name i.e. frames1.jpg, frames2.jpg, etc. it will display each jpg.

but when i change the "var curFrameNum:Number = 0;" line to read "= 1" or "=2"
it give me a blank screen.

does this help at all - i feel like im running around in circles :)

Re: loading external jpeg kglad
5/3/2006 5:44:06 PM
well, everything isn't in the same folder as your swf file. your html and swf
files are in a folder and your jpg's are in a subfolder called frames, correct?
and your text file (which is the problem) should be located in another
subfolder called vars. where is it located?


Re: loading external jpeg hushhurt
5/3/2006 7:42:18 PM
correct - they are in sub folders. the pictures are in a subfolder label
"frames" and the text file is in a subfolder labeled "vars" I thought it was an
higharchy issue with subfolders - so i ommited the "vars" in
"vars/slide_info.txt" and placed the .txt file directly into the folder with my
published swf.

should i try and place all my files directly into the folder where my
published swf is? (including all the jpgs)
Re: loading external jpeg kglad
5/4/2006 3:10:55 AM
it's not necessary to use the same folder for everything, but it is necessary
to use the correct path when things are in a different folder.

but make sure your vars/slide_info.txt contains the info it should contain and
make sure it looks like the following:

&totalFrames=10&

AddThis Social Bookmark Button