# Referencing/loading a dynamically created movieclip variable

**URL:** <https://forum.kirupa.com/t/referencing-loading-a-dynamically-created-movieclip-variable/261146>\
**Category:** Uncategorized\
**Created:** [May 23, 2008, 2:47pm UTC](https://forum.kirupa.com/t/referencing-loading-a-dynamically-created-movieclip-variable/261146 "2008-05-23T14:47:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbear2008](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@tbear2008](https://forum.kirupa.com/u/tbear2008)\
**Post date:** [May 23, 2008, 2:47pm UTC](https://forum.kirupa.com/t/referencing-loading-a-dynamically-created-movieclip-variable/261146/1 "2008-05-23T14:47:47Z")

</div>

Hi there,

Its my first post, but I’m hoping someone out there can help me!

I am trying to load an image in to a dynamically created movieclip, which is:

\_root.mySlider."+stripX2(band\*[0])+i

but I can’t seem to reference it. I can load the movie into \_root.mySlider, but if I add the dynamic element (stripX2(band\*[0])+i) without quotes it it doesn’t load. If I load with quotes

i.e.

“\_root.mySlider.”+stripX2(band\*[0])+i

flash doesn’t allow strings in movieClip variables

The code I’m using is belowm, it’s the second to last line thats causing the problem:

var loadListener:Object = new Object();  
loadListener.onLoadComplete = function(target\_mc:MovieClip):Void {  
trace("\>\> target\_mc.\_width: “+target\_mc.\_width);  
};  
loadListener.onLoadInit = function(target\_mc:MovieClip):Void {  
trace(”\>\> target\_mc.\_width: "+target\_mc.\_width);  
};  
var mcLoader:MovieClipLoader = new MovieClipLoader();  
mcLoader.addListener(loadListener);  
var mc:MovieClip = \_root.mySlider.createEmptyMovieClip(“mc”, this.getNextHighestDepth());

mcLoader.loadClip(inBead.bead\_loc, mc);

Many Thanks!

---

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [May 23, 2008, 2:54pm UTC](https://forum.kirupa.com/t/referencing-loading-a-dynamically-created-movieclip-variable/261146/2 "2008-05-23T14:54:43Z")

</div>

\_root.mySlider[stripX2(band\*[0])+i]

---

<div class="post-metadata">

**Author:** ![tbear2008](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@tbear2008](https://forum.kirupa.com/u/tbear2008)\
**Post date:** [May 24, 2008, 2:32pm UTC](https://forum.kirupa.com/t/referencing-loading-a-dynamically-created-movieclip-variable/261146/3 "2008-05-24T14:32:15Z")

</div>

That’s perfect, many thanks!
