1 Reply Latest reply on Aug 18, 2006 2:25 PM by mrtedweb

    loader component

      Here's the background info.

      The XMLconnector Component recieves the XML data. I've got a ComboBox that displays an array based off the XML.

      When the user selects one of the elements of the array several Label components update with information from the XML document.

      This was all done through Flash 8 and the Component inspector, not a line of AS.

      What I'm trying to achieve next is dynamically placing a movie clip on the stage that corresponds to which item in the ComboBox is selected. Easy enough. But I also want to be able to position the clip based on information that is in one of the label components.

      I hope that makes sense.

        • 1. Re: loader component
          mrtedweb Level 1
          The only way I know to do this is to use attacheMovie, which requires ActionScript. If your combobox is called myCmbBox, then the script should look something like this:

          var myListener:Object = new Object();
          myCmbBox.addEventListener("change", myListener);
          myListener.change = function(evt)
          if (evt.target.selectedItem.label eq "value1") //change "value1" to your ComboBox item
          attachMovie("LibraryItem1", "uniqueItemName1", this.getNextHighestLevel())
          else if (evt.target.selectedItem.label eq "value2")
          attachMovie("LibraryItem2", "uniqueItemName2", this.getNextHighestLevel())

          It's not that daunting once you take some time to examine it. Before you do this though, be sure to reference the movie clips that you want to dytnamically load (here I've called them LibraryItem1 and LibraryItem2). Right click on it from the library, select Options and click on 'Export for Action Script' and then click 'OK'. Now it's ready to be loaded dynamically.