4 Replies Latest reply on May 5, 2007 4:38 PM by Rothrock

    totalFrames = undefined

      I've used totalFrames before but for some reason it's returning undefined. I've made a simple movie clip with 100 frames with the instance name 'myClip' and placed it on my main timeline in frame 1. Then I put the following trace code on frame 1 of the main timeline:

      trace("myClip.totalFrames: "+myClip.totalFrames);

      in the output window I get: myClip.totalFrames: undefined

      I'm running Flash 8 and publishing as Flash 8. Any ideas? Thanks in advance!!

        • 1. Re: totalFrames = undefined
          Rothrock Level 5
          Check the help files.
          • 2. Re: totalFrames = undefined
            dr_ross Level 1
            Yeah like Roth said, check the help file for the right syntax, which in this case is myClip._totalframes instead of myClip.totalFrames.

            Flash is pretty helpful if you give a hand first, by type casting the "myClip" and telling flash what kind of element it is either through

            var myClip:MovieClip = this.createEmpty........

            or by suffixing the instance name with _mc


            flash will recognise it as a type of movieclip and will display all the associated properties and methods of it as soon as you press dot "."

            Nearly every built in type is recognised through the suffix method, everything from _btn to _xml, theres a list somewhere in the help file
            • 3. Re: totalFrames = undefined
              MichaelS Level 1
              Thanks for the 'helpful' comment dr_ross. It sure is nice when someone actually gives constructive comments. I'd used 'totalFrames' in a previous project that must have been AS 1.0. When I searched the livedocs I found the following (which uses 'totalFrames' without the preceding underscore - just for your reference Rothrock - and I guess I assumed incorrectly that it was still the same:

              totalFrames property
              totalFrames:int [read-only]

              Language Version : ActionScript 3.0
              Player Version : Flash Player 9
              The total number of frames in the MovieClip instance.

              If the movie clip contains multiple frames, the totalFrames property returns the total number of frames in all scenes in the movie clip.

              public function get totalFrames():int

              The following code illustrates the use of the totalFrames property of a MovieClip object named mc1:



              And then also another Adobe Support doc I read prior to posting:

              Syntax TotalFrames()

              Description Returns the total number of frames in the movie.
              xample var totalFrames = movie.TotalFrames();


              Thanks again dr_ross.
              • 4. Re: totalFrames = undefined
                Rothrock Level 5
                I think all of the properties in AS3 don't have the leading underscore. Whereas in AS2 and 1 almost all of them did.

                Also capitalization is important and will get you every time.

                Why would you search and use the livedocs when you have the help files on your computer? Also you said you have Flash 8 and are publishing for 8. So why would something introduced in Player 9 be what you are looking for?

                If you want a constructive comment, "Learn to use the help files properly."