flash不像其它.net的控件那样可以用“~路径”在生成网页时自己产生正确的相对路径,那在用户控件里面有什么好方法来解决相对路径的问题?我现在是用
<PARAM NAME="Src" VALUE="<%=Application["SystemVirtualDirectory"].ToString()%>/images/2008index/sg.swf">
这种方法实现的,不知各位还有没有其它高招?

解决方案 »

  1.   

    在用的:<object id="obj1" border="0" classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000"
                            codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
                            height="42" style="width: 940px"><param name="movie" value="../QW.swf" /><param name="quality" value="High" />
                            </object>
      

  2.   

    你首先要给他添加属性变为服务器端可以找到的控件:<PARAM NAME="Src" runat="server" ID="MyFlashParam" VALUE=" <%=Application["SystemVirtualDirectory"].ToString()%>/images/2008index/sg.swf"> 然后就可以在代码中写:this.MyFlashParam.Attributes["VALUE"]= this.ResolveUrl("~/images/2008index/sg.swf");
      

  3.   

    哦,应该写为:   <PARAM NAME="Src" runat="server" ID="MyFlashParam" /> 这就够了,value属性动态生成。要注意,一定要以“/>”结尾,因为vs会去检验服务器端控件的结尾是否匹配。我想你的写法可能也是可以的,在表达式中不要使用Application[...]而是使用ResolveUrl。
      

  4.   

    恩,我测试了一下,可以:<%@ Page Language="C#"  %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>无标题页</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <object>
            <param VALUE="<%= this.ResolveUrl("~/aaaa/bbbb.swf") %>" >
        </object>
        </form>
    </body>
    </html>