0 Replies Latest reply on Oct 1, 2009 6:47 AM by AESS1981

    Array from library

    AESS1981

      Hi,

       

      I have created an array of library mcs, and attached the first mc to 'news_text_holder'.

      When I click a button, I am trying to achieve:

      - 'news4' gotoAndPlay "text_out"

      - Once 'news4' has stopped playing, attached the next mc in the array to 'news_text_holder'.

       

       

      My button calls the function 'newsText':

       

      on (release){

      _root.newsText(1);

      }

       

       

      The code on the main timeline is:

       

      news_text_holder.attachMovie("news4","news", 1);

       

      var textArray = ["news4", "news3", "news2", "news1"];

      var textIndex = 0;

       

      newsText = function (d) {

      textIndex = (textIndex+d)%textArray.length;

      if (textIndex<0) {

      textIndex += textArray.length;

      }

      news_text_holder.news.gotoAndPlay("text_out");

      };



      On the last frame of 'menu4' I have:

       

      _root.loadNews();

      stop();


       

       

      loadNews on the main timeline reads:

       

      loadNews = function() {

      trace(pathToPics+textArray[textIndex]);

      _root.news_text_holder.attachMovie(pathToPics+textArray[textIndex], "news", 1);

      };

       

       

       

      news_text_holder.news.gotoAndPlay("text_out"); works fine, and the index value in the array seems to change ok in the output menu but the next mc in the array does not appear.

      Any idea where I am going wrong?

       

      Thanks