As Howdy and Tab have suggested, if you are not using the debugger, 
you should do yourself a favor and learn how to use it.  Here is an 
article I wrote that gives you a jumpstart:

  http://www.director-online.com/accessArticle.cfm?id=871

As for why you are seeing the particular problem, I would guess also 
that you are not initializing your list the way you think you are. 
 From your description, you should be doing it something like this:

   myStack = []
   repeat with i = 1 to 25
      append(myStack, 0)
   end repeat


However, if you are really getting into object oriented code here, it 
would make more sense that all the "management" of this stack be put 
into yet another object - a stack manager object.  In this way, the 
initialization code and the getStackPointer code would be part of the 
same object, and the data (the stack itself and a count of items) be 
properties of that object.  For example:

-- Stack manager

property pStack  -- the stack itself (really a list)
property pnItems  -- the number of items

on new me
   pnItems = 25  -- or whatever, or pass it in as a parameter
   repeat with i = 1 to 25
     append(pStack, 0)
   end repeat
   return me
end

on getStackPointer me
    repeat with counter = 1 to pnItems
       if pStack[counter] = 0 then
           pStack[counter] = new(script "myScript")
           return counter
       end if
    end repeat
    alert("No empty spaces to create new object")  -- error condition
    return somethingFunkyToIndicateThatYouCouldNotAllocateANewThingy  -- e.g., 0
end

Then at the start of your movie, create this stack manager into some 
global variable:

global gStackMgr

on prepareMovie
    gStackMgr = new(script "StackMgr")
end


Then, when you want to allocate a new thingy (I don't what these 
things are), you would do this:

    slotNumber = goStackMgr.getStackPointer()

Irv

At 10:48 AM -0500 2/21/02, Matthew DeSimone wrote:
>So I ran tests this time before posting (=]) and I'm still stuck, so
>here goes.
>
>I want to have a list of objects, which form a "stack" of current
>operations being
>performed.  Each time a new operation needs to take place, the handler
>"getStackPointer" is called, which finds an empty space in a linear
>list, creates a new instance of an object, and then returns the position
>in the list of the new object, ie:
>
>(my stack is declared on startmovie to be a linear list of 25 positions)
>
>global myStack
>
>on getStackPointer
>       counter = 1
>       repeat with counter = 1 to myStack.count
>               if myStack[counter] = 0 then
>                  myStack[counter] = new(script "myScript")
>                  return counter
>               end if
>       end repeat
>end getStackPointer
>
>Everything seems straightforward here, and the script compiles without
>syntax errors.  However, when I run the movie and call the handler
>myStack[counter] is always returned as VOID.  Since the list is filled
>with 0's at startMovie, I at least know the value is being changed.  Why
>is it not changed to the new script instance?  Do I have a logic error
>that anyone can see, or is this just illegal?
>
>~matt desimone
>[EMAIL PROTECTED]
>www.syrupnyc.com
>
>
>[To remove yourself from this list, or to change to digest mode, go 
>to http://www.penworks.com/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!]


-- 

Lingo / Director / Shockwave development for all occasions. 
          
   (Home-made Lingo cooked up fresh every day just for you.)
[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/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