# Dynamically Loading Images from Dynamic URL

**URL:** https://forum.kirupa.com/t/dynamically-loading-images-from-dynamic-url/51713
**Category:** flash
**Created:** [May 16, 2004, 1:56am UTC](https://forum.kirupa.com/t/dynamically-loading-images-from-dynamic-url/51713 "2004-05-16T01:56:31Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Yeldarb](https://avatars.discourse-cdn.com/v4/letter/y/51bf81/32.png) [@Yeldarb](https://forum.kirupa.com/u/Yeldarb)
#### Post date: [May 16, 2004, 1:56am UTC](https://forum.kirupa.com/t/dynamically-loading-images-from-dynamic-url/51713/1 "2004-05-16T01:56:31Z")

</div>

I have 3 movieClips on the stage. I want this to load images from urls that I have withdrawn from a php script that randomly selects from stored urls in the database. I want to load one of these into each movieclip. Here is the code that i have, but it doesn’t work. Could someone please tell me why?  
(btw, this is on a frame of the movie)

```php

loadText = new LoadVars();
loadText.load("generateQuiz.php?week="+_root.week);
loadText.onLoad = function() {
	j = 1;
	sortItOut();
	loadInto = "left";
	this[loadInto].loadMovie(this["set"+j][file]);
	trace(loadInto);
	trace(this["set"+j][file]);
	j++;
	loadInto = "middle";
	this[loadInto].loadMovie(this["set"+j][file]);
	j++;
	loadInto = "right";
	this[loadInto].loadMovie(this["set"+j][file]);
	j++
};
stop();
function sortItOut() {
	numOfQuestions = loadText.numOfQuestions;
	for(i=1; i<=numOfQuestions; i++) {
		url = this.loadText["image"+i];
		path = "images/week"+_root.week+"/";
		file = path+url;
		question = this.loadText["question"+i];
		ansA = this.loadText["ansA"+i];
		ansB = this.loadText["ansB"+i];
		ansC = this.loadText["ansC"+i];
		correct = this.loadText["correctAns"+i];
		this["set"+i] = [image, question, ansA, ansB, ansC, correct];
	}
}
j = 1;

```
