Am only looking to play some flash content on my page.
found this code on the web and just copied it into my codes and changed the file name. However the intellisense underlines part of the code in green and says “File ‘swfobject.js’ was not found” this is the code I copied below.
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<script type='text/javascript' src='swfobject.js'></script>
<script type='text/javascript'>
var s1 = new SWFObject('cmsflash.swf','player', '400', '300', '9');
s1.addParam('allowfullscreen', 'false');
s1.addParam('allowscriptaccess', 'always');
s1.addParam('flashvars', 'file=video.flv');
s1.write('preview');
</script>
<style type="text/css">
and it underlines only (swfobject.js) saying file not found. the file i wish to display is named cmsflash and is in the root directory probably ~/cmsflash.swf
where and what could be going wrong?
the block where the flash should display is declared as follows
<table class="style2" style="height: 309px; width: 76%">
<tr>
<td>
<p id='preview'>The player will show in this paragraph</p>
</td>
</tr>
</table>
<span class="style6">
<br />
Please Help
THIS IS THE NEW CODE AFTER I IMPORTED THE SWFOBJECT FOLDER.
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<script type="text/javascript" src="swfobject/swfobject.js"></script>
<script type='text/javascript'>
var s1 = new swfobject('~/cmsflash.swf','player', '400', '300', '9');
s1.addParam('allowfullscreen', 'false');
s1.addParam('allowscriptaccess', 'always');
s1.addParam('flashvars', 'file=video.flv');
s1.write('preview');
</script>
I dont get any errors but the flash does not display at page load.
After several editing and flash still does not want to appear so i some more editing by adding a declaration in the master page(site.master) as shown below
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="Prototype5.SiteMaster" %>
<script type="text/javascript">
var s1 = new SWFObject('cmsflash.swf', 'player', '400', '300', '9');
s1.addParam('allowfullscreen', 'false');
s1.addParam('allowscriptaccess', 'always');
s1.addParam('flashvars', 'file=video.flv');
s1.write('preview');
s1.write('preview1');
</script>
I also made a similar declaration in the child page just in case it was not supposed to be in the master page. so below is the code in the child page(default.aspx)
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="Prototype5._Default" %>
var s1 = new SWFObject(‘cmsflash.swf’, ‘player’, ‘400’, ‘300’, ‘9’);
s1.addParam(‘allowfullscreen’, ‘false’);
s1.addParam(‘allowscriptaccess’, ‘always’);
s1.addParam(‘flashvars’, ‘file=video.flv’);
s1.write(‘preview’);
s1.write(‘preview1’);
This is the location where i asked for the flash to appear.
The player will show in this paragraph
I even suspected the flash file was probably not able to display in tables so i went further to declare a “div” as follows
<div id="preview1">The player will show in this paragraph
</div>
But flash still would not show…
Should you get
swfobject.jsfrom the same place you get this code which displaying your flash content? Also you may findswfobject.jshere http://blog.deconcept.com/2007/02/28/swfobject-1-5-released/Than put it in to your solution and check if path
src='swfobject.js'in<script type='text/javascript' src='swfobject.js'></script>is correct.Also you may drag and drop your
'swfobject.js'file from solution to aspx and designer will add new<script>section with correct path.UPDATE:
1) you need to say
var s1 = new SWFObject(...)notvar s1 = new swfobject(...)2)
s1.write('preview');it’s mean “Place flash content to element withId = 'preview'“. So you need to place f.e.gdivwithid='preview'on your form.In your case if you don’t have element
Id = 'preview'there is nowhere to place your flash content.Than it should work.