Increase the number of sprite buy clicking over a button
hallo need following problem.
i have several sprite out of stage , need bring sprite, 1 @ time, inside stage, without write long script this:
on mouseup me
if sprite(5).loch = 512 then
sprite(6).loch = 512
and on ...
i must use script several time several sprite, i'm looking solution.
is there way (more efficent) increase 1 number of sprite every click on button?
for more information: need of button decrease number of sprite, supose if there solution of increase can arrange script.
i've tried little lingo knowlege, i'm without solution.
thanks
generally when want share information across multiple objects use global variable. keep code clean suggest using movie level functions handle bounds checking , other details might crop up. movie script be:
-- movie script
global gcurspritenum, gminspritenum
on preparemovie
gminspritenum = 10 -- use starting sprite number minus 1.
gcurspritenum = gminspritenum
end preparemovie
on getnextsprite
gcurspritenum = gcurspritenum + 1
if gcurspritenum > _movie.lastchannel
gcurspritenum = _movie.lastchannel
put "getnextsprite() attempted exceed maximum available sprite channels."
end if
return sprite(gcurspritenum)
end getnextsprite
on decrementnextsprite
gcurspritenum = gcurspritenum - 1
if gcurspritenum < gminspritenum gcurspritenum = gminspritenum
end decrementnextsprite
you create 2 behavior scripts call 2 functions:
-- increment behavior
on mouseup me
nextsp = getnextsprite()
put nextsp
end
and...
-- decrement behavior
on mouseup me
decrementnextsprite()
end
More discussions in Director Lingo
adobe
Comments
Post a Comment