Assigning movieclip to dynamically created movieclip

In part of my actionscript i’m using:

thumbnail_mc.createEmptyMovieClip(“t”+k, thumbnail_mc.getNextHighestDepth());

to create a seperate movieclips for ewach image in my xml file.

How would I then attach another movieclip to each of the newly created ones?

ie thumbnail_mc.t0, thumbnail_mc.t1, thumbnail_mc.t2…

is there a way to do it automaticall7y or do i have to assign it to each one individually?

“thumbnail_mc.t”+k.attachMovie obviously doesn’t work :frowning:

[QUOTE=sean1983uk;1984362]In part of my actionscript i’m using:

thumbnail_mc.createEmptyMovieClip(“t”+k, thumbnail_mc.getNextHighestDepth());

to create a seperate movieclips for ewach image in my xml file.

How would I then attach another movieclip to each of the newly created ones?

ie thumbnail_mc.t0, thumbnail_mc.t1, thumbnail_mc.t2…

is there a way to do it automaticall7y or do i have to assign it to each one individually?

“thumbnail_mc.t”+k.attachMovie obviously doesn’t work :([/QUOTE]

thumbnail_mc["t"+k].attachMovie("mc", "mc", 1);

Many Thanks for that!

tried it but its not working some how.

i got my code from this tutorial http://www.kirupa.com/developer/mx2004/thumbnails.htm

Basically trying to add the thumbnail title to each thumbnail which i’ve added in the xml file.

Not sure how to do that, thats why I thought i would have to attach another movie clip to the image and then try and retrive the relevant titles for each thumbnail.

Does this make sense?

[QUOTE=sean1983uk;1984445]Many Thanks for that!

tried it but its not working some how.

[/QUOTE]

try a trace straight after the above code

trace(thumbnail_mc["t"+k].mc)

its returns undefinded 5 times which is how many thumbnails there are. So guessing its attaching to it? but not staying there?

this works ok-mc linkage id -ter

function thumbnails_fn(k) {
	thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
	thumbnail_mc.createEmptyMovieClip("p"+k, thumbnail_mc.getNextHighestDepth());
	tlistener = new Object();
	tlistener.onLoadInit = function(target_mc) {
		target_mc._x = hit_left._x+(target_mc._width+5)*k;
		var clip = thumbnail_mc["p"+k].attachMovie("ter", "ter", 1000);
		clip._x = target_mc._x;
		target_mc.pictureValue = k;
		target_mc.onRelease = function() {
			p = this.pictureValue-1;
			nextImage();
		};
		target_mc.onRollOver = function() {
			this._alpha = 50;
			thumbNailScroller();
		};
		target_mc.onRollOut = function() {
			this._alpha = 100;
		};
	};
	image_mcl = new MovieClipLoader();
	image_mcl.addListener(tlistener);
	image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}

YOUR A STAR!!!

I’d hug you if you were here haha

Many Thanks!!

I’ll prob be asking another question later when i try and get the values across lol

[QUOTE=sean1983uk;1984465]YOUR A STAR!!!

I’d hug you if you were here haha

Many Thanks!!

I’ll prob be asking another question later when i try and get the values across lol[/QUOTE]

No problem

Hey again lol

Yeh that worked :slight_smile: and added the movieclip to the stage but is it creating an additional lot of movie clips twice? Also when i use

thumbnail_mc[“p”+k].ter[“ter”+k].team.text = team[p]

its not getting any data from xml file for any of the clips?

guessing i’m referencing wrong somewhere?

oooo got it!!!

just need to use

clip.team.text

YOUR A STAR

made my day!

if you have a few minutes later could you explain the lines you added and why? so i dont have to use this blindly :slight_smile: think i get it but would be good to clarify :slight_smile:

[QUOTE=sean1983uk;1984478]if you have a few minutes later could you explain the lines you added and why? so i dont have to use this blindly :slight_smile: think i get it but would be good to clarify :)[/QUOTE]
All we have done is created another clip to mimic the thumbnails.When you load into a clip -many properties are lost.
your line

thumbnail_mc["p"+k].ter["ter"+k].team.text = team[p]

should have read

thumbnail_mc["p"+k].ter.team.text

but “clip” is shorter.