是否可以将 ASP.Net aspx.cs 变量加载为 flex 中的 flashvar

发布于 2024-10-12 17:40:59 字数 1420 浏览 3 评论 0 原文

我有一个 aspx 网页,成功托管了一个 Flex 应用程序。页面上有一些在加载时生成的变量。我想知道是否有办法获取这些变量并在 Flex 应用程序中使用它们。

我尝试了一些方法,但最新的如下所示:

<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='100%' height='100%' id='FlexApp'title='FlexApp'>
      <param name='movie' value='FlexApp.swf' />
      <param name='quality' value='high' />
      <param name='wmode' value='opaque' />
      <param name='AllowScriptAccess' value='always' />
      <param name='swfversion' value='9.0.45.0' />
      <embed src=FlexApp.swf' AllowScriptAccess='always' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='100%' height='100%' 
flashVars='param1='+<%=param1%>'&param2='+<%=param2%>
    </object>

其中 param1param2page.aspx.cs 中的全局变量文件如下:

public string param1,param2;
protected void Page_Load(object sender, EventArgs e)
{
    param1 ="Something"
    param2 = "Else"
}

在要测试的 Flex 应用程序中,

import  mx.core.FlexGlobals;

private void Init()
{
    Alert.show(FlexGlobals.topLevelApplication.parameters.param1);
}

当我加载 Flash 应用程序时,我会收到一个警报对话框,其中“确定”按钮的文本为“void”。显然它没有读取变量...有什么解决方案吗?

我需要这个的原因是有一个功能 Flex 无法访问,但它所在的网页可以访问,所以我想将结果发布在 Flex 应用程序中。

I have a aspx webpage that is successfully hosting a flex app. On the page there is some varables that are generated at load time. I was wondering if there was a way to take these variables and use them in the flex app.

I have tried a couple of things but the latest one looks like this:

<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='100%' height='100%' id='FlexApp'title='FlexApp'>
      <param name='movie' value='FlexApp.swf' />
      <param name='quality' value='high' />
      <param name='wmode' value='opaque' />
      <param name='AllowScriptAccess' value='always' />
      <param name='swfversion' value='9.0.45.0' />
      <embed src=FlexApp.swf' AllowScriptAccess='always' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='100%' height='100%' 
flashVars='param1='+<%=param1%>'¶m2='+<%=param2%>
    </object>

Where param1 and param2 are global variables in the page.aspx.cs file something like this:

public string param1,param2;
protected void Page_Load(object sender, EventArgs e)
{
    param1 ="Something"
    param2 = "Else"
}

In the flex app to test i have

import  mx.core.FlexGlobals;

private void Init()
{
    Alert.show(FlexGlobals.topLevelApplication.parameters.param1);
}

When I load the flash app i get an alert dialog with the "ok" button having the text "void". Obviously it is not reading the variables... Is there any solution to this?

The reason that I need this, is there's a function that flex cannot access but the webpage that it is hosted on can so i wanted to post the result in the flex app.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倒带 2024-10-19 17:40:59

除非这是一个拼写错误,否则您是否忘记了嵌入标记上的结束 /> ?另外,您不需要像内联字符串一样构建 flashVars,请尝试使用一个连续字符串 flashVars='param1=<%=param1 %>¶m2=<%=param2 %>'< /code> 像这样:

<embed 
    src='FlexApp.swf'
    AllowScriptAccess='always' 
    pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'
    type='application/x-shockwave-flash'
    width='100%'
    height='100%' 
    flashVars='param1=<%=param1 %>¶m2=<%=param2 %>' />

标签 在哪里?

<param name='flashvars' value='param1=<%=param1 %>¶m2=<%=param2 %>'>

请按照这些步骤进行 x 浏览器 flash 嵌入


<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='100%' height='100%' id='FlexApp'title='FlexApp'>
    <param name='movie' value='FlexApp.swf' />
    <param name='quality' value='high' />
    <param name='wmode' value='opaque' />
    <param name='AllowScriptAccess' value='always' />
    <param name='swfversion' value='9.0.45.0' />
    <param name='flashvars' value='param1=<%=param1 %>¶m2=<%=param2 %>'>
    <embed 
        src='FlexApp.swf'
        AllowScriptAccess='always' 
        pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'
        type='application/x-shockwave-flash'
        width='100%'
        height='100%' 
        flashVars='param1=<%=param1 %>¶m2=<%=param2 %>' />
</object>

unless this is a typo, did you forget the closing /> on the embed tag? Also, you don't need to build the flashVars like a string inline, try one continuous string flashVars='param1=<%=param1 %>¶m2=<%=param2 %>' like this:

<embed 
    src='FlexApp.swf'
    AllowScriptAccess='always' 
    pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'
    type='application/x-shockwave-flash'
    width='100%'
    height='100%' 
    flashVars='param1=<%=param1 %>¶m2=<%=param2 %>' />

where is the <object> tags <param name="flashvars"...?

<param name='flashvars' value='param1=<%=param1 %>¶m2=<%=param2 %>'>

follow these steps for x-browser flash embedding


<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='100%' height='100%' id='FlexApp'title='FlexApp'>
    <param name='movie' value='FlexApp.swf' />
    <param name='quality' value='high' />
    <param name='wmode' value='opaque' />
    <param name='AllowScriptAccess' value='always' />
    <param name='swfversion' value='9.0.45.0' />
    <param name='flashvars' value='param1=<%=param1 %>¶m2=<%=param2 %>'>
    <embed 
        src='FlexApp.swf'
        AllowScriptAccess='always' 
        pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'
        type='application/x-shockwave-flash'
        width='100%'
        height='100%' 
        flashVars='param1=<%=param1 %>¶m2=<%=param2 %>' />
</object>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文