2 Replies Latest reply on Mar 18, 2010 10:30 PM by PepiToll

    Actionscript stopping after 1st of 4 layers

    PepiToll

      I'm trying to create a type of news flash file with four panels, each with a different coloured background and diferent text (from xml file).  Each panel will show for say 4 seconds.  My flash file has four layers, each with a different coloured background, and following each other on timeline to create one movie.  The actionscript is stopping at the end of the 1st layer on the timeline, so only the first panel is showing text from the xml file, but not the other three.  Any help would be most appreciated thanks.  New to Flash and have been researching on web for answer to no avail.

       

      Flash timeline screenshot:

      FocusOnTimeline.jpg

       

      Actionscript 3.0:

      var XMLData:XML = new XML ();
      var theURL_ur:URLRequest = new URLRequest("FocusOn.xml");
      var loader_ul:URLLoader = new URLLoader(theURL_ur);
      loader_ul.addEventListener("complete", fileLoaded);

      function fileLoaded(e:Event):void
      {
         XMLData = XML(loader_ul.data);

         CLEHeading.text = XMLData.cleheading;
         CLEInformation.text = XMLData.cleinfo;
         CPDHeading.text = XMLData.cpdheading;
         CPDInformation.text = XMLData.cpdinfo;
         TrainingEventHeading.text = XMLData.eventheading;  
         TrainEventInformation.text = XMLData.eventinfo;
         TrainingMaterialHeading.text = XMLData.materialheading;
         TrainMatInformation.text = XMLData.materialinfo;
      }

       

      XML (FocusOn.xml):

      <?xml version="1.0" encoding="utf-8"?>
      <?xml-stylesheet type="text/css" href="FocusOn.css"?>
      <focuson>
      <cleheading>TEST CLE HEADING 1</cleheading>
      <cleinfo>This is just sample info for cle to see if xml works with Flash file</cleinfo>
      <cpdheading>TEST CPD HEADING 1</cpdheading>
      <cpdinfo>This is just sample info for CPD to see if xml works with Flash file</cpdinfo>
      <eventheading>TEST TRAINING EVENT HEADING 1</eventheading>
      <eventinfo>This is just sample info for Training Events to see if xml works with Flash file</eventinfo>
      <materialheading>TEST TRAINING MATERIAL HEADING 1</materialheading>
      <materialinfo>This is just sample info for Training Material to see if xml works with Flash file</materialinfo>
      </focuson>

        • 1. Re: Actionscript stopping after 1st of 4 layers
          kglad Adobe Community Professional & MVP

          you can't reference an object that doesn't exist.  in particular, you can't reference a textfield that doesn't exist.

          • 2. Re: Actionscript stopping after 1st of 4 layers
            PepiToll Level 1

            Thanks for trying to help kglad but I don't understand.  I'm one of those "newbies" you experienced people understandably get frustrated with.  Well, I understand that you can't action something that isn't there, but are you saying the text fields in my Flash file don't exist? Eg CLEHeading is a dynamic text field in my flash file.  That text field and the CLEInformation text field in 1st layer get populated by xml data when running flash file, but other (6) text fields in other 3 layers don't.