Hi all, I am experimenting Walter Wang's code to try to load .swf file from embedded resource to webbrowser in window form but get error:
"An object reference is required for the non-static field, method, or property'System .Web.UI.Page.Cl ientScript.get' "
This is what I did:
checked with GetManifestReso urceNames(), 'swfER.Resource s.Maze.swf' was listed
in assemblyinfo.cs , I entered:
[assembly: WebResource("sw fER.Resources.M aze.swf", "applicatio n/x-shockwave-flash")]
in WebBrowserForm
I noticed that Page had no ClientScript property in my IDE.
Please, inform me what to do to make this work, if you can. Really appreciate it. Thank's in advance.
"An object reference is required for the non-static field, method, or property'System .Web.UI.Page.Cl ientScript.get' "
This is what I did:
checked with GetManifestReso urceNames(), 'swfER.Resource s.Maze.swf' was listed
in assemblyinfo.cs , I entered:
[assembly: WebResource("sw fER.Resources.M aze.swf", "applicatio n/x-shockwave-flash")]
in WebBrowserForm
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace swfER
{
public partial class WBForm : Form
{
public WBForm()
{
HtmlTextWriter writer = null;
InitializeComponent();
Render(writer);
}
private void Render(HtmlTextWriter writer)
{
String template =
@"<html><head></head><body><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0'
width='400' height='320'>
<param name='movie' value='{0}'>
<embed src='temp.swf' width='400' height='320'
pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'
type='application/x-shockwave-flash'></embed></object></body></html>";
writer.Write(string.Format(template,
Page.ClientScript.GetWebResourceUrl(this.GetType() ,
"swfER.Resources.Maze.swf")));
}
}
}
Please, inform me what to do to make this work, if you can. Really appreciate it. Thank's in advance.
Comment