1

私はプロジェクトに取り組んでおり、5つの画像が連続しています。これらの画像は、if、if else、elseステートメントの結果に基づいて変更する必要があります(赤、黄、緑)。私はそれを行うJavaScriptをいくつか持っていますが、Flex4.6で使用するためにActionScript3で必要です。JavaScript-- VV

if ((billableMonthHours/targetMTD) >= 1)
{
    MTDstatus.src = "green_led.png";
}
else if (((billableMonthHours/targetMTD) < 1) && ((billableMonthHours/targetMTD) >= 0.95))
{
    MTDstatus.src = "yellow_led.png";
}
else //if ((billableMonthHours/targetMTD) < 0.95)
{
    MTDstatus.src = "red_led.png";
}

if ((billableQuarterHours/targetQTD) >= 1)
{
    QTDstatus.src = "green_led.png";
}
else if (((billableQuarterHours/targetQTD) < 1) && ((billableQuarterHours/targetQTD) >= 0.95))
{
    QTDstatus.src = "yellow_led.png";
}
else //if ((billableQuarterHours/targetQTD) < 0.95)
{
    QTDstatus.src = "red_led.png";
}

if ((totalRecordedHours-mtdWorkingHours) >= 0)
{
    UTDcards.src = "green_led.png";
}
else if (((totalRecordedHours-mtdWorkingHours) >= -4) && ((totalRecordedHours-mtdWorkingHours) < 0))
{
    UTDcards.src = "yellow_led.png";
}
else //if ((totalRecordedHours-mtdWorkingHours) < -4)
{
    UTDcards.src = "red_led.png";
}

おかげで、私はJavaScriptとFlexの両方に不慣れです。

4

1 に答える 1

2

画像を Flash/Flex にロードする方法がわからない場合は、ここから始めるとよいでしょう。コンポーネントは、画像を Flex アプリケーションに配置する通常のimage方法であり、埋め込みにより変更がより迅速に行われますが、画像が数個しかない場合は問題になりません。埋め込まれたら、sourceプロパティを設定できます。

[Embed(source="green_led.png")]
[Bindable]
public var greenLed:Class;
// ...etc

if ((billableMonthHours/targetMTD) >= 1)
{
MTDstatus.source = greenLed;
}
else if (billableMonthHours/targetMTD) >= 0.95)
// ...etc
于 2012-05-31T23:20:35.210 に答える