I can't imagine what you have that code attached to. Why don't you try something like the following, attached to each individual sprite:
property spriteNum property my on beginSprite me my = sprite(spriteNum) end on mouseUp me aTimeout = timeout().new(string(me), 5000, #timeout_callback, me) end on timeout_callback me, aTimeout aTimeout.forget() my.member = member("Jellyfish_new_1") end
I am receiving this error now:
Script error: Object expected
aTimeout = timeout().new(string(me), 5000, #timeout_callback, me)
It seems like the same sort of error? I am using Director 11.5 if that makes any difference. I know the timeout functions have changed across earlier versions.
Do you have the script set as a behavior and attached to each of your 4 sprites?
Does the debug window tell you anything useful when you choose to open it?
FWIW when I attach the code I posted to a sprite on the stage and click it, there is no script error in D11.5.
Yes, it is a behavior and is attached to my sprites. I even removed all the other behaviors from the sprites in case they were clashing somehow, but no change.
The debug window doesn't say anything specific, no. Although the value for aTimeout is <Void>, and I'm not sure if it's supposed to be that way or not.
1 person found this helpful
Do you have a (movie) script or a (movie) handler in your cast libraries anywhere named either 'timeout' or 'new'?
What happens if you issue the following from your message window:
aTimeout = timeout().new("name", 1000, #callback, 0)
No, I don't have any movie scripts currently. And when I put that in my message window, it gives me the same "object expected" error.
This is all very strange. Would you like to send me the movie, so that I can see directly what is going on?
You can email it to me at james dot newton at openspark dot com.
Is it possible you're updating an older movie that has its scriptExecutionStyle set to 9? What does the following tell you when executed from the message window:
put the scriptExecutionStyle
If it returns 9, change this by executing
the scriptExecutionStyle = 10
again from the message window and save your file. Timeouts should now work as expected (test and confirm).
It is running in 10. But it looks like I found the problem. There was indeed a movie script I had from a previous attempt that was confusing it. I have a ton of behaviors on my list I was testing out and somehow missed that one. Thanks so much for your help!