Okay so I have a Silverlight 4 app sitting on a page with a couple banners. Depending on some variables within the Silverlight app I need to show one of the banners and re-position the Silverlight app so that it lines up with the bottom of the banner. To accomplish this I have been using HtmlPage.Window.Invoke("MethodToShowTheBannerIWant"). Each banner has it's own function that attempts to show the correct banner and position the app to line up properly. Something like
function ShowFirstBanner() {
FirstBannerStyle.style.display = 'block';
SilverlightAppStyle.style.marginTop = '120px';
SilverlightAppStyle.style.height = '495px';
}
Each banner looks like
<table id="FirstBannerStyle" style="position:absolute;top:0px;left:0px;display:none;height:50px;" width=100% border="0" cellpadding="0">
<tr>
<td><img src="http://www.bannerimageurl.jpg" usemap="#Map2" border="0"></td> </table>
with a map in the like this
<map name="Map2"><area shape="poly" coords="763,19,769,91,985,92,981,69" href="http://www.xxxxxxx.com/cal.htm" target="_self" />
<area shape="rect" coords="11,73,88,89" href="http://www.xxxxxxx.com/index.htm" target="_self">
<area shape="rect" coords="121,70,186,88" href="http://www.xxxxxxx.com/courses.htm" target="_self">
<area shape="rect" coords="217,70,327,90" href="http://www.xxxxxxx.com/ts.htm">
<area shape="rect" coords="365,70,521,91" href="http://www.xxxxxxx.com/po.htm">
<area shape="rect" coords="556,71,618,91" href="http://www.xxxxxxxx.com/au.htm" target="_self">
<area shape="rect" coords="655,72,726,91" href="http://www.xxxxxxx.com/CU/index.htm" target="_self">
</map>
and the Silverlight app area looks like this
<form id="form1" runat="server" style="height:100%">
<div id="silverlightControlHost" style="height:100%;text-align:center">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/XXX.XXX.XXX.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="4.0.50826.0" />
<param name="autoUpgrade" value="true" />
<param name="InitParams" value=<%=System.Configuration.ConfigurationManager.AppSettings.GetValues(0).FirstOrDefault()%>/>
<param name="windowless" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
<div id="InvisibleFrame"></div>
</form>
The issue I am having is that this process works great in IE8, but doesn't work at all in IE9 or Firefox. When my code hits the HtmlPage.Window.Invoke("ShowFirstBanner") it gets stuck right there and never moves past that line, but does not display any error message and instead will just sit indefinitely waiting for that command to complete. If I comment out the code withing the function it makes the call and continues as normal. So something related to how I'm updating the styles Firefox and IE9 doesn't like. Anyone have an idea for a way to do this that will work in all browsers?
Where are "FirstBannerStyle" and "SilverlightAppStyle" defined in your JavaScript?
You need to grab the element by its ID:
document.getElementById('FirstBannerStyle').style.display = 'block';
or if you're using jQuery:
$('FirstBannerStyle').show()
Related
I am using the following to put a video on a wordpress site:
<param name="src" value="http://www.mywebsite.com/announcement.mov">
<param name="autoplay" value="true">
<param name="type" value="video/quicktime" height="560" width="950">
<embed src="http://www.mywebsite.com/announcement.mov" height="560" width="950" autoplay="false" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/">
The part I don't like about this is that you can see the opening frame of the video whenever you are on the page. I would like it if there was a way to make it show just black or show a blank screen until you click the play button.
You would want to use a video placeholder as described in this thread on Stack Overflow: How to add a splash screen/placeholder image for a YouTube video
One point of consideration: If jQuery/JavaScript fails, the video won't load either.
Update
In your HTML:
<img class="video-placeholder" src="placeholder.jpg" data-video="http://www.mywebsite.com/announcement.mov">
In your JS file:
$('.video-placeholder').click(function(){
var video = '<param name="src" value="' + $(this).attr('data-video') + '">
<param name="autoplay" value="true">
<param name="type" value="video/quicktime" height="560" width="950">
<embed src="' + $(this).attr('data-video') + '" height="560" width="950" autoplay="false" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/">';
$(this).replaceWith(video);
});
I want to play video in my asp.net page. I am using the code
<object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="Player1" width="440" height="379">
<param name="URL" value="~/DBVideo/citibank.mpeg">
<param name="http://">
<param name="AutoStart" value="1">
<param name="ShowControls" value="">
<param name="ShowStatusBar" value="1">
<param name="ShowDisplay" value="1">
<param name="stretchToFit" value="1">
<param name="volume" value="32" />
<embed runat="server" id="Video"
type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/"
width="440" height="379" src="~/DBVideo/citibank.mpeg"
filename="~/DBVideo/citibank.mpeg" autostart="1" showcontrols="1" showstatusbar="1" showdisplay="1">
</embed>
</object>
Now only the media player symbol is coming but the video is not playing.
Can anybody help me where the problem is??
and if I want to play the video from SQL server 2008 database (varbinary field) then what would I do?
If you're allowed to use HTML5, you can use video tag
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
<source src="movie.webm" type="video/webm">
Your browser does not support the video tag.
</video>
As for getting video from sql: you can use http handler which extracts file from SQL and probably caches it http://msdn.microsoft.com/en-us/library/46c5ddfy%28v=vs.100%29.aspx
I have this problem in this scenario:
1-I made a new silverlight project with webapplication hosted the silverlight project.
2- when trying the silverlight project alone, it works very good with no errors.
3-but when trying the 'silverlighttestpage.aspx' the browser opens and a white page appears.and a the silverlight loading circle appears and after reaches 100% nothing is shown.
so can you please help me, I'm newbie in silverlight and asp,btw I have silverlight 4 sdk installed.
here is the html:
``
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/silverlighttest3.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="4.0.50826.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
</form>
and the silverlight project like this:
<UserControl x:Class="silverlighttest3.MainPage"
....
<Grid x:Name="LayoutRoot" Background="blue" Height="507" Width="842" HorizontalAlignment="Stretch">
<MultiScaleImage HorizontalAlignment="Left" Margin="146,27,0,0" Name="multiScaleImage1" VerticalAlignment="Top" Source="Source/dzc_output.xml"/>
</Grid>
</UserControl>
Do you have any distinguishable content in your main view? Could you maybe post your html in your test page?
Give your Silverlight main view a background color (other than white) and make sure that it isn't just blending in with the white background of your empty test page.
<UserControl x:Class="SilverlightApplication2.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="Blue">
</Grid>
</UserControl>
I am using the following code but it does not work:
<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="540" height="400" hspace="10">
<param name=movie value="http://servername/foldername/file.swf">
<param name=quality value=high><param name="LOOP" value="false">
<embed src="C:\Users\SAINI\Desktop\online\spn_20Dec\vp\images\abc.swf"
width="540" height="400" hspace="10" loop="false"
quality=high
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
type="application/x-shockwave-flash">
</embed>
</object>
How can I do that?
Internet Explorer, Google Chrome, Apple safari, Mozila Firefox and ...
you need a code which work in all of them and there it is:
<object width="900" height="400" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="myMovieName" >
<param name="src" value="YOUR MOVIE ADDRESS HERE.swf" />
<param name="quality" value="autohigh" />
<param name="bgcolor" value="black" />
<param name="autostart" value="true" />
<param name="FlashVars" value="init=yes&check=true" />
<param src="flash/movie.swf" autostart="true" flashvars="init=yes&check=true"
quality="autohigh" bgcolor="#000000" name="myMovieName"/>
</object>
All you need to do is:
copy and paste this code into your project,
change the address to your clip address,
change the dimensions of clip (in first line)
Enjoy it!
I've tried your code and it works with me without any alteration except the file and its location. I placed the file inside the root of my website. Sadly it doesn't work when I place another location. I don't know the reason yet
<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="540" height="400" hspace="10">
<param name=movie value="http://servername/foldername/file.swf">
<param name=quality value=high><param name="LOOP" value="false">
<embed src="xx.swf" width="540" height="400" hspace="10" loop="false" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash">
</embed> </object>
Under Visual Studio 2010, I’m developing an asp.net application.
I added a folder to my project called Flash. Under Flash folder I added a swf file with its external resources to run.
The folder content:
1- ScrollingImages.swf file to lunch the flash
2- ScrollingImages.xml file that the swf file uses to read images from thumbnails folder
3-thumbnails folder which content images used by swf file.
I can embed the swf file to html easily using this code:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" name="ScrollingImages" width="800" height="400" align="middle" id=" ScrollingImages">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value=" ScrollingImages.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<embed src="ScrollingImages.swf" quality="high" bgcolor="#000000" width="800" height="400" name="ScrollingImages" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
But when I use the same code to embed it to asp.net page I will have a problem that the flash will run but I cannot see the images so the swf file unable to locate the xml file and the folder of the images location and they all in the same folder.
Here is the code I used in the aspx.net content page.
<%# Page Title="" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="Gallary.aspx.cs" Inherits="HabibWebSite.Gallary" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" name="ScrollingImages" width="800" height="400" align="middle" id=" ScrollingImages">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value=" ScrollingImages.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<embed src="ScrollingImages.swf" quality="high" bgcolor="#000000" width="800" height="400" name="ScrollingImages" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</asp:Content>
I also tested it in aspx.net page and I’m getting same result no images appear.
I know that the problem is related to who to embed the swf external resources (the xml file and the images folder) to the aspx.net page but I searched a lot and I could solve it.
Please advise me how solve this problem to make the swf file work OK.
Regards,
To resolve this problem all what I need to add is base attribute to the object tag to direct to the external resources folder.
and the code should be some thing like this:
<object type="application/x-shockwave-flash" data=" Flash/ShefBio/chefs_bio.swf" width="970" height="396">
<param name="movie" value=" Flash/ShefBio/chefs_bio.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="base" value=" Flash/ShefBio/" />
<embed src=" Flash/ShefBio/chefs_bio.swf" quality="high" bgcolor="#000000" width="970" height="396" name="ScrollingImages"
align="middle" allowScriptAccess="sameDomain" base=" Flash/ShefBio/"
type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>