0

我缺少简单的逻辑或简单的代码。我想在 Flash as3 中制作一个贷款计算器,例如 http://activeden.net/item/loan-payment-calculator-with-slider-as3/897727

我有一个 Flash 文件,它打印一个被拖过一条线的对象的 x。

scrubber.x = _point.x;
tf1.text = String(_point.x);

我想要做的是根据 x 打印出一定数量(比如说从 1 到 20 000)。我知道我缺少一些基本的 as3,但我在其他论坛上找不到任何东西。

4

1 回答 1

0

你必须使用百分比公式

var a:Number = 320;//this is the amount on the line - you have to calculate it taking the position of the scrubber in relation to the position of the line
var b:Number = 640;//this is the 100%, 640 is the example and it will be the width of your "line"
var max_loan:Number = 10000;
var p:Number = a/b;//this is the percentage value, here it will be 320/640=0.5

var available_loan:Number = max_loan * p;//this is what you will display, here it will be 5000;
于 2013-01-08T08:08:46.953 回答