Good day, Telerik team!
I’m using RadHtmlPlaceHolder to play and control Flash movies.
SL interacts with Flash using JavaScript and Flash ExternalInterface.
Interaction is like in this article http://www.telerik.com/support/kb/silverlight/htmlplaceholder/htmlplaceholder-javascript.aspx
I have a problem with RadHtmlPlaceHolder after I set its Visibility property to Visibility.Collapsed.
Let’s suppose when video playing I’m clicking on a button, on button handler video is paused by calling specified JavaScript function and PlaceHolder’s Visibility property is setting to Visibility.Collapsed. Because instead of RadHtmlPlaceHolder I want to show some info. Then I’m clicking on another button (e.g. hide info), and RadHtmlPlaceHolder’s Visibility property is settings to Visibility.Visible, and then I want to continue play video by calling another JavaScript function. But when my code reaches “document.getElementById(‘myID’);” I’m getting NullReferenceException.
I looked at Html page in IE debugger and found that when RadHtmlPlaceHolder is collapsed, it’s disappears from there.
And then if I ignore IE error message and continue execution, iframe is appears again but in the end of page. With the same Id as before. Look at attached screenshots.
Seems to be my code is calling when iframe is missing from page.
Any suggestions? Can it be solved?
I tried to reset Id:
HtmlElement iframe = HtmlPage.Window.Eval(string.Format(@"document.getElementById('{0}');", "myIFrame" + _id)) as HtmlElement;
if (iframe == null)
{
((HtmlElement)htmlPlaceholder.HtmlPresenter.Children[0]).SetAttribute("id", "myIFrame" + _id);
}
It doesn’t work.
Here is an example of calling JavaScript
code = string.Format(@"document.getElementById('{0}').contentWindow.continueFLV();", "myIFrame" + _id);
HtmlPage.Window.Eval(code);