JPEG Dynamic Loading Help

Hey All,
I searched through the forums and I couldn’t find anything that could help me.

I used the code in the tutorial on loading jpeg images, the one with bush holding the presidency for dumbies book.

_root.createEmptyMovieClip(“container”,1);
container.loadMovie(“photo.jpg”);
container._x = container._y = 0 ;

_root.onMouseDown = function () {
startDrag (“container”,false) ;
}
_root.onMouseUp = function () {
stopDrag () ;
}

Anyway, that’s the only picture I can get to show? I replaced “photo.jpg” with “test.jpg” and a couple others, and none of them would show up, only “photo.jpg”

I can’t figure out what’s going on? I have photoshop, am I not saving the images in the right format? Please help! I’m desperate.

Thanks, Anthony.

It should work.

Are your images in the same folder as your .swf file?

Yes, the exact same folder. Here’s another bit of information that might help you:

If I alter the bush picture in photoshop and then save it; it won’t display??

the images are in RGB?

Yep… the color setting is “web graphics default”

Am I crazy?

i just did it. check it out. this was my code. yours is a lot alike so it should work.


// Create empty movie clip and set location
_root.createEmptyMovieClip("image_mc", 0);
image_mc._x = 50;
image_mc._y = 50;
image_mc._xscale = 50;
image_mc._yscale = 55;
// Button event handler
load_btn.onRelease = function() {
	// Load image
	image_mc.loadMovie(filename_txt.text);
}

but here, you cant use CKMY jpg’s and they cannot be Progressive jpg’s. inother words it cant load in pieces.

but this is how mine turned out, and btw, the image must be on your server.

http://www.geocities.com/mdipi2k2/imagetest.htm

so your code is to drag it? hmmm, i dont know. but i got mine to work… i will try to add a drag in mine.

well i gotta go, but when i get back, i think it is just a few more lines of code then i got it. so i will post it when done.

i added

image_mc.onMouseDown = function() {
      startDrag(image_mc,flase)
}

which in theory should have worked correct? but i guess i need an instance name, yet cant give one because there is no MC to give it to. so i suppose that is what is happening to you.

The images were saved progressively; the weren’t mine and I didn’t know.

Sweet. Thanks for the help.

mdipi…

image_mc.onMouseDown = function() {
this.startDrag(image_mc,flase);
}

so, all you’re missing is this.

it was that simple! haha! and the book i am reading says something about remembering the this!

Andrew no problem,glad i could help :P.

Montoya, i tryed the code and ented it under my existing code. but that just makes the button not work. its no big deal, i was just playing around with this. just wanted to let you know.

that’s because I answered that one without looking. I was too busy practicing my sword skills (with my left hand, of course! That’s why Im smiling) <------ movie reference!

I would’ve done like this:


mymc.onPress=function(){
	mymc.startdrag();
}
mymc.onRelease=function(){
	mymc.stopdrag();
}


if you are putting code on the actual mc:


on(press){
this.startdrag();
}
on(release){
this.stopdrag();
}

sorry for the mixup.

Princess bride fanatic huh? Def a good flick…

no big deal, but thanks for the clarifaction.

mymc.onPress=function(){
	mymc.startdrag();
}
mymc.onRelease=function(){
	mymc.stopdrag();
}

i believe it should work with “this” Inigo:

mymc.onPress=function(){
	this.startdrag();
}
mymc.onRelease=function(){
	this.stopdrag();
}

It works with either or.

lol i am lost(not inbeta). i will just stick with learning to code…

lol, yeah, you will build yourself up to that point :slight_smile: