我已经创建了一个C sharp项目,在其中我添加了一个ShockwaveFlashObject来播放我的swf文件。我面临的问题是,当我为我的项目创建安装程序时,它在安装时在我的机器上可以正常工作,但在我的笔记本电脑上,swf加载正确,但不响应_FSCommand。我不能使用try和catch块,因为它没有进入FSCommand句柄。我需要在安装时捆绑一些东西吗?我使用的笔记本电脑是全新的,我希望它是这样的,这样我就可以知道正确工作所需要的所有东西,这样我就可以在我的安装程序中添加先决条件。同样idk如果这个信息是任何用途,但我正在使用高级安装程序为我的项目构建和exe。
PS我已经添加了类似下面的代码,以了解FSCommand是否被执行。
MessageBox.Show("step 1/2/3");下面是完整的代码。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
using System.IO;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Globalization;
namespace WindowsFormsApplication1
{
public partial class frmFlashIntro : Form
{
public Form FormfrmMainRef { get; set; }
public frmFlashIntro()
{
InitializeComponent();
axShockwaveFlash1.Playing = true;
FormBorderStyle = FormBorderStyle.None;
WindowState = FormWindowState.Maximized;
string currentPath = Directory.GetCurrentDirectory();
axShockwaveFlash1.Movie = "file://\\" + currentPath + "\\intro.swf";
}
private void axShockwaveFlash1_FSCommand(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FSCommandEvent e)
{
MessageBox.Show("step 1");
string btn = e.command.ToString();
MessageBox.Show("step 2");
if (btn == "play")
{
MessageBox.Show("step 3");
try
{
MessageBox.Show("step 4");
var form2 = new frmMain();
MessageBox.Show("step 5");
this.Hide();
MessageBox.Show("step 6");
form2.Show();
}
catch (Exception ex) { MessageBox.Show(ex.ToString()); }
}
if (btn == "syllabus")
{
MySqlConnection con = new MySqlConnection(Properties.Settings.Default.conString);
con.Open();
Syllabus_usageInformation syl = new Syllabus_usageInformation(this);
MySqlCommand cmd = new MySqlCommand("SELECT ImageFiles FROM misc WHERE id=1", con);
byte[] img = (byte[])cmd.ExecuteScalar();
string strFn = Convert.ToString(DateTime.Now.ToFileTime());
FileStream fs = new FileStream(strFn, FileMode.CreateNew, FileAccess.Write);
fs.Write(img, 0, img.Length);
fs.Flush();
fs.Close();
con.Close();
syl.kpImageViewer1.OpenButton = false;
syl.kpImageViewer1.ImagePath = strFn;
syl.Show();
this.Hide();
}
if (btn == "usageInformation")
{ }
}
}
}发布于 2011-09-17 01:35:22
您的笔记本电脑上是否安装了flash player ActiveX控件?您必须安装它,否则将无法播放您的.swf文件。
https://stackoverflow.com/questions/7370026
复制相似问题