// JavaScript syntax
put(7 % 4);
The result is 3.
The following handler sets the ink effect of all odd-numbered sprites to
effect specified by the number 0. First the handler checks whether the sprite in the variable
is an odd-numbered sprite by dividing the sprite number by 2 and then checking
mySprite
whether the remainder is 1. If the remainder is 1, the result for an odd-numbered number, the
handler sets the ink effect to
-- Lingo syntax
on setInk
repeat with mySprite = 1 to _movie.lastChannel
if (mySprite mod 2) = 1 then
sprite(mySprite).ink = 0
else
sprite(mySprite).ink = 8
end if
end repeat
end setInk
// JavaScript syntax
function setInk() {
for (mySprite=1; mySprite<=_movie.lastChannel; mySprite++) {
if ((mySprite % 2) == 1) {
sprite(mySprite).ink = 0;
} else {
sprite(mySprite).ink = 8;
}
}
}
This handler regularly cycles a sprite's cast member among a number of bitmaps:
-- Lingo syntax
on exitFrame
global gCounter
-- These are sample values for bitmap cast member numbers
theBitmaps = [2,3,4,5,6,7]
-- Specify which sprite channel is affected
theChannel = 1
-- This cycles through the list
gCounter = 1 + (gCounter mod theBitmaps.count)
sprite(theChannel).memberNum = theBitmaps[gCounter]
_movie.go(_movie.frame)
end
// JavaScript syntax
function exitFrame() {
// these are sample values for bitmap cast member numbers
theBitmaps = new Array(2,3,4,5,6,7);
// specify which sprite channel is affected
theChannel = 1;
// this cycles through the list
_global.gCounter = 1 + (_global.gCounter % theBitmaps.length);
sprite(theChannel).memberNum = theBitmaps[_global.gCounter];
_movie.go(_movie.frame);
}
.
copy
, which is the ink
copy
mod
613
Need help?
Do you have a question about the DIRECTOR MX 2004-DIRECTOR SCRIPTING and is the answer not in the manual?
Questions and answers