I know how to load dynamic images in a movieclip
sPhoto.loadMovi e('http://localhost/1.jpg');
I have two movieclips "mcMain" and "mcArticle"
mcMain ---- mcArticle --- mcPhoto
mcPhoto is inside mcArticle and is suppose load an image dynamicaly I am using the above code but it does not work. Please Help. My code is given below
onClipEvent(loa d) {
// create Text format properties
var myFormat:TextFo rmat = new TextFormat();
myFormat.font = "Verdana";
myFormat.size = 11;
myFormat.color = 0xffffff;
myFormat.align = "Justify";
var myFormat1:TextF ormat = new TextFormat();
myFormat1.font = "Verdana";
myFormat1.size = 11;
myFormat1.color = 0xD5D028;
myFormat1.align = "Left";
myFormat1.bold = true;
myXML = new XML();
myXML.ignoreWhi te = true;
myXML.onLoad = function(succes s) {
if (success) {
// extract XML Data
// myRecords will be an array XML records
myRecords = myXML.firstChil d.childNodes;
// Get Number of Records
totalRecords = myRecords.lengt h;
createEmptyMovi eClip("mcMain", 0); mcMain._x = -30;
mcMain._y = -10;
// loop thru each record
for (ctr = 0; ctr < totalRecords; ctr++) {
// get data from array element
var articleID = myRecords[ctr].attributes.id;
var articleTitle = myRecords[ctr].attributes.myt itle;
var articlePhoto = myRecords[ctr].attributes.pho to;
var articleText = myRecords[ctr].firstChild;
currentArticle = mcMain.createEm ptyMovieClip("m cArticle"+ctr, ctr);
currentArticle. articleID=artic leID;
if (ctr > 0) {
currentArticle. _y = mcMain["mcArticle"+(ct r-1)]._height + 10 + mcMain["mcArticle"+(ct r-1)]._y;
}
// create movieclip for Article photo
currentPhoto = mcArticle.creat eEmptyMovieClip ("mcPhoto"+c tr, ctr);
if (ctr > 0) {
currentPhoto._y = mcArticle["mcPhoto"+( ctr-1)]._height + 10 + mcArticle["mcPhoto"+( ctr-1)]._y;
}
currentPhoto.lo adMovie('http://localhost/work/photo/achieve1.jpg');
}
} else {
trace ("Problem loading XML");
}
}
myXML.load("htt p://localhost/work/achieve.php?d=" + new Date().getTime( ));
//The most important function so far
function rebuildHTML(the Text:String):St ring {
var tempText:String = theText;
var chunks:Array = new Array();
chunks = tempText.split( "<")
tempText = chunks.join("<" );
chunks = tempText.split( ">");
tempText = chunks.join(">" );
chunks = tempText.split( "&");
tempText = chunks.join("&" );
chunks = tempText.split( "href=" ;");
tempText = chunks.join("hr ef=\"");
chunks = tempText.split( "">");
tempText = chunks.join("\" >");
return tempText;
}
}
sPhoto.loadMovi e('http://localhost/1.jpg');
I have two movieclips "mcMain" and "mcArticle"
mcMain ---- mcArticle --- mcPhoto
mcPhoto is inside mcArticle and is suppose load an image dynamicaly I am using the above code but it does not work. Please Help. My code is given below
onClipEvent(loa d) {
// create Text format properties
var myFormat:TextFo rmat = new TextFormat();
myFormat.font = "Verdana";
myFormat.size = 11;
myFormat.color = 0xffffff;
myFormat.align = "Justify";
var myFormat1:TextF ormat = new TextFormat();
myFormat1.font = "Verdana";
myFormat1.size = 11;
myFormat1.color = 0xD5D028;
myFormat1.align = "Left";
myFormat1.bold = true;
myXML = new XML();
myXML.ignoreWhi te = true;
myXML.onLoad = function(succes s) {
if (success) {
// extract XML Data
// myRecords will be an array XML records
myRecords = myXML.firstChil d.childNodes;
// Get Number of Records
totalRecords = myRecords.lengt h;
createEmptyMovi eClip("mcMain", 0); mcMain._x = -30;
mcMain._y = -10;
// loop thru each record
for (ctr = 0; ctr < totalRecords; ctr++) {
// get data from array element
var articleID = myRecords[ctr].attributes.id;
var articleTitle = myRecords[ctr].attributes.myt itle;
var articlePhoto = myRecords[ctr].attributes.pho to;
var articleText = myRecords[ctr].firstChild;
currentArticle = mcMain.createEm ptyMovieClip("m cArticle"+ctr, ctr);
currentArticle. articleID=artic leID;
if (ctr > 0) {
currentArticle. _y = mcMain["mcArticle"+(ct r-1)]._height + 10 + mcMain["mcArticle"+(ct r-1)]._y;
}
// create movieclip for Article photo
currentPhoto = mcArticle.creat eEmptyMovieClip ("mcPhoto"+c tr, ctr);
if (ctr > 0) {
currentPhoto._y = mcArticle["mcPhoto"+( ctr-1)]._height + 10 + mcArticle["mcPhoto"+( ctr-1)]._y;
}
currentPhoto.lo adMovie('http://localhost/work/photo/achieve1.jpg');
}
} else {
trace ("Problem loading XML");
}
}
myXML.load("htt p://localhost/work/achieve.php?d=" + new Date().getTime( ));
//The most important function so far
function rebuildHTML(the Text:String):St ring {
var tempText:String = theText;
var chunks:Array = new Array();
chunks = tempText.split( "<")
tempText = chunks.join("<" );
chunks = tempText.split( ">");
tempText = chunks.join(">" );
chunks = tempText.split( "&");
tempText = chunks.join("&" );
chunks = tempText.split( "href=" ;");
tempText = chunks.join("hr ef=\"");
chunks = tempText.split( "">");
tempText = chunks.join("\" >");
return tempText;
}
}
Comment