https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
HomeHome  
  • HomeHome  
  • Forums  
  • MemberlistMemberlist  
  •  
  • FAQFAQ  
  • SearchSearch  
  • UsergroupsUsergroups  
  • RegisterRegister  
  • Log inLog in  

  • Reply to topic
    avatar
    Preschool Spritan Lv 2
    Preschool Spritan Lv 2

    Our Friends, the Flags!

    Post by Clovis15 on 11/20/2011, 12:45 am

      (NOTE: The following may only apply to AS2, although I think the code I use here is universal to later versions also)

      A while back I noticed some people telling people they could use the gotoAndPlay(); command to effect jumping around a film. While this is true, the disturbing part is that they were suggesting people input straight frame numbers when you use this. So long as you're only going to first frame of a scene, this isn't entirely whack advice. After all, frame 1 of a scene is always going to be the first frame. However, what if you want to go some other frame in a scene... what then?

      If you ever go back and edit any of the animation in that scene - perhaps because you were unhappy with it, or maybe just felt like being difficult to yourself - then suddenly every gotoAndPlay(); command could potentially be pointing to the wrong frames and all have to be fixed by hand. Sure, you could wait to program stuff like this until the entire movie was done, but some kinds of interactive content can't even be tested without the jumping functionality already in place. You'd be a somewhat poor animator if you didn't look anything over even once until the 11th hour!

      Are you doomed to suffer the yoke of never modifying anything so that the links don't break, or fixing them all by hand each and every time you modify something?

      NO! NEVER FEAR, FOR OUR FRIENDS THE FLAGS ARE HERE!

      Yes, that's me running Flash 6 on a Windows 7 machine... just ignore that fact...

      Anyways, as indicated by circle 1, you may notice that various frames have a flag on them with a name next to it. No, this doesn't mean that I've found a way to play minesweeper inside of flash, although that would be an interesting thing to try and do. It actually means that there is a way to break free of the shackles of having to use specific frame numbers when I use the gotoAndPlay(); command.

      When you have a frame selected on the time line, and have the properties panel open, you can find an option - as shown by circle 2 - to give that frame a name. Don't worry, even your much newer - less ghettofied - versions of Flash will also have this highly useful feature. When you input a name down here, that frame up above will be flagged in the timeline with a flag of the same name. From now on you may reference that frame by the flag's name, rather than the frame number itself, and all references done this way will remain valid no matter how much you juggle things around.

      If I were to, using the example above, type out the command: gotoAndPlay("window2"); then it would always go to the right frame, whether that was frame 42 or frame 1337. If I wanted to got to a flagged frame in a diifferent scene, then I'd just use gotoAndPlay("scene_name", "flag_name"); and I'd still get the desired result. Remember, you must now use quotations marks in the command as you're using a reference title for the frame instead of the actual number itself.

      I may not often animate; but when I do, I use sprites...
      Stay pixelated, my friends!


      PREVIOUS TUTORIALS:

      Clovis15 Tutorial-1: Easy Dynamic Sound Control With Resume
      Clovis15 Tutorial-2: How to Live Life Without V-Cam
      Clovis15 Tutorial-3: Dynamic Animation, and Subtitle Toggles


      Last edited by Clovis15 on 11/20/2011, 11:58 pm; edited 1 time in total
      avatar
      Clovis15
      Preschool Spritan Lv 2
      Preschool Spritan Lv 2

      Age : 35
      Number of posts : 261
      Registration date : 2011-01-16
      Reputation : 0

      View user profile
      avatar
      Administrator
      Administrator

      Re: Our Friends, the Flags!

      Post by Patt on 11/20/2011, 12:53 am

        Oooh, that is nice, I never though of doing it in that way. : o





        [The Return]
        avatar
        Patt
        Administrator
        Administrator

        Age : 21
        Number of posts : 13107
        Registration date : 2009-03-28
        Reputation : 9

        View user profile
        avatar
        Preschool Spritan Lv 2
        Preschool Spritan Lv 2

        Re: Our Friends, the Flags!

        Post by Clovis15 on 11/20/2011, 1:02 am

          NOTE: Before anyone asks, Frame 2 is actually labelled Buttons. There just wasn't enough room on the timeline to show the full name.
          avatar
          Clovis15
          Preschool Spritan Lv 2
          Preschool Spritan Lv 2

          Age : 35
          Number of posts : 261
          Registration date : 2011-01-16
          Reputation : 0

          View user profile
          avatar
          Administrator
          Administrator

          Re: Our Friends, the Flags!

          Post by Patt on 11/20/2011, 1:03 am

            No dude that is definitely named butt, you dirty man you.





            [The Return]
            avatar
            Patt
            Administrator
            Administrator

            Age : 21
            Number of posts : 13107
            Registration date : 2009-03-28
            Reputation : 9

            View user profile
            avatar
            Moderator
            Moderator

            Re: Our Friends, the Flags!

            Post by Leo on 11/20/2011, 4:18 am

              ^ lol

              Well I knew about these already, they are mentioned in various tutorials and Flash books I had.

              But nice tutorial, man. Your tutorials are always clear and straightforward.
              avatar
              Leo
              Moderator
              Moderator

              Age : 19
              Number of posts : 9196
              Registration date : 2009-05-23
              Reputation : 3
              Location : Brazil
              Custom Rank : "Dank Memes." - Albert Einstein

              View user profile
              avatar
              Eternal Spritan
              Eternal Spritan

              Re: Our Friends, the Flags!

              Post by Ping on 12/1/2011, 12:12 pm

                Happy day, Clovis. Thank you.




                @darkdragon581 wrote:ping, i don't see you getting 'boodie' anytime soon, i don't care if your black, its most likely not going to happen
                avatar
                Ping
                Eternal Spritan
                Eternal Spritan

                Age : 21
                Number of posts : 20163
                Registration date : 2010-09-15
                Reputation : 8
                Location : Madison Wisconsin

                View user profile
                Reply to topic
                - Similar topics

                 
                Permissions in this forum:
                You cannot reply to topics in this forum

                Your last visit was on

                Current date/time is 4/30/2017, 11:45 am

                Log In

                Remember me: I forgot my password

                Who is online?
                None

                In total there are 14 users online :: 0 Registered, 1 Hidden and 13 Guests :: 2 Bots

                [ View the whole list ]

                Staff Online
                Latest topics
                The Spritas Discord Channel
                Donate

                Want to help out the site? Donating helps ensure the site is running as smoothly as possible! You may donate through PayPal using the button below.