Flex中的FlashVars,收到错误?

时间:2009-12-02 20:36:22

标签: flex flashvars

我将我的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:无法访问媒体资源   或null对象引用的方法。

我不知道为什么?有任何想法吗?这是因为我在flex调试器中吗?

谢谢!

2 个答案:

答案 0 :(得分:2)

我敢打赌,因为这是一个静态变量 - 分配可能在应用初始化之前发生。

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

答案 1 :(得分:0)

从来没有这样做,但它看起来像参数是FlashVars而不是product_id