4 Replies Latest reply on Dec 16, 2008 4:45 AM by thybluefox

    Dynamically calling Movieclips

      Right, to say I'm getting a little fristrated with this is an understatement.

      Basically, I'm using attachMovie to load in a linked movieclip from the library, I then need to dynamically (depending on which part of the movieclip is clicked) load in another linked movieclip into the mc originally loaded.....does that make sense.... Loading the first movieclip is working perfectly, but I'm having real trouble loading in the second into the original.

      loadHolder is the function that is working, and is called when the frame runs, loadFabric is the one with issues. It unloads the movie perfectly, but refuses to load the linked movieclip (currently just a red square) in.

      Hope someone can spot the no doubt stupid mistake I've made, thanks all!
        • 1. Dynamically calling Movieclips
          Ned Murphy Adobe Community Professional & MVP
          Is the intention to replace the first attached movie with the second (fabric)? When you attach a movie to the same depth as an existing movie, the existing movie is replaced by the new one.

          The following line is not likely to do anything despite what you see for the trace of selectedMc...


          because you create it using a string, not a targeted object. The correct approach would be more like...

          selectedMc = _root.dw_mc.holder_mc[selectedBit];

          Though I've no idea what it is actually targeting
          • 2. Re: Dynamically calling Movieclips
            thybluefox Level 1
            NedWebs, thanks for the reply. The idea is for it to attach a movie (fabric) within the first attached movie, which is given the instance name of holder_mc. I didn't think depths would be an issue as the new attached movie is going inside the one attached first (complicated or what!).

            I've changed the selectedMc line, thanks for that, I was sure I wasn't doing that bit right anyway!

            Maybe a bit of background to the project may help. I'm creating a "make your own handbag" feature for a clients website, so first they select the handbag (loadHolder function), then they'll click on a part of the bag (stored in selectedBit) and lastly select the fabric, which is then loaded in behind a mask within the bag movieclip.

            Again, massive thanks for the help.
            • 3. Re: Dynamically calling Movieclips
              thybluefox Level 1
              Little up date and self bump. I'd started to think maybe it was because it was trying to attach a movie to an attached movie, but I succesfully loaded the fabric into the holder_mc, like so...

              _root.dw_mc.holder_mc.attachMovie(fabric, "fabric_mc", 1, {_x: 0, _y: 0});

              Although when I tried it like the below it didn't work,

              _root.dw_mc.holder_mc.bottom_mc.attachMovie(fabric, "fabric_mc", 1, {_x: 0, _y: 0});

              Is the intergrity of the instances kept when the first movie (holder_mc) is attached?

              I'm really running out of ideas, lol!

              Thanks again.
              • 4. Re: Dynamically calling Movieclips
                thybluefox Level 1
                Fixed, unloadMovie was obviously removing the movieclip i was then trying to load in, duh!