# Get width

**URL:** <https://forum.kirupa.com/t/get-width/184132>\
**Category:** Uncategorized\
**Created:** [April 2, 2006, 3:32pm UTC](https://forum.kirupa.com/t/get-width/184132 "2006-04-02T15:32:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![g5604](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@g5604](https://forum.kirupa.com/u/g5604)\
**Post date:** [April 2, 2006, 3:32pm UTC](https://forum.kirupa.com/t/get-width/184132/1 "2006-04-02T15:32:08Z")

</div>

Hi,

i am trying to get the width of a movie i am loading.

so i load my movie:

```php
load_container.loadMovie(this.mySWF);

```

and then try to trace the width:

```php
trace(load_container._width);

```

but it comes out as 0??

any ideas?

---

<div class="post-metadata">

**Author:** ![gvozden](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/gvozden/32/1084_2.png) [@gvozden](https://forum.kirupa.com/u/gvozden)\
**Post date:** [April 2, 2006, 3:56pm UTC](https://forum.kirupa.com/t/get-width/184132/2 "2006-04-02T15:56:23Z")

</div>

it works when movie is loaded  
so get width after movie is loaded

I used it a lot for static width movies that are loaded dynamicly and I found out for me best way is to define their widths in XML

---

<div class="post-metadata">

**Author:** ![g5604](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@g5604](https://forum.kirupa.com/u/g5604)\
**Post date:** [April 2, 2006, 4:00pm UTC](https://forum.kirupa.com/t/get-width/184132/3 "2006-04-02T16:00:19Z")

</div>

> [@gvozden](#):
>
> it works when movie is loaded  
> so get width after movie is loaded
> 
> I used it a lot for static width movies that are loaded dynamicly and I found out for me best way is to define their widths in XML

thank you, i am using xml, so i guess have to add in a attribute.

---

<div class="post-metadata">

**Author:** ![Bokke](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@Bokke](https://forum.kirupa.com/u/Bokke)\
**Post date:** [April 2, 2006, 4:22pm UTC](https://forum.kirupa.com/t/get-width/184132/4 "2006-04-02T16:22:17Z")

</div>

No, no need for xml!  
You just heve to wait till its loaded! 😃

```auto
path.loadMovie("myMovie.swf");
this.onEnterFrame = function(){
    if (path.getBytesLoaded() == path.getBytesTotal() || path.getBytesLoaded() > 10){
        trace(path._width);
        delete this.onEnterFrame;
    }
}

```

---

<div class="post-metadata">

**Author:** ![g5604](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@g5604](https://forum.kirupa.com/u/g5604)\
**Post date:** [April 2, 2006, 4:34pm UTC](https://forum.kirupa.com/t/get-width/184132/5 "2006-04-02T16:34:03Z")

</div>

thank you works perfectly!!

---

<div class="post-metadata">

**Author:** ![Bokke](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@Bokke](https://forum.kirupa.com/u/Bokke)\
**Post date:** [April 2, 2006, 4:45pm UTC](https://forum.kirupa.com/t/get-width/184132/6 "2006-04-02T16:45:50Z")

</div>

welcome :rambo:

---

<div class="post-metadata">

**Author:** ![gvozden](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/gvozden/32/1084_2.png) [@gvozden](https://forum.kirupa.com/u/gvozden)\
**Post date:** [April 2, 2006, 5:32pm UTC](https://forum.kirupa.com/t/get-width/184132/7 "2006-04-02T17:32:55Z")

</div>

be prepared that in browsers like opera and firefox  
which don’t give right return for bytes loaded and bytes total for first loading you get scrambled movieclips

testing on machine works good but on server shows some scrambling  
after reloading everything works perfectly

I don’t say it wont work  
I say test it in these browsers on server

---

<div class="post-metadata">

**Author:** ![g5604](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@g5604](https://forum.kirupa.com/u/g5604)\
**Post date:** [April 2, 2006, 5:38pm UTC](https://forum.kirupa.com/t/get-width/184132/8 "2006-04-02T17:38:31Z")

</div>

i am using this in a offline application, so sould not be a problem… thank you for the information anyway.
