-
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!
-
Senior Member
- The right of the People to create Flash movies shall not be infringed. -
-
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.
-
Senior Member
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. -
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|