load a jpg into a movieclip in AS3

want to put the contents of the loaded jpg into a movieclip, missing how, at the moment I just display the content of the loader.
var imageloader:Loader = new Loader();
imageloader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded_image);
 
imageloader.load(new URLRequest("canvas/images/1_1_1.jpg"))
 
function loaded_image(e:Event){
	pad.addChild(imageloader.content);
}

Open in new window

RoryRAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rascalpantsCommented:
try this...


rp / ZA


var imageloader:Loader = new Loader();
imageloader.contentLoaderInfo.addEventListener(Event.INIT, loaded_image);
 
imageloader.load(new URLRequest("canvas/images/1_1_1.jpg"))
pad.addChild( imageloader );
 
function loaded_image(e:Event){
        // do something if needed
}

Open in new window

0
RoryRAuthor Commented:
it will probably display, but I need to do this repeatedly, and reference the objects after, so I would like to name the objects to talk to them.
0
rascalpantsCommented:

that is not what was stated in the question...  please give all details in the question, not in subsequent comments....

you would put your code in a for loop...


rp / ZA

0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

RoryRAuthor Commented:
"You can add an instance of Loader to the Display List and have its only child be automatically displayed, or you can add to the Display List the downloaded bitmap, which is stored in yourLoader.content property"

I am reusing the loader many many times, as in hundreds, I need to add the loaded bitmap into an object with a name set at run-time. I can do it in AS2, no idea for AS3 (upgrading)
0
RoryRAuthor Commented:
don't need to be like that, I did say "want to put the contents of the loaded jpg into a movieclip", your answer was just displaying the loader.

I am not to sure what I am doing with AS3, started learning yesterday, so couldn't quite phrase it right.

which exact bit? how do you mean? you still have no reference to a movieclip, so I don't get how doing it repeatedly would help, specially as: "an instance of Loader can hold only one child at a time, which is the most recently loaded content" so putting it in a loop wouldn't load multiple jpg's.
0
rascalpantsCommented:
the loader IS a movieclip, but you just need to reference it "as" a movieclip by using  "as MovieClip" after the loader...

it is basically the same way you would use AS 2.0, but with slightly different syntax, and more importantly advanced event listeners.

you need to create new movieclips and use addChild to load the loader into that clip...

eg.

img1.addChild( theLoader );
img2.addChild( theLoader );
img3.addChild( theLoader );

so basically, you would create a for loop... most likely from a list of assets in XML or an Array, and loop through it... creating a new instance of a movieclip and then adding the contents of the loader to that movieclip.


rp / ZA

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RoryRAuthor Commented:
thanks. I am struggling changing to AS3.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.