Andy,
I'm not sure I fully understand your approach, but if it works for
you - great. However, I do want to comment a line of code in your
suggestion, specifically:
if objectP(myObj) AND myObj.pFlag = TRUE then
There are two problems with this, one serious and the other is a
matter of style.
Unfortunately, Lingo does not "short circuit" if tests. That means
that the test is fully evaluated before a determination of TRUE or
FALSE is made. So, consider what would happen if "myObj" is not an
object - the objectP(myObj) evaluates to FALSE, but myObj.pFlag would
generate a script error because myObj is not an object. If you want
to do something like this, you must use a nested if:
if objectp(myObj) then
if myObj.pFlag then
...
Second, your "myObj.pFlag" is a case where you are reaching into an
object and grabbing the value of an object's properties. We have had
discussions in the past here on Lingo-L about this. Many people
commented that they felt that it is OK to get the value of such a
property, but it is not OK to set such a value. Again, I am strongly
of the opinion that if you want to get the value of a property of an
object, you should have an "accessor" method to do so. In this case,
it would be:
if objectp(myObj) then
if myObj.mGetpFlag() then
...
And the object would have a mGetpFlag method which simply returned
the value of the property pFlag.
Irv
At 4:41 PM -0500 6/27/01, Andy Driscoll wrote:
>I had to do something similar for some network opereations, so here's what you
>can do...
>
>Instantiate your objects into a list, call the handler in each object one at a
>time by stepping the index, or instantiate each object one at a time.
>Have the object's handler set a flag (or property) when the operation is
>complete.
>Next have an exitframe script keep checking for the status of the
>current objects
>flag.
>When it sets the flag, move on to the next object/task.
>
>here's a Cliff's notes version:
>
>myObj = new(script "myParentScript", param, param, etc...)
>myObj.pFlag = FALSE (or you could set any number of ways or leave
>the value null
>until you set to TRUE, whatever...)
>
>on objectHandler me, whatever
> -- do something
> -- do something else
> myObj.pFlag = TRUE
>end
>
>on exitframe
> global myObj, myObj2, myObj3
> if objectP(myObj) AND myObj.pFlag = TRUE then
> -- call next object
> else if objectP(myObj2) AND myObj2.pFlag = TRUE then
> -- call next object
> else if objectP(myObj3) AND myObj3.pFlag = TRUE then
> -- you're outa here...
> -- clean up or whatever
> end if
>end
>
--
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/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!]