473,395 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Embedding swf (Flash) file as a resource in c# 2008 win app.

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.ClientScript.get'"


This is what I did:

checked with GetManifestResourceNames(), 'swfER.Resources.Maze.swf' was listed

in assemblyinfo.cs, I entered:

[assembly: WebResource("swfER.Resources.Maze.swf", "application/x-shockwave-flash")]

in WebBrowserForm

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10.  
  11.  
  12. namespace swfER
  13. {
  14.     public partial class WBForm : Form
  15.     {
  16.         public WBForm()
  17.         {
  18.         HtmlTextWriter writer = null;
  19.  
  20.             InitializeComponent();
  21.  
  22.         Render(writer);
  23.  
  24.     }
  25.  
  26.     private void Render(HtmlTextWriter writer)
  27.         {
  28.  
  29.             String template =
  30.             @"<html><head></head><body><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' 
  31.             codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' 
  32.             width='400' height='320'> 
  33.             <param name='movie' value='{0}'>        
  34.             <embed src='temp.swf' width='400' height='320'  
  35.             pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' 
  36.             type='application/x-shockwave-flash'></embed></object></body></html>"; 
  37.             writer.Write(string.Format(template,
  38.             Page.ClientScript.GetWebResourceUrl(this.GetType() ,
  39.             "swfER.Resources.Maze.swf")));
  40.         }
  41.  
  42.     }
  43. }
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.
Mar 30 '10 #1
1 2570
tlhintoq
3,525 Expert 2GB
TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.
Mar 30 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: MikeY | last post by:
With Reference/Resource is there a way of embedding the .resource file within a folder of my application instead of having it in the main project /executing assembly area. i.e. if I have a folder...
3
by: UJ | last post by:
I've got an image I want to embed in a dll to use on a screen later. I've got it in a resource file, got it to compile in to the dll. The problem is getting it back out. It seems like my problem is...
3
by: Buggyman | last post by:
Hi, I have been given a swf file to embed as a banner on our site... Does anyone have any tips on how I do this?? -- *Many* thanks. :)
3
by: Ollie Riches | last post by:
How do I embed a *.flv file (Flash Video) into an aspx page similar to embedding windows media player active x control? Cheers Ollie Riches
3
by: fnustle | last post by:
I've embedded a flash file into an assembly: But when I try to reference it on a web page: <object codebase="http://download.macromedia.com/pub/shockwave/ cabs/flash/swflash.cab"...
5
by: Barrie Wilson | last post by:
anyone have any idea why I might be having an impossible time embedding a YouTube <objectin an .ASPX file: <object width="425" height="355"> <param name="movie"...
3
by: JJ | last post by:
How do I embed a swf (flash) file as a resource in my custom web control? And, if thats possible, how would I access it when I am (presumably) overriding the RenderContents method? Thanks in...
1
by: Chris72205 | last post by:
How would I go about embeding a flash application into an HTML page? Note that I say flash application, it's not just the average .swf file. How do I embed that or is it possible? I am familiar...
2
by: Nikolay Belyh | last post by:
1. Why does Visual Studio 2008 started ignoring //{NO_DEPENDENCIES} in resource.h? If I edit file "resource.h" _manually_, it rebuilds the whole solution. It worked just fine with Visual Studio...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.