Oleh: zhudie81 | Juni 20, 2010

Membatasi Jumlah Digit Desimal Adobe Flash

Think of how you would do it…

Rather difficult to do with a program… you and I would focus our attention to the 7.. to the 6… to the 6… to the 6… etc.

Code:
3.456666667
3.45666667
3.4566667
3.456667
3.45667
3.4567
3.457
3.46

In Flash, you would want to loop through all the digits and ask whether they are greater than or equal to 5 if so the next is incremented. Also, interpretting where you wish to stop… tenths in this case.

Is this what you are looking for?

Actionscript:

myText = Math.round(myText * 100) / 100;

Tinggalkan Balasan

Please log in using one of these methods to post your comment:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

Kategori

%d blogger menyukai ini: