# Get Width and Height from a properly load an external jpg

**URL:** https://forum.kirupa.com/t/get-width-and-height-from-a-properly-load-an-external-jpg/77176
**Category:** flash
**Created:** [January 25, 2005, 8:04am UTC](https://forum.kirupa.com/t/get-width-and-height-from-a-properly-load-an-external-jpg/77176 "2005-01-25T08:04:05Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![evilryu](https://avatars.discourse-cdn.com/v4/letter/e/e56c9b/32.png) [@evilryu](https://forum.kirupa.com/u/evilryu)
#### Post date: [January 25, 2005, 8:04am UTC](https://forum.kirupa.com/t/get-width-and-height-from-a-properly-load-an-external-jpg/77176/1 "2005-01-25T08:04:05Z")

</div>

Hi all, I know you may have stumbled on this topic before however I just can’t seem to find the definite solution for this issue. When an image is fully loaded, I can’t seem to get the image’s .\_width and .\_height properties. It gives me 0.

I am dynamically loading external jpg images into a createEmptyMovieClip method. When this is happenning, I am constantly checking for its progress and when fully loaded I should be able to obtain the new width and height of the movieclip that contains the image.

[color=blue]var refMainImg = this.createEmptyMovieClip(“img”+counter, counter);[/color]  
[color=blue]x.onEnterFrame = function()[/color][color=blue]{[/color]  
[color=blue]refMainImg.loadMovie(“myImg.jpg”);[/color]  
[color=blue]if(Math.round(refMainImg.[color=red]getBytesLoaded()[/color]/refMainImg.[color=red]getBytesTotal()[/color]) == 1)[/color]  
[color=blue]refMainImg[color=darkorange].\_x[/color] = refMainImg[color=darkorange].\_width[/color]/2;[/color]  
[color=blue]refMainImg[color=darkorange].\_y[/color] = refMainImg[color=darkorange].\_height[/color]/2;[/color]  
[color=blue]}[/color]  
[color=blue].[/color]  
[color=blue].[/color]  
[color=blue].[/color]  
[color=blue]}[/color]

[color=black]Can someone provide me feedback or if possible know the solution of this problem? Many thanx![/color]
