Log in

View Full Version : Resolved the % used as an opperator



evan
12-11-2008, 05:18 PM
A tutorial from flashandmath.com that demonstrates how to load swfs into another swf.

line by line I understand how it works but the one intresting part is the "%" used as an opperator.

Here is part of that code:

function runOnce(e:Event):void {
if (thisMC.currentFrame == thisMC.totalFrames) {
thisMC.removeEventListener(Event.ENTER_FRAME, runOnce);
index = (index + 1)%(clips.length);
nextClip();
}
}

can anyone explain that?

Medyman
12-11-2008, 08:44 PM
"%" (modulo) represents the remainder of the two expressions when divided.

The livedocs (http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/operators.html#modulo) offer a better explanation.