Apache flex Flex中的FlashVars,获取错误?
我更改了html模板以包含FlashVar,如下所示:Apache flex Flex中的FlashVars,获取错误?,apache-flex,flashvars,Apache Flex,Flashvars,我更改了html模板以包含FlashVar,如下所示: if (hasRequestedVersion) { // if we've detected an acceptable version // embed the Flash Content SWF when all tests are passed AC_FL_RunContent( "src", "${swf}", "FlashVars", "product_id
if (hasRequestedVersion) {
// if we've detected an acceptable version
// embed the Flash Content SWF when all tests are passed
AC_FL_RunContent(
"src", "${swf}",
"FlashVars", "product_id=4958",
"width", "${width}",
"height", "${height}",
"align", "middle",
"id", "${application}",
"quality", "high",
"bgcolor", "${bgcolor}",
"name", "${application}",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
}
我尝试在我的应用程序中访问它们,如下所示:
private static var _PID:uint = Application.application.parameters.product_id;
但我得到了这个错误:
错误#1009:无法访问属性
或空对象引用的方法
我不知道为什么?有什么想法吗?这是因为我在flex调试器中才发生的吗
谢谢 从未这样做过,但在我看来,参数是FlashVars而不是product_id我敢打赌,这是因为这是一个静态变量-赋值可能发生在应用程序初始化之前 尝试将该值分配给
creationComplete
处理程序中的_PID;然后保证应用程序被初始化