Skip to main content
Participant
November 6, 2008
Question

load dyn mc from library

  • November 6, 2008
  • 4 replies
  • 451 views
i have an xml img slideshow playing inside 9 movie clips. when someone presses a navigation mc, i would like a linked movie clip from my library to show up replacing the img slideshow image with the movie clip. currently, when i click on the navigation mc the img slideshow does stop and the movie clips they are loaded into go white but the movie clip in the library will not show up. I have the mc in my library Export First Frame, Export Action Script and the identifier name is "videoPage".

here is the code (the very last function is the one where I am trying to code replacing the images with the library movie clip): - by the way, thanks for the help!

var photo:Boolean = true;
var nav:Boolean = false;
var curImage:Number = 0;

var img_xml = new XML()
img_xml.ignoreWhite = true;
img_xml.load("images.xml");
var imgArray = new Array();

img_xml.onLoad = function()
{var slideTimer:Number = Number(img_xml.firstChild.firstChild.attributes.time);
for (i = 1; i < img_xml.firstChild.childNodes.length; i++){
imgArray[i - 1] = img_xml.firstChild.childNodes .attributes.path;}
setInterval(nextImage, slideTimer);
}

function nextImage() {
curImage++
if (curImage == imgArray.length) {
curImage = 0;
}else if (nav == false) {
// do nothing;
}
load_photo_mc();
}

/////////////// load image slideshow //////////////

function load_photo_mc() {
if (photo == true & nav == false) {
photo = !photo;
for (var n = 1; n < 10; n++) {
this["pol" + n].photo_mc.loadMovie(imgArray[curImage]);}
}else if (photo == false & nav == false) {
photo = !photo;
for (var n = 1; n < 10; n++) {
this["pol" + n].photo_mc2.loadMovie(imgArray[curImage]);}
}else{
}
}

/////////////// load navigation pages //////////////
// this is what i can not get to work..../////

this.videoNav.onPress = function() {
nav = true;
for (var n = 1; n < 10; n++) {
this["pol" + n].photo_mc2.attachMovie(videoPage);
this["pol" + n].photo_mc1.attachMovie(videoPage);}
}
This topic has been closed for replies.

4 replies

kglad
Community Expert
Community Expert
November 6, 2008
you're welcome.
Participant
November 6, 2008
Ah. Thanks!
kglad
Community Expert
Community Expert
November 6, 2008
the 2nd parameter is the string you want to use for the attached movieclip's instance name. use any string unique to the timeline to which you're attaching your movieclip.
kglad
Community Expert
Community Expert
November 6, 2008
use the attach code option to display code in this forum. and

1. videoPage should be in quotes in your attachMovie() methods
2. attachMovie() requires 3 parameters. check the help files.
Participant
November 6, 2008
I did not know how to place (this["pol" + n]) in the attachMovie.
this["pol" + n].photo_mc2.attachMovie("videoPage", ,this.getNextHighestDepth());

Thank you for your help!