# External SWF loading, using a fixed width

**URL:** https://forum.kirupa.com/t/external-swf-loading-using-a-fixed-width/186838
**Category:** flash
**Created:** [April 24, 2006, 10:45pm UTC](https://forum.kirupa.com/t/external-swf-loading-using-a-fixed-width/186838 "2006-04-24T22:45:22Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![CoDe\_ReD](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/code_red/32/336_2.png) [@CoDe\_ReD](https://forum.kirupa.com/u/CoDe_ReD)
#### Post date: [April 24, 2006, 10:45pm UTC](https://forum.kirupa.com/t/external-swf-loading-using-a-fixed-width/186838/1 "2006-04-24T22:45:22Z")

</div>

Hey,

I have a question about a simple application I’m trying to create with flash.  
First off, the app uses thumbnails of pictures. These thumbnails can be dragged and dropped onto a big movieclip, which then loads the external .jpg into itself. These thumbnails also have captions which get loaded into a dynamic textbox (instance name “txt\_hint”)  
Structure:  
I have a movieclip (instance name “mc\_viewer”), which functions as a hitarea for the draggable thumbnails and also as a container for the external photo’s.  
I have some code on the thumbnails:  
(Example of one thumbnail)

```auto

this.foto_naam = "foto3.jpg";
this.hint_text = "Skyline...";
this.original_x = this._x;
this.original_y = this._y;
this.onPress = function()
	{
		this.startDrag(true);
	};
this.onRollOver = function()
	{
		_root.txt_hint.text = this.hint_text;
	};
this.onRollOut = function()
	{
		_root.txt_hint.text = "";
	};
this.onRelease = function() 
	{
	this.stopDrag();
	if (this.hitTest(_root.mc_viewer))
		{
			_root.mc_viewer.loadMovie(foto_naam);
		};
	_root.mc_viewer._width = 400;
	this._x = original_x;
	this._y = original_y;
	};

```

So when I drag a thumbnail onto that mc\_viewer movieclip, the external file gets loaded and the thumbnail will automatically reset to its original location.  
Now the problem is that I want these external .jpg files to resize automatically when they are loaded. I want the width to be 400 pixels. The example I’m using here is working, but only one bug exists. The first time I drag and drop a thumbnail into the mc\_viewer movieclip, it doesn’t get resized. After that first time everything works how it’s supposed to work.

How can I kill that nasty bug?

Thnx in advance,  
Code-red.

P.S. If this doesn’t make any sense… I can post a zip file with all of the stuff (.fla, .jpg) in there.

---

<div class="post-metadata">

### Author: ![CoDe\_ReD](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/code_red/32/336_2.png) [@CoDe\_ReD](https://forum.kirupa.com/u/CoDe_ReD)
#### Post date: [April 25, 2006, 1:17pm UTC](https://forum.kirupa.com/t/external-swf-loading-using-a-fixed-width/186838/2 "2006-04-25T13:17:23Z")

</div>

Ok [here](http://members.home.nl/nielskreijveld/Opdracht1.zip) is the .zip file, maybe that will help.

---

<div class="post-metadata">

### Author: ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)
#### Post date: [April 26, 2006, 7:15am UTC](https://forum.kirupa.com/t/external-swf-loading-using-a-fixed-width/186838/3 "2006-04-26T07:15:15Z")

</div>

> [@CoDe-ReD](#):
>
> Ok [here](http://members.home.nl/nielskreijveld/Opdracht1.zip) is the .zip file, maybe that will help.

on the main timeline

```auto
mc_viewer.createEmptyMovieClip("p",1)

```

in you external file

```auto
this.original_x = this._x;
this.original_y = this._y;
this.onPress = function() {
	this.startDrag(true);
};
this.onRollOver = function() {
	_root.txt_hint.text = this.hint_text;
};
this.onRollOut = function() {
	_root.txt_hint.text = "";
};
this.onRelease = function() {
	this.stopDrag();
	if (this.hitTest(_root.mc_viewer)) {
		_root.mc_viewer.p.loadMovie(foto_naam);
		this.onEnterFrame = function() {
			if (_root.mc_viewer.p._width) {
				trace(1)
				_root.mc_viewer.p._width = 400;
				_root.mc_viewer.p._height =300 
				delete this.onEnterFrame;
			}
		};
	}
	this._x = original_x;
	this._y = original_y;
};

```
