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

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

Member Avatar for iamthwee

What the hell is this? Go get yourself a flash actionscript 3.0 book or something.

I'm being SERIOUS.

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

Some Code

"

Member Avatar for rajarajan2017

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:

const IMAGE_URL:String = "followme.png";

var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, ldr_complete);
ldr.load(new URLRequest(IMAGE_URL));



function ldr_complete(evt:Event):void 
{
	emptyMC.addChild(ldr);
}

Hope this helps!

Note: Don't worry about the size of the movie clip, Just an empty movie clip thats it!

commented: Soved a problem I had been struggeling with for days :D +2
commented: Although it's a question that could be answered with any actionscript 3.0 resourse, still...props to you. +11

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:

const IMAGE_URL:String = "followme.png";

var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, ldr_complete);
ldr.load(new URLRequest(IMAGE_URL));



function ldr_complete(evt:Event):void 
{
	emptyMC.addChild(ldr);
}

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.