8 Replies Latest reply on Nov 21, 2007 2:27 AM by ArmanIc

    How to list properties of all sprites or cast members?

    ArmanIc Level 1
      How can I create a list of all properties of all sprites in a movie or of all properties of all cast members of certain types?
      It is for documentation purposes during development. The main focus is on properties like size, position, font, and behaviour attached (so 'all' is actually not needed).

      Any suggestions are welcome.

      Arman
        • 2. Re: How to list properties of all sprites or cast   members?
          Level 7
          If you put the member into the Object Inspector, you can see a lot of
          its properties. This approach is particularly useful for Shockwave 3d
          members. But some other member types will expose some goodies. If you
          put the sprite into the object instpector, you can get most of the info
          that is available in the Property Inspector, as well as the
          scriptInstanceList which gives you access to the user-defined properties
          of the sprite.
          • 3. Re: How to list properties of all sprites or cast   members?
            ArmanIc Level 1
            Yes Mike, I know how to see the properties. But I need a complete list of all sprites or cast members, together with their properties.
            • 4. Re: How to list properties of all sprites or cast   members?
              Level 7
              I've done this and I know of no other or simpler way. You'll have to create
              a handler that loops through all sprites. First you check to see if the
              sprite has something in it. Then if there is, check it's
              scriptInstanceList. Then check the count of that list to determine how many
              behaviors are attached. Then for each one of those, check it's count and
              then loop through from 1 to that count to get the value of each property.
              I'm sure there's a way to see the script's properties as a property list but
              I haven't figured that one out. All I can do is to list the values of the
              properties in the order in which they are initialized.

              For example, once you find that a channel has a sprite and that the
              scriptinstancelist isn't empty you can do this.
              assume you're looping through the scriptInstanceList of a sprite with x as
              your loop variable.

              cnt = (scriptInstanceList [x]).count
              repeat with y = 1 to cnt
              put scriptInstanceList [x][y]
              end repeat

              This will give you all values of properties in that script in the message
              window.

              I vaguely remember figuring out how to see the actual property list of the
              sprites script but I can't remember at this point. Since each
              scriptInstance is an object and not a list, you can't just see the list of
              properties.


              "ArmanIc" <webforumsuser@macromedia.com> wrote in message
              news:fh3ql3$fmi$1@forums.macromedia.com...
              > Yes Mike, I know how to see the properties. But I need a complete list of
              > all sprites or cast members, together with their properties.


              • 5. Re: How to list properties of all sprites or cast   members?
                ArmanIc Level 1
                Thanks for your help, but, actually, it does not solve my problem. The scriptInstanceList only contains the behaviors attached to a sprite.

                What I'm looking for is a method to list all properties (like width, height, font, color, etc.). Only in authoring mode will do.
                The is a command "showProps", that displays a list of the current property settings of a Flash movie, Vector member, or currently playing sound in the Message window.

                Is there some equivalent method for other objects as well?
                • 6. Re: How to list properties of all sprites or cast   members?
                  Level 7
                  It interesting. If you put "sprite (1)" into the object inspector it can
                  open into a listlike listing of those properties you mention. When the
                  movie is running you can "put sprite (1)[1]" (treating it like a list) and
                  you'll get the sprite number. If you "put (sprite (1)).getPropAt (1) you'll
                  get #spriteNum, the property associated with the sprite number, of course
                  but if you try that in position 2 you'll get index out of range.

                  I'm sure someone out there knows how to access the property list of a sprite
                  but I'm at a loss in providing further assistance. Did you try Direct-L?

                  At this point the only thing I can offer is to create a library behavior
                  that contains a list of all sprite properties (hard coded) and lists them
                  out. If you put it in the code library you'll have access to it from every
                  movie.

                  Craig

                  "ArmanIc" <webforumsuser@macromedia.com> wrote in message
                  news:fhmb7i$fu6$1@forums.macromedia.com...
                  > Thanks for your help, but, actually, it does not solve my problem. The
                  > scriptInstanceList only contains the behaviors attached to a sprite.
                  >
                  > What I'm looking for is a method to list all properties (like width,
                  > height,
                  > font, color, etc.). Only in authoring mode will do.
                  > The is a command "showProps", that displays a list of the current property
                  > settings of a Flash movie, Vector member, or currently playing sound in
                  > the
                  > Message window.
                  >
                  > Is there some equivalent method for other objects as well?
                  >


                  • 7. Re: How to list properties of all sprites or cast members?
                    McFazstp Level 1
                    on GetABigListOfSpriteProps
                    start_frame = ( the frame )

                    big_list = []

                    repeat with n_frame = 1 to ( the lastFrame )
                    go n_frame

                    repeat with n_sprite = 1 to ( the lastChannel )
                    if ( sprite( n_sprite ).type = 0 ) then
                    next repeat
                    end if

                    if ( sprite( n_sprite ).startFrame < n_frame ) then
                    next repeat
                    end if

                    sprite_props = [:]
                    sprite_props.addProp( #channel, n_sprite )
                    sprite_props.addProp( #startFrame, sprite( n_sprite ).startFrame )
                    sprite_props.addProp( #endFrame, sprite( n_sprite ).endFrame )
                    sprite_props.addProp( #loc, sprite( n_sprite ).loc )
                    sprite_props.addProp( #rect, sprite( n_sprite ).rect )
                    sprite_props.addProp( #width, sprite( n_sprite ).width )
                    sprite_props.addProp( #height, sprite( n_sprite ).height )
                    sprite_props.addProp( #member, sprite( n_sprite ).member )
                    sprite_props.addProp( #name, sprite( n_sprite ).member.name )
                    sprite_props.addProp( #type, sprite( n_sprite ).member.type )

                    case ( sprite( n_sprite ).member.type ) of

                    #text, #field:
                    sprite_props.addProp( #font, sprite( n_sprite ).member.font )

                    #bitmap:
                    sprite_props.addProp( #depth, sprite( n_sprite ).member.depth )

                    end case

                    sprite_behaviours = []

                    repeat with n_behaviour = 1 to sprite( n_sprite ).scriptList.count
                    sprite_behaviour = [:]
                    sprite_behaviour.addProp( #member, sprite( n_sprite ).scriptList[n_behaviour][1] )
                    sprite_behaviour.addProp( #name, sprite( n_sprite ).scriptList[n_behaviour][1].name )
                    sprite_behaviour.addProp( #properties, value( sprite( n_sprite ).scriptList[n_behaviour][2] ) )

                    sprite_behaviours.add( sprite_behaviour )
                    end repeat

                    sprite_props.addProp( #behaviours, sprite_behaviours )

                    big_list.add( sprite_props )

                    end repeat

                    end repeat

                    go start_frame

                    return big_list
                    end