944,168 Members | Top Members by Rank

Ad:
Oct 19th, 2009
0

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

Expand Post »
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
Similar Threads
Reputation Points: 26
Solved Threads: 31
Posting Whiz
samarudge is offline Offline
354 posts
since May 2008
Oct 19th, 2009
0
Re: Dynamicaly loading JPG (or other format image) into an Actionscript 3.0 Movie clip
What the hell is this? Go get yourself a flash actionscript 3.0 book or something.

I'm being SERIOUS.
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Oct 19th, 2009
0
Re: Dynamicaly loading JPG (or other format image) into an Actionscript 3.0 Movie clip
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
"
Reputation Points: 26
Solved Threads: 31
Posting Whiz
samarudge is offline Offline
354 posts
since May 2008
Oct 20th, 2009
2
Re: Dynamicaly loading JPG (or other format image) into an Actionscript 3.0 Movie clip
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!
Reputation Points: 167
Solved Threads: 239
Nearly a Posting Virtuoso
rajarajan07 is offline Offline
1,445 posts
since May 2008
Oct 20th, 2009
0
Re: Dynamicaly loading JPG (or other format image) into an Actionscript 3.0 Movie clip
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
Reputation Points: 26
Solved Threads: 31
Posting Whiz
samarudge is offline Offline
354 posts
since May 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Graphics and Multimedia Forum Timeline: Display products
Next Thread in Graphics and Multimedia Forum Timeline: Anyone knows a good way to produce flash video fille (FLV) from flash SWF files?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC