A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: how to get size of imported jpeg?

  1. #1
    Senior Member
    Join Date
    Aug 2001
    Posts
    102

    how to get size of imported jpeg?

    i use this code to import a picture to the stage:
    this.createEmptyMovieClip("jpg", 0);
    jpg.loadMovie("images/1.jpg");

    i can see the picture on the stage after the code executes, but why is jpg._width always = 0?

    thanks.

  2. #2
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    Try checking it after is has been loaded.
    code:

    onEnterFrame=function(){
    bytesTot = _root.jpg.getBytesTotal()
    bytesLoad = _root.jpg.getBytesLoaded()
    if(bytesLoad == bytesTot){
    trace(jpg._width)
    }
    }

    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  3. #3
    Senior Member
    Join Date
    Aug 2001
    Posts
    102
    yeah thanks. that was the problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center