Apache flex 如何提高此Adobe Flex脚本的速度?
我正在开发我的第一个AdobeFlex应用程序,其中有一个代码部分似乎运行得非常慢(但它确实运行正常!) CC_输出是一个文本控件,所有其他控件都是复选框(CC、CC_持续时间等) 任何帮助都将不胜感激Apache flex 如何提高此Adobe Flex脚本的速度?,apache-flex,adobe,flex3,Apache Flex,Adobe,Flex3,我正在开发我的第一个AdobeFlex应用程序,其中有一个代码部分似乎运行得非常慢(但它确实运行正常!) CC_输出是一个文本控件,所有其他控件都是复选框(CC、CC_持续时间等) 任何帮助都将不胜感激 私有函数updateLabel():void{ var HPI_分数:数字=0; 如果(CC.selected){CC_Output.text=“CC/HPI-Brief”;} 如果(!CC.selected){ CC_Output.text=“CC/HPI-不充分”; }否则{ 如果(C
私有函数updateLabel():void{
var HPI_分数:数字=0;
如果(CC.selected){CC_Output.text=“CC/HPI-Brief”;}
如果(!CC.selected){
CC_Output.text=“CC/HPI-不充分”;
}否则{
如果(CC_Duration.selected){HPI_分数=HPI_分数+1;}
如果(CC_Location.selected){HPI_分数=HPI_分数+1;}
如果(CC_Quality.selected){HPI_分数=HPI_分数+1;}
如果(CC_Severity.selected){HPI_分数=HPI_分数+1;}
如果(CC_Timing.selected){HPI_分数=HPI_分数+1;}
如果(CC_Context.selected){HPI_Score=HPI_Score+1;}
如果(CC_Modify.selected){HPI_分数=HPI_分数+1;}
如果(CC_Assoc.selected){HPI_Score=HPI_Score+1;}
如果(CC_Chronic_Dx.selected){HPI_分数=HPI_分数+4;}
如果(HPI_分数>3){CC_Output.text=“CC/HPI-Extended”;}
}
}
为您想要做的事情构建一个组件,并将该组件导入主应用程序并使用。然后文件大小将减小,性能将提高。奇怪的是,它运行缓慢。代码中没有发生任何特殊情况 是的,代码不干净,但这并不影响这里的性能
尝试运行Flex Profiler并找出可能存在的瓶颈(如果存在)。在真空中,这些代码在我的笔记本电脑上运行良好(如果我添加了CC控件) 我重新编写了一点,以快速退出,这可能会在某些情况下有所改进
private function updateLabel():void
{
const messageInadequate:String = "CC/HPI - Inadequate";
const messageBrief:String = "CC/HPI - Brief";
const messageExtended:String = "CC/HPI - Extended";
if (!CC.selected)
{
CC_Output.text = messageInadequate;
return;
}
if (CC_Chronic_Dx.selected)
{
CC_Output.text = messageExtended;
return;
}
var HPI_Score:int = 0;
if (CC_Duration.selected) HPI_Score++;
if (CC_Location.selected) HPI_Score++;
if (CC_Quality.selected) HPI_Score++;
if (CC_Severity.selected) HPI_Score++;
if (CC_Timing.selected) HPI_Score++;
if (CC_Context.selected) HPI_Score++;
if (CC_Modify.selected) HPI_Score++;
if (CC_Assoc.selected) HPI_Score++;
if (4 > HPI_Score)
{
CC_Output.text = messageBrief;
}
else
{
CC_Output.text = messageExtended;
}
}
private function updateLabel():void
{
const messageInadequate:String = "CC/HPI - Inadequate";
const messageBrief:String = "CC/HPI - Brief";
const messageExtended:String = "CC/HPI - Extended";
if (!CC.selected)
{
CC_Output.text = messageInadequate;
return;
}
if (CC_Chronic_Dx.selected)
{
CC_Output.text = messageExtended;
return;
}
var HPI_Score:int = 0;
if (CC_Duration.selected) HPI_Score++;
if (CC_Location.selected) HPI_Score++;
if (CC_Quality.selected) HPI_Score++;
if (CC_Severity.selected) HPI_Score++;
if (CC_Timing.selected) HPI_Score++;
if (CC_Context.selected) HPI_Score++;
if (CC_Modify.selected) HPI_Score++;
if (CC_Assoc.selected) HPI_Score++;
if (4 > HPI_Score)
{
CC_Output.text = messageBrief;
}
else
{
CC_Output.text = messageExtended;
}
}