I was trying to use a say block for debugging an initialise method for an instance but it doesn't work
I understand that this could be that the instance isn't fully created until after the intialise method returns
if this is the way it has to be - OK - but any suggestions for a workaround? (apart from developer mode debugging)
Say doesn't work during instance intialise method
Moderator: MSandro
Re: Say doesn't work during instance intialise method
Yep, that's exactly right. The initialize method get's run before the instance is added to the stage, so it can't do "say" and many other blocks that need the instance to be in the stage. You also can't start an "animate" (forever) loop in the instance method.I understand that this could be that the instance isn't fully created until after the intialise method returns
The solution to both of these things is to send a message to the newly created instance like this: The newly created instance is sent the message "start" after it has been added to the stage. Any "when I receive 'start'" hat blocks are started, and they can do anything a normal instance can do, including using the "say" block, starting "animate" loops, etc.
This is the equivalent to the "when I start as a clone" mechanism.