Reply LinkBack Thread Tools Search this Thread
Old 14-01-2004, 11:45   #1 (permalink)
gray
i still want paying
 
gray's Avatar
 
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
  Reply With Quote
Old 14-01-2004, 11:55   #2 (permalink)
Mr Fred
Magazines™
 
Mr Fred's Avatar
 
Join Date: Mar 2003
Location: Glasgow..
Posts: 11,354
nice idea though - actionscript isnt my forte.

btw image 3 looks like my doctor.
  Reply With Quote
Old 14-01-2004, 11:58   #3 (permalink)
oli
I Call Shenanigans™
 
oli's Avatar
 
Join Date: Feb 2003
Location: Manchester, England.
Posts: 9,736
peter snow is your doctor ?
__________________
Linked In :: Last.fm :: Twitter
..................
  Reply With Quote
Old 15-01-2004, 07:21   #4 (permalink)
andycogbill
Notorious?
 
andycogbill's Avatar
 
Join Date: Nov 2003
Location: Middlebury, VT
Posts: 417
Send a message via AIM to andycogbill
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.
  Reply With Quote
Old 15-01-2004, 10:37   #5 (permalink)
gray
i still want paying
 
gray's Avatar
 
Join Date: Oct 2003
Location: newcastle, uk
Posts: 4,713
that would make the mc fade in wouldnt it?.. i want it to stretch as it does in the example.. hmmm
  Reply With Quote
Old 17-01-2004, 16:27   #6 (permalink)
andycogbill
Notorious?
 
andycogbill's Avatar
 
Join Date: Nov 2003
Location: Middlebury, VT
Posts: 417
Send a message via AIM to andycogbill
Quote:
Originally Posted by gray
that would make the mc fade in wouldnt it?.. i want it to stretch as it does in the example.. hmmm

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.
  Reply With Quote
Old 19-01-2004, 13:52   #7 (permalink)
dan
Iris Folder
 
dan's Avatar
 
Join Date: Apr 2003
Location: smokey
Posts: 2,643
How'd it go? you get it sorted?
  Reply With Quote
Old 20-01-2004, 07:35   #8 (permalink)
andycogbill
Notorious?
 
andycogbill's Avatar
 
Join Date: Nov 2003
Location: Middlebury, VT
Posts: 417
Send a message via AIM to andycogbill
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?
  Reply With Quote
Old 20-01-2004, 07:42   #9 (permalink)
Mr Fred
Magazines™
 
Mr Fred's Avatar
 
Join Date: Mar 2003
Location: Glasgow..
Posts: 11,354
pm that file friend (if you wouldnt mind) - great stuff
  Reply With Quote
Old 20-01-2004, 10:22   #10 (permalink)
gray
i still want paying
 
gray's Avatar
 
Join Date: Oct 2003
Location: newcastle, uk
Posts: 4,713
nice one andy, looks good!
  Reply With Quote
Old 20-01-2004, 10:31   #11 (permalink)
oli
I Call Shenanigans™
 
oli's Avatar
 
Join Date: Feb 2003
Location: Manchester, England.
Posts: 9,736
yeah would you mind posting the .fla when you have it ?
__________________
Linked In :: Last.fm :: Twitter
..................
  Reply With Quote
Old 20-01-2004, 11:15   #12 (permalink)
sleepingfish
css is for divs
 
sleepingfish's Avatar
 
Join Date: Feb 2003
Location: Norwich
Posts: 4,469
pleeeeeeeeeeeeeeeeeaaaaaase
  Reply With Quote
Old 20-01-2004, 12:30   #13 (permalink)
andycogbill
Notorious?
 
andycogbill's Avatar
 
Join Date: Nov 2003
Location: Middlebury, VT
Posts: 417
Send a message via AIM to andycogbill
I'd bet you'd all like that, wouldn't you?? (/power trip) Yeah I'll post it as soon as I get back to the states - in about 24 hours. Stay tuned...
  Reply With Quote
Old 20-01-2004, 12:32   #14 (permalink)
andycogbill
Notorious?
 
andycogbill's Avatar
 
Join Date: Nov 2003
Location: Middlebury, VT
Posts: 417
Send a message via AIM to andycogbill
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.
  Reply With Quote
Old 20-01-2004, 12:44   #15 (permalink)
dan
Iris Folder
 
dan's Avatar
 
Join Date: Apr 2003
Location: smokey
Posts: 2,643
Special.
  Reply With Quote
Old 20-01-2004, 14:53   #16 (permalink)
Mr Fred
Magazines™
 
Mr Fred's Avatar
 
Join Date: Mar 2003
Location: Glasgow..
Posts: 11,354
good move andy.
  Reply With Quote
Old 21-01-2004, 04:15   #17 (permalink)
sleepingfish
css is for divs
 
sleepingfish's Avatar
 
Join Date: Feb 2003
Location: Norwich
Posts: 4,469
Top man
  Reply With Quote
Old 22-01-2004, 10:12   #18 (permalink)
andycogbill
Notorious?
 
andycogbill's Avatar
 
Join Date: Nov 2003
Location: Middlebury, VT
Posts: 417
Send a message via AIM to andycogbill
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
  Reply With Quote
Old 22-01-2004, 11:00   #19 (permalink)
Mr Fred
Magazines™
 
Mr Fred's Avatar
 
Join Date: Mar 2003
Location: Glasgow..
Posts: 11,354
right then a million questions coming your way over next xx months

thanks andy
  Reply With Quote
Old 22-01-2004, 11:01   #20 (permalink)
Mr Fred
Magazines™
 
Mr Fred's Avatar
 
Join Date: Mar 2003
Location: Glasgow..
Posts: 11,354
""then becca and ab showed up and made my friday a day to remember"" bet they did
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8