redline024
June 20th, 2008, 05:36 PM
I am pre loading images from an XML file in AS3 and then displaying them later. First I loop through the XML to get the images and then load them into a movieclip. Later when i make the swf image ive loaded visable i want it to play. The problem I'm having is that when i try to tell the swf to play by using the getChildByName its telling me it can't play because its a loader and not a movieclip. How can i convert this loaded swf to the movieclip it should be so i can tell the swf to play??!? Im all out of ideas.
where i grab the images, load them and name them:
var numImages = xmlData.content.*.image.length();
var sceneArray = new Array();
var imageArray = new Array();
var imageHolder = new Array();
var i;
for (i=0; i<numImages; i++) {
imageArray = xmlData.content.*.image.text();
sceneArray = xmlData.content.*.image.@s;
imageHolder = new MovieClip();
var theScene = new Loader();
theScene.load(new URLRequest(imageArray[i]));
imageHolder[sceneArray[i]] = theScene;
imageSpot.addChild(imageHolder[sceneArray[i]]);
imageHolder[sceneArray[i]].alpha = 0;
imageHolder[sceneArray[i]].name = "scene" + sceneArray[i];
}
where i try to make it play:
if (imageSpot.getChildByName("scene14") != null) {
imageSpot.getChildByName("scene14").alpha = 1;
MovieClip(imageSpot.getChildByName("scene14")).play();
fade:Tween;
fade = new Tween(imageSpot,"alpha",None.easeNone,0,1,1,true);
}
PLEASE SOMEONE HELP!! thanks.
where i grab the images, load them and name them:
var numImages = xmlData.content.*.image.length();
var sceneArray = new Array();
var imageArray = new Array();
var imageHolder = new Array();
var i;
for (i=0; i<numImages; i++) {
imageArray = xmlData.content.*.image.text();
sceneArray = xmlData.content.*.image.@s;
imageHolder = new MovieClip();
var theScene = new Loader();
theScene.load(new URLRequest(imageArray[i]));
imageHolder[sceneArray[i]] = theScene;
imageSpot.addChild(imageHolder[sceneArray[i]]);
imageHolder[sceneArray[i]].alpha = 0;
imageHolder[sceneArray[i]].name = "scene" + sceneArray[i];
}
where i try to make it play:
if (imageSpot.getChildByName("scene14") != null) {
imageSpot.getChildByName("scene14").alpha = 1;
MovieClip(imageSpot.getChildByName("scene14")).play();
fade:Tween;
fade = new Tween(imageSpot,"alpha",None.easeNone,0,1,1,true);
}
PLEASE SOMEONE HELP!! thanks.