5 Replies Latest reply on May 15, 2007 1:28 PM by vladimirj

    problems with List and ActionScript and XML Help needed!

    vladimirj
      Im new to flash and im trying to build a web site using XML and PHP which communicate with mysql db and ActionScript in order to populate List component that i use as menu. I have 2 frames one called category and one subcategory. In the first there is one List component called categoryList and the second frame is a copy from the first one but now including plus another list called subcategoryList. And my problem is the following, the first categoryList is populated when the page is loaded and by clicking on item from the list the second frame is invoked and populated with the subcategories of that product.
      However this only works the first time only from Frame1 the second time in the Frame2 which is a copy of Frame2 i want to choose a product form the categoryList nothing happens i.e the subcategory list doesnt reloads (the second time im in the second frame and also have added the same on (change) listener and gotoAndStop(25) command to the same copy of the List).

      Im trying to figure out why when i click on the first frame it works properly the second list is populated but when im in the second list with exactly the same code from the first it doesnt works? Do you have any idea? the XML code used in both of the frames is attached here. Please give me some suggestions.
        • 1. Re: problems with List and ActionScript and XML Help needed!
          Greg Dove Level 4
          I'm hoping I understand what you're doing... I would probably do it all in one frame and just toggle the .visible property of the subcategory list after the first one has been clicked, but there's no rules about how you do it.

          Without being sure, I think what you may have done is put a second "copy" of the category list on another keyframe, which replaces the previous instance. By taking away the second copy it should work. If that's not the case, then I'm stumped... otherwise read on.

          So if you have the category list in its own layer, just have it in frame one, on frame 2 of the same layer have a frame but not a keyframe. This will mean the instance in frame one is still the same one when the playhead gets to frame 2.

          And have the subCategory list on a separate layer, it appears on frame 2...

          BTW the .getSelectedItem() method of the list reminds me of flash mx... is that the version you're using (curiosity only I don't think its relevant, because its obviously working).



          • 2. Re: problems with List and ActionScript and XML Help needed!
            vladimirj Level 1
            I've tried your suggestions but no success :(. The action script layer is divided with two key frames, where the first part contains the code for the first frame and the second part for the second frame. I really don't have an idea what could be the problem.
            • 3. Re: problems with List and ActionScript and XML Help needed!
              Greg Dove Level 4
              OK, so I think now I understand... the new load for the second list is not being triggered.

              To check this, try putting :

              theXML1.load(" http://localhost/functions/get_subcategories.php?subcategory="+va);

              before:
              _root.gotoAndStop("categoryList");

              in your first frame.
              The first time you run this it won't do anything because theXML1 doesn't exist yet until you get to frame 2. It should work afterwards I think

              • 4. Re: problems with List and ActionScript and XML Help needed!
                Greg Dove Level 4
                And you'll need to empty the subcategory list each time too... otherwise it'll just keep getting longer..
                • 5. Re: problems with List and ActionScript and XML Help needed!
                  vladimirj Level 1
                  I've done it! But i have another solution all of the other did not work although my solution is not elegant.
                  Previously You've said to change the sequence of the code however the XML1 is in the actionscript layer and the gotoAndStop is in the on change listener in the actions of the categoryList in the second frame. I've used _root.gotoAndStop(66) which is a blank frame and in this frame im returning to _root.gotoAndStop(25); and it works perfectly.
                  Thanks very much for your help! I really appreciate it!