Dynamicaly loading JPG (or other format image) into an Actionscript 3.0 Movie clip

Thread Solved

Join Date: May 2008
Posts: 231
Reputation: samarudge is an unknown quantity at this point 
Solved Threads: 19
samarudge samarudge is offline Offline
Posting Whiz in Training

Dynamicaly loading JPG (or other format image) into an Actionscript 3.0 Movie clip

 
0
  #1
Oct 19th, 2009
Hi,

I have a movie clip called dsp_albumcover (Already created and on the stage, instance name is dsp_albumcover)

I also have a variable with a .jpg file (Can be changed to any other though) defined as
actionscript Syntax (Toggle Plain Text)
  1. var albumimg:String = '/albumcover.jpg';

How do I load this in to dsp_albumcover?
dsp_albumcover is 128 pixles high x wide and the image is the same dimentions.

Thanx,
Sam

P.S. Before anyone says that I should just include it in my libary, /albumcover.jpg?ID={ID} is the actual image that would be called and would be retrieved from a DB
My Blog, Life and everything that matters to me - SamRudge.co.uk

2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert
 
0
  #2
Oct 19th, 2009
What the hell is this? Go get yourself a flash actionscript 3.0 book or something.

I'm being SERIOUS.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 231
Reputation: samarudge is an unknown quantity at this point 
Solved Threads: 19
samarudge samarudge is offline Offline
Posting Whiz in Training
 
0
  #3
Oct 19th, 2009
I have been following tutorials all day and none of them work, I just thought that an WEB DESIGN FORUM might be able to help, I didn't see the point in saying "This has taken me the last 8 hours to do but it doesnt work
Graphics and Multimedia Syntax (Toggle Plain Text)
  1. Some Code
"
My Blog, Life and everything that matters to me - SamRudge.co.uk

2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 150
Reputation: rajarajan07 is on a distinguished road 
Solved Threads: 19
rajarajan07's Avatar
rajarajan07 rajarajan07 is offline Offline
Junior Poster
 
2
  #4
34 Days Ago
As Imthwee said, please try to find tutorials too.

Anyway Please follow this to get your work done:

1) Just create an empty movie clip with a instance name (emptyMC)
2) Place your jpeg file in the same location

use this code in timeline:
Graphics and Multimedia Syntax (Toggle Plain Text)
  1. const IMAGE_URL:String = "followme.png";
  2.  
  3. var ldr:Loader = new Loader();
  4. ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, ldr_complete);
  5. ldr.load(new URLRequest(IMAGE_URL));
  6.  
  7.  
  8.  
  9. function ldr_complete(evt:Event):void
  10. {
  11. emptyMC.addChild(ldr);
  12. }

Hope this helps!

Note: Don't worry about the size of the movie clip, Just an empty movie clip thats it!
Thanks & Regards,
RajaRajan. R

trulyraja2009@yahoo.in
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 231
Reputation: samarudge is an unknown quantity at this point 
Solved Threads: 19
samarudge samarudge is offline Offline
Posting Whiz in Training
 
0
  #5
34 Days Ago
Originally Posted by rajarajan07 View Post
As Imthwee said, please try to find tutorials too.

Anyway Please follow this to get your work done:

1) Just create an empty movie clip with a instance name (emptyMC)
2) Place your jpeg file in the same location

use this code in timeline:
Graphics and Multimedia Syntax (Toggle Plain Text)
  1. const IMAGE_URL:String = "followme.png";
  2.  
  3. var ldr:Loader = new Loader();
  4. ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, ldr_complete);
  5. ldr.load(new URLRequest(IMAGE_URL));
  6.  
  7.  
  8.  
  9. function ldr_complete(evt:Event):void
  10. {
  11. emptyMC.addChild(ldr);
  12. }

Hope this helps!

Note: Don't worry about the size of the movie clip, Just an empty movie clip thats it!
Thank you so much, I would buy you a virtual pint but I don't think that is possible =P
My Blog, Life and everything that matters to me - SamRudge.co.uk

2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Graphics and Multimedia Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC