9 Replies Latest reply on Mar 20, 2007 7:09 AM by kglad

    flash mc/ xml

      I have this code that works at root. I'd like to have it work from within a movie clip but that moves it in a level. I was reading about how to call xml but I'm confused and am not sure what path to give it. A lesson I just found states that
      "Given the XML instance my_xml, the root node would be: my_xml.firstChild" I'm not really sure which part of the xml that is. I will keep reading but in the meantime, maybe someone can help:

      It's just in a movie clip in my main movie. Here is the code:

        • 1. Re: flash mc/ xml
          kglad Adobe Community Professional & MVP
          if that code works when it's on your _root timeline the only things you have to change, when it's copied to the timeline of a movieclip, is myXML.ref.

          if the movieclip to which you copy that code is placed on the same timeline that contains your textfields, you can use:

          • 2. Re: flash mc/ xml
            Level 1
            That worked!! Thank you~

            I was really excited and thought I was onto something grand. I tried applying that logic to another script that I am using in the same way.. moving it off of the root into a movie clip. It too works just fine until it goes inside the mc.

            It doesn't have the exact same type of reference to the XML. It calls with (or at least I think this is calling the xml)
            var mainnode:XMLNode = peoplexml.firstChild;

            When I change that to _parent it says

            Expected a field name after '.'
            • 3. Re: flash mc/ xml
              kglad Adobe Community Professional & MVP
              when you move that code to your movieclip are you also moving the combobox into that movieclip? if yes, i don't think you need to change anything. if no, you'll need to reference the path to your chooseperson combobox.
              • 4. Re: flash mc/ xml
                Level 1
                That's right. What I realized is it actually does work when insdie a movie clip. It just doesn't work inside the flash default accordian component.

                When I copy it into one of the accordian mc's it doesn't show up, nor does the entire accordian.
                I thought maybe the xml variables had the same name coincidentally but they are different.
                There are no errors (after I made var mainnode:XMLNode = peoplexml.firstChild;)

                The code for the people.xml is in the movie clip which is actually part of the accordian component.
                When it's not in the accordian component but is in a movie clip there is no problem.
                Any ideas? I appreciate your help!
                • 5. Re: flash mc/ xml
                  kglad Adobe Community Professional & MVP
                  how do you put code into an accordian component???
                  • 6. Re: flash mc/ xml
                    Level 1
                    I didn't actually add code to the component, just to the accordian, sorry if my phrasing was not clear. Just to be sure I'll rephrase- Each item of the accordion has an mc assigned to it. So for example if the top item was 'about us', you could have an mc named 'about_mc' and that could have .as in its timeline. The second item that is clickable might be 'products' and that too would be it's own movie clip. So that each clickable, (I'm not sure what they are called exactly, navigation bars) calls those children _mc's.

                    The first post on this thread was actually doing just that. I didn't specify that at the time it was going into an accordian format because what mattered was that it was up a level from the root.

                    With the second script I that I had posted it too will go inside an _mc that is part of the accordion UI that comes default with Flash. It works fine by itself with the actions on a frame in the stage. It also works fine, just as you predicted, in an _mc with the actions in the same timeline as the components. Where it gets muddled is when the components and the actions are placed inside the mc associated with the component. So, we're still only talking one clip off of the root, it should still work.

                    Perhaps the actions of the component interfere with that of the people.xml script? I don't know for sure, and I can't actually see the code to the component. I guess one idea might be to try and make my own component by following one of the tutorials on gotoandlearn.com. But, it seems like if Flash offers a default component that can be used in many ways, it should work with just about anything inside of it and the error is probably something I can correct. Would you agree? I'm fairly new to .as and very new to xml so that there could be many factors escaping my knowledge. I think my next guess then would be to make a new accordion, but I also think it'd be time reinventing the wheel.
                    • 7. Re: flash mc/ xml
                      kglad Adobe Community Professional & MVP
                      i don't agree. i strongly dislike components. their code is hidden which makes understanding them impossible and customizing them impossible.

                      if you want to do exactly what the component was designed to do, they're fine. but if you want to stretch their use beyond the authors original intention, good luck. it's easier to make your own.
                      • 8. Re: flash mc/ xml
                        Level 1
                        That's my plan then. I'll make my own. Thanks for your help!
                        • 9. Re: flash mc/ xml
                          kglad Adobe Community Professional & MVP
                          you're welcome.