Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript (http://www.flasher.ru/forum/forumdisplay.php?f=5)
-   -   решите задачу (http://www.flasher.ru/forum/showthread.php?t=63213)

ctepx 18.09.2004 19:27

решите задачу
 
пусть есть какое-то целое число выдающееся random-мом
нужно определить како выпалочисло (четное или не четное)

и код должен быть не большой

Nox Noctis 18.09.2004 19:34

хинт: четное число делится на два без остатка. нечетное - с остатком.

можно поделить на два и посмотреть что получится.

а можно воспользоваться этим:
Цитата:

% (modulo)

Availability
Flash Player 4.

Usage
expression1 % expression2

Parameters
None.

Returns
A number.

Description
Operator (arithmetic); calculates the remainder of expression1 divided by expression2.

Example
The following numeric example uses the modulo (%) operator:

trace(12%5); // traces 2

The trace returns 2, rather than 12/5 or 2.4, because the modulo (%) operator returns only the remainder.
интенсивнее думаем самостоятельно :)

Штрек 19.09.2004 04:46

Очень удобно для уменьшения fps мувика... :p

MovieClip.prototype.umenshenie_fps = function(n_raz) {
this.stop();
var n = 0;
this.onEnterFrame = function() {
n++;
if (n%n_raz == 0) {
if (this._currentframe != this._totalframes) {
this.gotoAndStop(this.nextFrame());
} else {
this.gotoAndStop(1);
}
}
};
};


Часовой пояс GMT +4, время: 07:32.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.