7 Replies Latest reply on Apr 30, 2007 12:42 AM by Lukewig

    Help with OOP in Lingo

    Level 7
      hello everyone
      I'm tired of using global variables all the time.
      I believe going OOP would help minimise them.
      would anyone help me with some OOP in Lingo.
      I would be very greateful if anyone could enlighten me with a simple but
      complete example of OOP.
      I have gone thru the lingo group archives and found bits and pieces. but for
      a beginner in oop they are of very little help.

      thanx
      ahmed


        • 2. Re: Help with OOP in Lingo
          Level 7
          hi Sean
          he explains the methods and thing yes.
          but When and where do I create the objects? at the start of the movie?
          would myobj will be another global variable.
          i'm confused about these little things.

          if you can help me alittle bit on that would be great.

          thanx anways for the link
          ahmed

          "Sean Wilson" <webforumsuser@macromedia.com> wrote in message
          news:f12sdm$brc$1@forums.macromedia.com...
          > http://www.furrypants.com/loope/


          • 3. Re: Help with OOP in Lingo
            Level 7
            > but When and where do I create the objects? at the start of the movie?

            That depends on when you need the objects to be available.

            > would myobj will be another global variable.

            It could be. But it could also be a property of a behavior script, or an
            element in the actorList, or a property of a "static" script, or...
            It depends on how you need to access it. There are no hard-and-fast rules
            • 4. Re: Help with OOP in Lingo
              Level 7
              hi Sean
              Is it possible for you to give me a working example. a real code
              thank you
              ahmed

              "Sean Wilson" <webforumsuser@macromedia.com> wrote in message
              news:f12t87$cts$1@forums.macromedia.com...
              >> but When and where do I create the objects? at the start of the movie?
              >
              > That depends on when you need the objects to be available.
              >
              >> would myobj will be another global variable.
              >
              > It could be. But it could also be a property of a behavior script, or an
              > element in the actorList, or a property of a "static" script, or...
              > It depends on how you need to access it. There are no hard-and-fast rules


              • 5. Re: Help with OOP in Lingo
                Level 7
                > Is it possible for you to give me a working example. a real code

                No it isn't. Your "question" is too general. Try being more specific
                about what you have and what you want.
                • 6. Re: Help with OOP in Lingo
                  Level 7
                  You're asking for a mouthful. Director itself is based on OOP so using
                  global variables can be part of any OOP approach to a project. You can also
                  mix OOP with more linear based coding. The most significant piece of
                  information that helped me to understand OOP was how one script gives a
                  personality to the object it spawns and that each object could have
                  independent values in each of its properties. It took me a while to
                  understand this. The script though is not unlike a script given to several
                  actors. The script is the same but each actor will use it differently,
                  though words are the same.

                  Any child object you create in Lingo has to be stored somewhere and that's
                  often in a global variable although as Sean pointed out there are many
                  places it can go.

                  Also, if you're using OOP as a catch all and aren't just referring to parent
                  scripts and the child objects they spawn the realize that Director
                  implemented an object aproach to behaviors quite a few versions ago so by
                  just creating a behavior that can be attached to any sprite in itself is an
                  OOP approach.


                  --
                  Craig Wollman
                  Lingo Specialist
                  Word of Mouth Productions
                  212-928-9581

                  www.wordofmouthpros.com
                  "FotoArt" <FotoArt@theMaldives.com> wrote in message
                  news:f12ub3$e4i$1@forums.macromedia.com...
                  > hi Sean
                  > Is it possible for you to give me a working example. a real code
                  > thank you
                  > ahmed
                  >
                  > "Sean Wilson" <webforumsuser@macromedia.com> wrote in message
                  > news:f12t87$cts$1@forums.macromedia.com...
                  >>> but When and where do I create the objects? at the start of the movie?
                  >>
                  >> That depends on when you need the objects to be available.
                  >>
                  >>> would myobj will be another global variable.
                  >>
                  >> It could be. But it could also be a property of a behavior script, or an
                  >> element in the actorList, or a property of a "static" script, or...
                  >> It depends on how you need to access it. There are no hard-and-fast rules
                  >
                  >


                  • 7. Re: Help with OOP in Lingo
                    Lukewig Level 1
                    Hi,

                    Here's another resource: http://www.lingoworkshop.com/Articles/iloop.php
                    It includes 'a working example' (an "RSS reader'). Its a fairly complex example (a RSS feed reader application) - but I always found the 'simple examples' fairly pointless (and they rarely have any relevance to the real problems and situations you are tackling).

                    Also check out http://www.lingoworkshop.com/Articles/Standard_Practices.php
                    -- Luke