# JPG loads funny once on server

**URL:** <https://forum.kirupa.com/t/jpg-loads-funny-once-on-server/57352>\
**Category:** flash\
**Created:** [July 12, 2004, 4:58pm UTC](https://forum.kirupa.com/t/jpg-loads-funny-once-on-server/57352 "2004-07-12T16:58:38Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sandman9](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@Sandman9](https://forum.kirupa.com/u/Sandman9)\
**Post date:** [July 12, 2004, 4:58pm UTC](https://forum.kirupa.com/t/jpg-loads-funny-once-on-server/57352/1 "2004-07-12T16:58:38Z")

</div>

In the link below you will notice that when you single click on any of the images in the banner it loads the JPG funny. If you click it again then it loads it properly. Although in my fla file it works perfectly on first click. Anyone had a similar problem where files load funny once uploaded to a FTP?

I’ve attached my fla in case

[http://www.etmarketingsolutions.com/testing/newsite/works1.html](http://www.etmarketingsolutions.com/testing/newsite/works1.html)

Sandman9

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2004, 6:18pm UTC](https://forum.kirupa.com/t/jpg-loads-funny-once-on-server/57352/2 "2004-07-12T18:18:45Z")

</div>

Are you cheking for height and width somewhere during the loading?

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2004, 7:35pm UTC](https://forum.kirupa.com/t/jpg-loads-funny-once-on-server/57352/3 "2004-07-12T19:35:16Z")

</div>

Yes I am. Check out the fla, I attached it

Sandman9

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2004, 7:47pm UTC](https://forum.kirupa.com/t/jpg-loads-funny-once-on-server/57352/4 "2004-07-12T19:47:37Z")

</div>

> [@Sandman9](#):
>
> Yes I am. Check out the fla, I attached it…

Where? I only see a html page…

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2004, 8:27pm UTC](https://forum.kirupa.com/t/jpg-loads-funny-once-on-server/57352/5 "2004-07-12T20:27:34Z")

</div>

sorry

[www.sandmanmedia.com/et3.fla.zip](http://www.sandmanmedia.com/et3.fla.zip)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2004, 8:32pm UTC](https://forum.kirupa.com/t/jpg-loads-funny-once-on-server/57352/6 "2004-07-12T20:32:34Z")

</div>

no hard feelings;)  
I’ll have a look.

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2004, 8:40pm UTC](https://forum.kirupa.com/t/jpg-loads-funny-once-on-server/57352/7 "2004-07-12T20:40:58Z")

</div>

here’s the code

```auto

spacing = 5;
containerMC._alpha = 0;

MovieClip.prototype.loadPic = function(pic){
	_root.containerMC._alpha = 0;
	this.loadMovie(pic);
	_root.onEnterFrame = function(){
		var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
		if (t != 0 && Math.round(l/t) == 1){
			var w = containerMC._width + spacing, h = containerMC._height + spacing;
			border.resizeMe(w, h);
			delete _root.onEnterFrame;
		}
	}
};
MovieClip.prototype.resizeMe = function(w, h){
	var speed = 3;
	this.onEnterFrame = function(){
		this._width += (w - this._width)/speed;
		this._height += (h - this._height)/speed;
		if( Math.abs(this._width-w)<1){
			this._width = w;
			this._height = h;
			_root.containerMC._x = this._x - this._width/2 + spacing/2;
			_root.containerMC._y = this._y - this._height/2 + spacing/2;
                         _root.containerMC._alpha += 5;
			if(_root.containerMC._alpha>90){
			_root.containerMC._alpha = 100;
			
			delete this.onEnterFrame;
		}
	}
	}
};

```

It seems to be loading into the border MC for some reason

Sandman9

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2004, 8:41pm UTC](https://forum.kirupa.com/t/jpg-loads-funny-once-on-server/57352/8 "2004-07-12T20:41:15Z")

</div>

This should work:

```auto
spacing = 10;
containerMC._alpha = 0;
MovieClip.prototype.loadPic = function(pic) {
	_root.containerMC._alpha = 0;
	this.loadMovie(pic);
	this._parent.onEnterFrame = function() {
		var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
		//added checking for width and height 
		if (t != 0 && Math.round(l/t) == 1 && containerMC._width>0 && containerMC._height>0) {
			var w = containerMC._width+spacing, h = containerMC._height+spacing;
			border.resizeMe(w, h);
			delete this.onEnterFrame;
		}
	};
};
MovieClip.prototype.resizeMe = function(w, h) {
	var speed = 3;
	this.onEnterFrame = function() {
		this._width += (w-this._width)/speed;
		this._height += (h-this._height)/speed;
		//added height here in case only the height differs
		if (Math.abs(this._width-w)<1 && Math.abs(this.height-h)<1) {
			this._width = w;
			this._height = h;
			_root.containerMC._x = this._x-this._width/2+spacing/2;
			_root.containerMC._y = this._y-this._height/2+spacing/2;
			_root.containerMC._alpha += 5;
			if (_root.containerMC._alpha>90) {
				_root.containerMC._alpha = 100;
				delete this.onEnterFrame;
			}
		}
	};
};

```

The lines below the commented lines have been changed:)

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2004, 9:06pm UTC](https://forum.kirupa.com/t/jpg-loads-funny-once-on-server/57352/9 "2004-07-12T21:06:16Z")

</div>

Oops, a little typo:stunned:

```auto
if (Math.abs(this._width-w)<1 && Math.abs(this.height-h)<1) {

```

should be

```auto
if (Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1) {

```

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2004, 11:48pm UTC](https://forum.kirupa.com/t/jpg-loads-funny-once-on-server/57352/10 "2004-07-12T23:48:51Z")

</div>

Scotty you are good!!! Do you mind emptying out your cache and double checking if what you did worked?

[http://www.etmarketingsolutions.com/testing/newsite/works1.html](http://www.etmarketingsolutions.com/testing/newsite/works1.html)

Thanks!!  
Sandman9

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 8:33am UTC](https://forum.kirupa.com/t/jpg-loads-funny-once-on-server/57352/11 "2004-07-13T08:33:14Z")

</div>

no problem:)

I’ve checked and it worked=)

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 5:34pm UTC](https://forum.kirupa.com/t/jpg-loads-funny-once-on-server/57352/12 "2004-07-13T17:34:50Z")

</div>

Hey Scotty

Why did you change \_root.onEnterFrame… to this.\_parent.onEnterFrame… when it’s already on the main timeline?

What you did worked but I’m just trying to understand it now 🙂

Thanks  
Sandman9

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 5:54pm UTC](https://forum.kirupa.com/t/jpg-loads-funny-once-on-server/57352/13 "2004-07-13T17:54:58Z")

</div>

Out of habit:)  
In the original code \_root was used, but then people started loading the gallery in a main movie, so it had to be changed, cause it gave problems.

scotty(-:
