# MovieClip Width

**URL:** https://forum.kirupa.com/t/movieclip-width/218894
**Category:** flash
**Created:** [March 12, 2007, 8:09am UTC](https://forum.kirupa.com/t/movieclip-width/218894 "2007-03-12T08:09:03Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ronenuliel](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@ronenuliel](https://forum.kirupa.com/u/ronenuliel)
#### Post date: [March 12, 2007, 8:09am UTC](https://forum.kirupa.com/t/movieclip-width/218894/1 "2007-03-12T08:09:03Z")

</div>

**hello!**  
can someone help?  
i’ve been trying to solve this problem for a few days:

i have an array of MovieClips that contains external images.  
i’m trying to find what is the width of a certain image/movieclip in that array.

i used duplicatMovieClip when i created the array and loaded the images in it.  
for example:

in frame 1:

[COLOR=darkorchid]var NumberOfImages = 17;[/COLOR]  
[COLOR=darkorchid]var LocationToImages = “INSPIRATION/”;[/COLOR]  
[COLOR=darkorchid]var FileType = “.jpg”;[/COLOR]  
[COLOR=darkorchid]var imgSHOW = 16; //(or any other random number)[/COLOR]  
[COLOR=darkorchid]var mc = 1;[/COLOR]  
[COLOR=darkorchid]while (mc \<= \_root.NumberOfImages) {[/COLOR]  
[COLOR=darkorchid]MyArray2[mc] = \_root.LocationToImages+mc+\_root.FileType;[/COLOR]  
[COLOR=darkorchid]MyArray2[“newCONT” + mc] = duplicateMovieClip(“CONT”,“newCONT”+mc,mc);[/COLOR]  
[COLOR=darkorchid]loadMovie(MyArray2[mc], “newCONT” + mc);[/COLOR]  
[COLOR=darkorchid]mc++;[/COLOR]  
[COLOR=darkorchid]}[/COLOR]

NOW I WANT TO GET the width of a certain MovieClip - BUT IT RETURNS - 0 (ZERO)  
(as if refering to the original empty MovieClip (“CONT”))  
look:

[COLOR=darkorchid]if (mc \> \_root.NumberOfImages) {[/COLOR]  
[COLOR=darkorchid]imgSHOW = Math.floor(Math.random()\*(\_root.NumberOfImages))+ 1;[/COLOR]  
[COLOR=darkorchid]wid = \_root.INSP[“newCONT”+imgSHOW].\_width; [/COLOR][COLOR=red] **// this is the problematic line** [/COLOR]  
}

[COLOR=red]NOTE: [/COLOR]  
**this line works well** when being called from a button release (in the same scene):

[COLOR=darkorchid]on (release) { [/COLOR]  
[COLOR=darkorchid]WID = \_root.INSP[“newCONT”+imgSHOW].\_width;[/COLOR]  
[COLOR=darkorchid]}[/COLOR]

**[COLOR=red]WHY CAN’T I GET THE WIDTH In the first frame in the exact same??[/COLOR]**

PLEASE HELP.  
(i feel that the solution is not that complicated…)

Thanks a lot!  
Ronen  
[ronenuliel@gmail.com](mailto:ronenuliel@gmail.com)
