7 Replies Latest reply on Feb 10, 2008 3:28 AM by rlc5611

    .attachmovie trouble

      I'm trying to load data from a xml file ( Works ) and then put it in a movie clip as text ( does not work )- eventually being the first tier of buttons.
      Note: rootNode.childNodes etc - what I assign to the txt, returns the proper text value of the button name if I trace it.
      galleryMenu_mc is an empty movie clip on the stage root.
      "Category Button" is the name of my button in the library - It consists of a simple rectangle right now, and then a movie clip called text_mc and within that there's dynamic text with the instance name txt.

      it seems that currentButton simply doesn't get created- if I trace its x, y, or text, I get "undefined".

      any thoughts?
      help appreciated

        • 1. Re: .attachmovie trouble
          Level 7
          >.currentButton.text_mc.txt =
          >rootNode.childNodes .childNodes[0].childNodes[0];

          I believe you need nodeValue:

          currentButton.text_mc.txt =

          Dave -
          Head Developer
          Adobe Community Expert

          • 2. Re: .attachmovie trouble
            troublingdream Level 1
            nope, no change.

            the problem isn't with xml, it's with attachmovie.
            ( i tried anyway )

            anyone else ? :(
            • 3. Re: .attachmovie trouble
              yachts99-2vTvY1 Level 2
              Linkage identifiers cannot have spaces in their names. So "Category Button" is not allowed, perhaps try "Category_Button".

              Also, where are you assigning a value to your text field? There's no .text property for the text field.

              Shouldn't currentButton.text_mc.txt = rootNode.childNodes .childNodes[0].childNodes[0]; be:

              • 4. Re: .attachmovie trouble
                troublingdream Level 1
                yes, you're right - it should be txt.text, I gaffed on that one.. Also, I changed "Category Button" to "CategoryButton" ..

                sadly, it's still not working. The strangest thing to me is that I can easily trace the correct values so I know the xml is being loaded properly, but the attachmovie doesn't seem to work at all -

                If I try to trace the _x of the attached movie, for example, I get an undefined error. I run the debug tool, and everything stays on level 0- no movie clips are attached to the button holding mc..

                this is reminding me of when i started doing C++ and I would spend many hours to resolve what ended up being a misplaced = or ;


                anyone else have an idea? I feel like I'm not using attachmovie correctly- is there anything outside of the rough code I attached ( and having a mc with a text movie clip called txt called "CategoryButton" in my library ) that I need to do?
                • 5. Re: .attachmovie trouble
                  Damon Edwards Level 3

                  what do you get in the output window?
                  • 6. .attachmovie trouble
                    yachts99-2vTvY1 Level 2
                    This might be a scope problem. Are you sure that the parseGalleries() function is even being called from within the if(success){ branch? Try a trace statement in the first line of the function. I think you may have to try this:

                    EDIT: Just tried it and now I'm not so sure scope is the problem. I'd suggest having a very careful look at the attachMovie code and linkage identifier again.
                    • 7. Re: .attachmovie trouble
                      rlc5611 Level 1
                      Without looking at your function, your attached code uses array reference "I" (capital letter) while your for loop uses "i" (lower case). The "I" would be undefined so anything it referenced would be undefined. Also, in case you might be using the variable "i" some place else in your script, it might be a good idea to use for( var i = 0.... instead of for (i = 0.......

                      I know you cannot author mc names with spaces but they can be scripted easily enough.

                      Also rather than currentButton = "button" + i; I think you need galleryMenu_mc["button" + i]. The way you have it written, currentButton is typeof string rather than typeof movieclip.