A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Image loader - width/height

  1. #1
    Junior Member
    Join Date
    Dec 2007
    Posts
    15

    Image loader - width/height

    I'm working on an image gallery: thumbnails + big image.

    The big image needs to be resized, and I've already got a nice resize function, that's not the problem.

    The problem is, once I resize the Loader, and then load a new image, it doesn't overwrite the set width/height with the new values.

    1: Load first image
    2: Resize image
    3: On click -> load second image
    4: Resize second image

    For step 4 to work, I need the width/height of the original second image, but I can only get the width/height of step 2.

    Anyone got an idea how to fix this? Thanks!

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    How do you resize?
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  3. #3
    Junior Member
    Join Date
    Dec 2007
    Posts
    15
    I just set the width and height values. To test, I'm using this:

    Code:
    myLoader.width /= 2;
    myLoader.height /= 2;
    It works, but when I load the next image, it uses those values and not the actual new image values. So basicaly when I load the second image, it has the size of the first image / 4. When I load the third image, it has the size of the first image / 8.


    [edit]
    Ps: this is not my actual resize code, I just use this to test.

  4. #4
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Don't use the direct variable, because that will hold the value before loading the mage. Use event.currentTarget.content or event.currentTarget.content .parent
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  5. #5
    Junior Member
    Join Date
    Dec 2007
    Posts
    15
    That fixed it in less than 2 minutes, I love you! Haha thanks man.

    I'm glad it works now, though I don't really understand why it works... event.currentTarget.content is the same as the Loader itself, right? So why doesn't it overwrite that value?

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