duplicateMovieClip on mc with dynamic content

I try to duplicate a mc wich has dynamic loaded content. The mc is loaded but not the content. Why?

All these actions are done in a control mc in the beginning of the flash movie, that also loads XML content - which pictures to load is determined in the XML file.

The code:

(sorry for the danish comments in the code…)


onClipEvent(load) {
//opret globale variable
_global.startPicMove = “”;
_global.mouseIsOver = “false”;
_global.moviewidth = 738;//filmens længde
_global.centerpos = _global.moviewidth/2;//midten af maincontainer
_global.pics_space = 5;//mellemrum ml. billederne
_global.speed = 20;//hastighed af træk i billedet
_global.turn = “left”;//hvilken vej drejer billederne

// — LOAD XML - og generer billeder —

//funktionen generatePics som parser XML indhold, skaber og attacher indhold/movieclips med funktioner
function generatePics(pics_xml) {
//trace (pics_xml);

//opret movieclips som skal holde billederne og flyttes horisontalt
//_root.createEmptyMovieClip(“maincontainer”,1);
var pic_maincontainer = _root.maincontainer;
//pic_maincontainer.createEmptyMovieClip(“container”,1);
var pic_container = _root.maincontainer.container;

//set start indikator
_global.startPicMove = “start”;
trace (“startindikator”);

//flyt maincontainer
pic_maincontainer.onEnterFrame = function (){
//trace (“enter frame maincontainer”);

//scroll billederne fra start
if ((_global.startPicMove == “start”) && (_global.mouseIsOver == “false”)) {
pic_maincontainer._x -= 1;
}
//gør billederne scrollbare hvis musen er over filmen
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
_global.mouseIsOver = “true”;
//_global.startPicMove = “”;//stop automatisk move
//trace (“maincontainer mouseover”);
}
else {
_global.mouseIsOver = “false”;
//trace (“maincontainer mouseout”);
}

//scroll billederne udfra mouseposition
if (_global.mouseIsOver == “true”) {
if (_xmouse > _global.centerpos) {
//trace ("x mouse pos: " + _xmouse);
_global.turn = “right”;
xpos_factor = ((_xmouse - _global.centerpos)/_global.centerpos)_global.speed;
//trace ("xpos_factor: " + xpos_factor);
this._x += xpos_factor;
}
if (_xmouse < _global.centerpos) {
//trace ("x mouse pos: " + _xmouse);
_global.turn = “left”;
xpos_factor = ((_global.centerpos - _xmouse)/_global.centerpos)
_global.speed;
//trace ("xpos_factor: " + xpos_factor);
this._x -= xpos_factor;
}
}

}//end maincontainer onEnterFrame

//opret lokale variable
var curr_node;
var curr_pic_name;
var curr_pic_holder;
var curr_pic_x;
var curr_pic_y;
var curr_pic_link;
var curr_pic_info;
var nodes_xml = pics_xml.firstChild;//første node i hierarkiet - topcontainer node
//trace ("first child = " + pics_xml.firstChild);
//var curr_by = container.createEmptyMovieClip(name, depth);

//opret globale variable
_global.numPics = nodes_xml.childNodes.length;//antal billeder
trace ("antal billeder: " + _global.numPics);

//loop gennem alle XML noder, hiv text mm ud og skab movieclip med funktioner
for (var i=0; i<nodes_xml.childNodes.length; i++) {
//trace ("antal noder i alt = " + nodes_xml.childNodes.length);
curr_node = nodes_xml.childNodes*;
//trace ("current node = " + nodes_xml.childNodes*);

//opret/dupliker nye movieclip i et container movieclip og load billeder ind i disse
//curr_pic_holder = pic_container.createEmptyMovieClip(“pic_holder”+i,1+i);
curr_pic_holder = _root.maincontainer.container.pic_holder_clp.duplicateMovieClip(“pic_holder”+i, 1+i);
//opret endnu en container til at holde billedet - ellers virker efterfølgende actions ikke
curr_pic_mc = curr_pic_holder.createEmptyMovieClip(“pic_mc”+i,1+i);
curr_pic_name = curr_node.attributes.pic_name;
//trace ("picname: " + curr_pic_name);
curr_pic_mc.loadMovie(curr_pic_name);//henter billede
curr_pic_x = (curr_node.attributes.x * i) + (_global.pics_space*i);
//trace ("x pos: " + curr_pic_x);
curr_pic_holder._x = curr_pic_x;
curr_pic_holder._y = 0;

//definer properties/variable som knyttes til holder movieclip
curr_pic_holder.navn = curr_pic_holder._name;
//trace("pic holder navn: " + curr_pic_holder.navn);
curr_pic_holder.sti = curr_pic_holder;
//trace("pic holder sti: " + curr_pic_holder.sti);
curr_pic_holder.container = curr_pic_holder._parent;
//trace("pic holder container: " + curr_pic_holder.container);
curr_pic_holder.link = curr_node.attributes.linkurl
//trace("pic holder url: " + curr_pic_holder.link);
curr_pic_holder.info = curr_node.attributes.info;
//trace("pic holder info: " + curr_pic_holder.info);

//opret funktioner på det movieclip som indeholder movieclips med billederne
curr_pic_holder.onLoad = function() {
//trace("Load: " + this._name);
}
curr_pic_holder.onRollOver = function() {
//trace ("pic rollover: " + this._name);
_root.infotext_txt.html = true;
_root.infotext_txt.htmlText = this.info;
//_root.infotext_txt = this.info;
//opret og anvend textFormatObjekt til formattering af text
infotext_txt_format = new TextFormat();
infotext_txt_format.bold = true;
infotext_txt_format.align = center;
_root.infotext_txt.setTextFormat(infotext_txt_format);
}
curr_pic_holder.onRollOut = function() {
//trace ("pic rollout: " + this._name);
_root.infotext_txt.htmlText = “”;
}
curr_pic_holder.onRelease = function() {
getURL(this.link, “_blank”);
}

}//end for loop

//dupliker container ift. hvilken vej der scrolles (billeder går i ring)

pic_container.onEnterFrame = function (){
//trace (“enter frame container”);

if (_global.turn == “left”) {

trace ("turn: " + _global.turn);
_root.maincontainer.container.duplicateMovieClip("container_right", 2);
trace ("container x: " + _root.maincontainer.container._x);
trace ("maincontainer x: " + _root.maincontainer._x);
trace ("container width: " + _root.maincontainer.container._width);
_root.maincontainer.container_right._x = _root.maincontainer.container._x + _root.maincontainer.container._width;
trace ("container right x: " + _root.maincontainer.container_right._x);
trace ("container right name: " + _root.maincontainer.container_right._name);
trace ("container right width: " + _root.maincontainer.container_right._width);    

}
}

}//end function generatePics

//definer et nyt XML objekt
pics_xml = new XML();
pics_xml.ignoreWhite = true;
//funktion når XML er loaded færdig
pics_xml.onLoad = function(ok){
if (ok){
generatePics(this);
}
};
// load XML
pics_xml.load(“pics.xml”);
trace (“XML loaded”);
}

This is known limitation in the flash player. You have to reload it again, However since the image will be cached after its loaded the first time, it would load almost instantly the next time.

You can read bit more about it here.

http://www.macromedia.com/support/flash/ts/documents/dupswf.htm