>Your array (list) functions work fine, but you are missing a key
>concept of object oriented programming.  The key is that objects are
>all about data and code working together.  Your "Array Parent" has a
>fine set of handlers, but that's all it is, a set of handlers.  Given
>what you have shown, there is no reason to create an object since
>these handlers operate only on the data passed it.  They don't share
>any data.
>
>If you really want to do this in an OOP way, you want to have the
>object maintain and operate on the data.  For example, when you want
>to be able to manipulate items in an array (or a one dimensional
>list), you could do this:
>
>-- Whereever you want to create your array:
>global array
>
>myList = [1,2,"a",6,"g"]
>array = new(script "Array Parent", myList)
>
>And the object would look like this:
>
>property pMyList  -- property which is my list
>
>on new me, startingList
>    pMyList = startingList
>    return me
>end
>
>on _shift me
>    myValue = pMyList[1]
>    deleteAt(pMyList, 1)
>    return myValue
>end
>
>on _unshift me, myValue
>    addAt(pMyList, 1)
>end
>
>on _push me, myValue
>    append(pMyList, myValue
>end
>
>etc.
>
>This also allows you to have multiple arrays:
>
>global array1
>global array2
>
>array1 = new(script "Array parent", [1,2,3,4,5])
>array2 = new(script "Array parent", ["A", "B", "C", "D", "E", "F"]
>
>Again, the idea here is that the data is kept _inside_ the object -
>or another way to say this is that the object "owns" the data.  You
>could certainly add two more "accessor" routines to get and set the
>data for the array:
>
>on setList newList
>    pMyList = newList
>end
>
>on getList
>    return pMyList
>end
>
>For more about this, feel free to check out my EBook on OOP in Lingo at:
>
>   http://www.furrypants.com/loope
>
>Especially in chapter 5 where I talk about using objects to model a
>two dimensional array.
>
>Irv
>

Irv,
could this not be used as an ancestor script.

I guess I am coming from this from a javascript Object point of view and
since there is no array object prototype as there is in javascript I
intended to make my own.

And if I save the functions in an object, correct me if I am wrong please,
if I save them in a global object I can access at any time even if I change
movies, where as if I put them in the moviescript each time I have to load
them inwith each new movie.

I was basically attempting to create global functions that I did not have
to load with each movie, somwething akin to what Peter Small was doing with
his math objects in Lingo Sorcery.

You see in javascript, you can make functions and save them as methods of
objects, but, and if there is a way to do this other than ancestors, I for
the life of me can't figure out a way to add new functions as methods of my
objects.

I will have to check out your e-book.

:b)

____________________________________
Flash/Director/JavaScript
Imaginary Studio
http://www.imaginarystudio.com




[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to