| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| DesignersTalk > resizing movieclips to fit dynamically loaded images using actionscript? |
|
LinkBack | Thread Tools | Search this Thread |
|
|
#1 (permalink) |
|
i still want paying
Join Date: Oct 2003
Location: newcastle, uk
Posts: 4,713
|
resizing movieclips to fit dynamically loaded images using actionscript?
ie anyone got any ideas / links on how to do this? I kinda have it working, but not well enough (www.grahammorley.com/nicola ) sometimes the mc resizes before the image loads.. Im using getBytesLoaded and getBytesTotal atm.. its just so much better on that french site cheers gray |
|
|
|
|
|
#4 (permalink) |
|
Notorious?
|
You're in luck - i just made a photo album last night that dynamically loaded images into a holder movieclip. I'll give an explanation my best shot: Okay, here is the basic process you need (other than preloaders, which your site could use IMHO): 1) Click a button which has the handler function show(picString) 2) In the show function, you create an empty movie clip called holder (_root.createEmptyMovieClip("holder_mc",yourDepth) ) and set the alpha to 0, set the _x and _y, etc. Then you load the pic into the movieclip (_root.holder_mc.loadMovie(picString)). From there, get the pic's size (_root.holder_mc._width, _height), and if the width and height are greater than zero adjust a mask or whatever you want behind the pic - whatever you are using as the frame. This way you know the pic is loaded, since its _width and _height are a non-zero number. When your frame is done moving you should do a fadeIn() function or just another kind of function where you set the alpha to a number greater than zero. That should work. Let me know how it goes. A preloader has to set holder_mc as its object and do internal size getting before it calls fadeIn(). godspee.d p.s. if I obviously made a mistake, just do what you think is logical. I didn't proofread it. |
|
|
|
#6 (permalink) | |
|
Notorious?
|
Quote:
no no no - you call a function before making the holder_mc visible (the clip holding the .jpg you are loading) that streches the frame, and THEN you make the holder_mc visible. |
|
|
|
|
#8 (permalink) |
|
Notorious?
|
This is what I have so far: I would post the .fla but I'm not on that computer. http://community.middlebury.edu/~aco...oothFrame.html Maybe you can sorta see how it works? |
|
|
|
#14 (permalink) |
|
Notorious?
|
Oh and by the way - it's all actionScript. All graphics are drawn and animated with AS. Hopefully you full-fledged designers can handle my AS heat I'm going to be a Flash Pro someday. And actually - scratch the 24 hour thing. I'm going to work on a PHP script which will browse a directory taken as an argument (array of arguments dynamically generated) to build the photo name array, making for - yes, you heard me right, an automatically maintained photo slideshow, for which the user can pick the directory. I guess I'll post the basic .fla tomorrow. I feel special. |
|
|
|
#18 (permalink) |
|
Notorious?
|
And the moment you've all (apparently...) been waiting for: here is the .fla of the little photo album I created. Keep in mind it's in the very preliminary alpha stages. It's going to be a lot more robust in the future but I've been asked to post it. And in the name of open source, I will. But please don't just use it as your own work. That would be really lame and weak. As I've always said, cheating is for the weak. Enjoy, and let me know how to improve it! P.S. It's entirely AS, with most code on _root and some on "target", a movie clip with linkage through the library. Make sure to hit the lovely CTRL + L combo. http://community.middlebury.edu/~acogbill/new/slideshow |
|
![]() |