저는 프로젝트에서 작업 중이며 연속으로 5 개의 이미지가 있습니다. 이러한 이미지는 if, if else, else 문의 결과에 따라 변경해야합니다 (빨간색, 노란색, 녹색). 나는 그것을 할 몇 가지 자바 스크립트가 있지만 Flex 4.6에서 사용하기 위해 ActionScript3에서 필요합니다. JavaScript-- VVFlex 4.6의 if 문을 기반으로 이미지를 스왑합니다.
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";
}
덕분에, 나는 자바 스크립트와 플렉스 모두 새로운 해요.
입니다 :이 내장 일단, 당신은
source
속성을 설정할 수 있습니다 (소스 = "red_led.png")] [바인딩] 공개 VAR은 redLed : 등급 [삽입 (소스 = "yellow_led.png")] [바인딩] 공개 VAR은 yellowLed : 등급 를 공용 기능 lightsChange : 무효 { \t var imgObj : BitmapAsset = new greenLed() as BitmapAsset; \t \t 경우 (ratioGA <= 12.5) \t \t \t { GA.source = greenLed; \t한다} else \t 경우 ((ratioGA> 12.5) && ratioGA <= 18.75)) { \t \t \t GA.source = yellowLed; \t한다} else \t 경우 (ratioGA> 20,625) \t \t \t { GA.source = redLed; \t} }'그것을 위해 – paynekidd내 MXML : ' \t
S : SkinnableContainer>'내가 잘못 뭐하는 거지 ? – paynekiddlightsChange의 정의에서 누락 된'()'을 제외하고 내가 틀리게 말할 수있는 것은 없습니다. 현재 더 이상 잘못된 코드 나 코드를 제공해야합니다. – CheeseWarlock