public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }       private void axShockwaveFlash1_Enter(object sender, EventArgs e)
        {
            byte[] bb = global::flash2.Properties.Resources._18;
            string savePath = Path.GetDirectoryName(Application.ExecutablePath) + "\\12233.swf";
            FileStream fs = new FileStream(savePath, FileMode.Create, FileAccess.Write);
            BinaryWriter bw = new BinaryWriter(fs);
            bw.Write(bb);
            bw.Close();
            fs.Close();
            fs.Dispose();
            this.axShockwaveFlash1.Movie = savePath;
           this.axShockwaveFlash1.Play();
          
        }
我对上面的解释一下,_18是添加的项目资源,“\\12233.swf”是debug下的flash,_18和“12233.swf”里面的内容一样,我将项目打包后,安装,运行exe文件,它自动创建一个flash,叫“\\12233.swf”,我不知道为什么???
你有好的方法请留下,或者修改以上代码,但必须打包安装后可以运行,修改原来的flash也要可以运行(即不受原来的flash路径限制)

解决方案 »

  1.   

    因为本机没有FLASH,必须找到它的路径
    function show_flash_index(){
    /*
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="432" height="275">
                      <param name="movie" value="flash/index.swf" />
                      <param name="quality" value="high" />
                      <embed src="flash/index.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="432" height="275"></embed>
      </object>
    */
    document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-44455354000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='432' height='275'>");
    document.write("<param name='movie' value='flash/index.swf'>");
    document.write("<param name='quality' value='high'>");
    document.write("<param name='wmode' value='transparent'>");
    document.write("<embed src='flash/index.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='432' height='275' wmode='transparent'></embed>");
    document.write("</object>");
    }function show_flash_player(value){ /*
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="436" height="305">
                        <param name="movie" value="flash/Player.swf" />
                        <param name="quality" value="high" />
                        <param name="SCALE" value="exactfit" />
    <PARAM NAME="FlashVars" VALUE="myURL=flv0,<%=guid+flashKey%>"> 
                        <embed src="flash/player.swf" width="436" height="305" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" scale="exactfit"></embed>
                      </object> */
    document.write("<object id='myFlash' classid='clsid:D27CDB6E-AE6D-11cf-96B8-44455354000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0'  width='436' height='305' >");
    document.write("<param name='movie'value='flash/Player.swf'>");
    document.write("<param name='quality' value='high'>");
    document.write("<param name='SCALE' value='exactfit' />");
    //document.write("<PARAM NAME='FlashVars' VALUE='myURL="+value+"'> ");
    document.write("<embed src='flash/player.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'   width='436' height='305' scale='exactfit' wmode='transparent'></embed>");
    document.write("</object>");
    alert(":"+value);
     
    window.document.myFlash.SetVariable("FlashVars", value);}
      

  2.   

    运行exe文件
    axShockwaveFlash1_Enter 被执行了吧
    然后就生成了12233.swfEnter这个事件要做什么