I am having a problem creating a behavior or script to delete new sprites created in channels. I have a behavior script that creates new sprites using the following (simplified) script:
First, a Beginsprite creates a gChannel_list and assigns a beginning gChannel value. pSprite is used to establish the sprite that in the mousedown is clickon.
on Beginsprite me
gChannel = 70
pSprite = sprite(Spritenum)
In the mousedown the gChannel is incremented and the newly created channel is added to the gChannel_list.
on Mousedown me
gChannel = gChannel + 1
theChannel = addat(gChannel_List,gChannel)
themember = pSprite.member
sprite(gChannel).width = thememberW
sprite(gChannel).height = thememberH
sprite(gChannel).rotation = theMemberR
sprite(gChannel).moveablesprite = 1
sprite(gChannel).ink = 36
After creation of several sprites based on the the gChannel, the following globals, for example, are returned.
-- Global Variables --
gChannel_List = [71,72,73,74]
gChannel = 74
My problem is that I am unable to delete these created gchannel sprites with a lingo command. Deleting them from the list, for example, using deletat(gChannel,1), does nothing to remove them from the stage (they do disappear from the list). And while I can display their attributes such as width [n=getat(gChannel_list, x); put sprite(n).width], nothing seems to relate to deleting these gchannel sprites.
How is it done?
Hope this is enough information. If not, please let me know. I can provide whatever you might need. Please help.
You have used 'makeScriptedSprite()' to add a sprite to a channel. Try using the reverse: 'removeScriptedSprite()'
DUH! Didn't even know that a 'removeScriptedSprite()' command existed! Very logical. It works perfectly. Thanks again so very much.