14 Replies Latest reply on Jul 9, 2007 11:55 AM by kglad

    Possible to skip frames?

    Magiciandude Level 1
      Okay...I'll try to explain this the best that I can.
      First of all I guess its important that I'm using Actionscript 2.0

      Anyway, my problem is this:
      I have a program set up so that one can click on a left and right arrow shaped button to scroll through different modules. The person can then click and drag on a module and drop it into the product. After he's done, he can click the "Buy Now" button to go to the shopping cart which now has everything they specified in it. Also...all of the pricing and descriptions in the flash movie are specified from an external XML file. Now I've got all of that working...but it might help with the problem.

      Now I've specified an attribute(PROPERTYONE) in the xml for each module and its either labeled "true" or "false" in the XML.

      Now when the little box is clicked, I need the flash movie to only display the modules that are labeled "true".

      So I guess my question is basically...Is it possible to skip frames of a movie clip based on an external XML file's attribute?

      Also, I think its probably important to mention that the module movie clip is an external SWF.

      Any suggestions are GREATLY appreciated!

      Thanks in advance!

      -Chris
        • 1. Re: Possible to skip frames?
          kglad Adobe Community Professional & MVP
          use an if-statement within the coding for your left and right arrow blocks to decide whether a module should be "skipped" or "not skipped".
          • 2. Re: Possible to skip frames?
            Magiciandude Level 1
            Hey!
            Thanks for your reply!

            But I then still have the problem of how to skip it? If I just use the "_root.modules.nextFrame()" code...then it plays through them until it gets to one that's true...and I can't use a gotoAndStop code because I can't define a specific frame...so I think my question in reality is how do I actually skip the frames?

            Thanks again for your reply though!

            -Chris
            • 3. Re: Possible to skip frames?
              kglad Adobe Community Professional & MVP
              that depends on your modules set-up and how you programmed your arrow buttons. you may need to create an array of frame labels to determine the correct frame to play if your modules movieclip isn't conveniently set-up for this.
              • 4. Re: Possible to skip frames?
                Magiciandude Level 1
                Hmmm...
                Well its set up as follows(Ill try to explain it the best I can):
                The modules are in a separate SWF with a bunch of frames with modules on them and a stop(); script on the first frame.
                The arrows are set up with code that says:
                on(release){
                _root.modules.nextFrame();
                }

                or

                on(release){
                _root.modules.prevFrame();
                }

                So its nothing really complex...
                But the frames don't have labels in the movie clip...but the modules in the swf do. They are labeled module+the number of the frame(frame 12 for instance is module12).

                So...thats how its set up...if that helps at all!

                Thanks again for your reply!

                -Chris
                • 5. Re: Possible to skip frames?
                  kglad Adobe Community Professional & MVP
                  that looks conveniently set-up: so, each module 1,2,... is on frame 1,2,... of the module's movieclip and there's a variable corresponding to each module that's true or false?
                  • 6. Possible to skip frames?
                    Magiciandude Level 1
                    Yes...except its not really a variable...its an attribute in an external XML file. I then imported that attribute...and on another movie clip I put the code:

                    onClipEvent(enterFrame){
                    _root.propertyone = _root.plcdata_xml.firstChild.firstChild.firstChild.childNodes[_root.modules._currentframe ].attributes.PROPERTYONE;
                    }

                    So this way it makes a dynamic text box either say true or false according the XML and the current frame of the the "modules" movie clip. And then I can use the dynamic text box as a variable...So I guess thats pretty much exactly what you just said!

                    Hopefully that cleared things up a bit!

                    -Chris
                    • 7. Re: Possible to skip frames?
                      kglad Adobe Community Professional & MVP
                      having an onEnterFrameHandler is unnecessarily inefficient. but be that as it may, you can use:

                      • 8. Re: Possible to skip frames?
                        Magiciandude Level 1
                        First of all thanks for the code!
                        I just can't quite get this to work though...
                        I would need to paste this on the button...right?

                        Also, you said that the onEnterFrameHandler is inefficient. Does this mean that there is a more efficient way to do this?

                        Thanks!

                        -Chris
                        • 9. Re: Possible to skip frames?
                          kglad Adobe Community Professional & MVP
                          that code would replace your current on(release) code for your next button.

                          and yes, there's no reason to repeatedly check modules._currentframe. just update your _root.propertyone variable with modules._currentframe changes. or if that changes from many locations, use the watch() function.
                          • 10. Possible to skip frames?
                            Magiciandude Level 1
                            Oh no! It still doesn't work!

                            Okay...well...the button doesn't have a parent...so I went ahead and got rid of _parent...so now it lets you scroll through the modules.

                            It just doesn't skip to the ones with the attribute set to "true"

                            However I think I might know what the problem is...just not how to fix it...

                            In the XML its not literally set to true...the xml is typed like this for example:
                            <F0-08NA-1 PNUMBER = "F0-08NA-1" MODULENAME="F0-08NA-1" DESCRIPTION="8PT 110VAC AC INPUT" PRICE="47.00" DISCRETEINPUTS="8" DISCRETEOUPUTS="0" ANALOGINPUTS="0" ANALOGOUPUTS="0" FIVEVOLTPOWERBUDGET="-5" PROPERTYONE="true" />

                            True is just an attribute...which probably threw you off because of my failure to explain things right...

                            Would you know how to fix this?

                            Thanks again for your help!

                            -Chris
                            • 11. Re: Possible to skip frames?
                              Magiciandude Level 1
                              Okay...got it...

                              I changed the if(propertyOne) in the end to if(propertyOne=="true")

                              Now remains the problem of not skipping frames though. It still plays all of them...it just stops on the ones with the property...

                              -Chris
                              • 12. Re: Possible to skip frames?
                                kglad Adobe Community Professional & MVP
                                replace your on(release) with:

                                • 13. Re: Possible to skip frames?
                                  Magiciandude Level 1
                                  YES!!! It works!!!

                                  Thank you VERY VERY VERY much for your help!!!

                                  I don't know what I would've done without you!

                                  -Chris
                                  • 14. Re: Possible to skip frames?
                                    kglad Adobe Community Professional & MVP
                                    you're welcome.