2

我更改了我的 html 模板以包含 flashvars,如下所示:

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 调试器中而发生吗?

谢谢!!

4

2 回答 2

2

我敢打赌这是因为这是一个静态变量——赋值可能是在应用程序初始化之前发生的。

尝试将值分配给处理程序内部的 _PID creationComplete;然后保证应用程序被初始化。

于 2009-12-02T21:09:11.150 回答
0

从来没有这样做过,但在我看来参数是 FlashVars 而不是 product_id

于 2009-12-02T20:45:35.503 回答