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>
Related
I'm try create Application where i required to use User Control.I'm already created MainPage.xaml here code below
<phone:PhoneApplicationPage
x:Class="test.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:local="clr-namespace:test"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<!--LayoutRoot is the root grid where all page content is placed-->
And User Control define below:
<UserControl x:Class="test.UserControls"
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"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}" Height="50" Width="427">
<Canvas x:Name="SpatialCanvas" Background="Wheat">
<Border
x:Name="dragSelectionBorder"
BorderBrush="Blue"
BorderThickness="1"
Background="LightBlue"
CornerRadius="1"
Opacity="0.5"
/>
</Canvas>
How To call this user control to MainPage.xaml ?
You have xmlns:local="clr-namespace:test", this is the reference to your Namespace for your MainPage and your custom UserControl.
So to use it on the MainPage
<local:USER_CONTROL_NAME/>
In your case your UserControl is named UserControls (you should reconsider renaming that)
so finally to use your custom control
<local:UserControls/>
![In other broeser][2]
[2]: http://i.stack.imgur.com/hSDJB.png code is <object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" width="480" height="360"
codebase="http://www.microsoft.com/Windows/MediaPlayer/">
<param name="Filename" value="hilo_data_final.wmv" />
<param name="AutoStart" value="true" />
<param name="ShowControls" value="true" />
<param name="BufferingTime" value="2" />
<param name="ShowStatusBar" value="true" />
<param name="AutoSize" value="true" />
<param name="InvokeURLs" value="false" />
<embed src="hilo_data_final.wmv" type="application/x-mplayer2"
autostart="1" enabled="1" showstatusbar="1" showdisplay="1" showcontrols="1"
pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0"
width="480" height="360"></embed>
So what will be problem?
Here you try to use the Windows Media Player to play the video. This is play only on IE and only on computers with windows and media player installed.
Is better to use some flash-base video player (like YouTube do) and then you have more computers and browser that be able to see it.
One suggestion is the flowplayer that I have test it and is very good.
http://flowplayer.org/
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()
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>