J
Jim Hammond
The following code uses a client-side component to capture an image from the
camera on the client system.
The problem is that the init function (in ClientSideAssembly_Video.dll) is
called once when the page is first displayed and then each time the button
is pressed.
I'm guessing that the component is being instantiated each time. Is there
any way to keep using the same instance?
Thanks,
Jim
<body MS_POSITIONING="GridLayout">
<OBJECT id="Object1"
classid="ClientSideAssembly_Video.dll#ClientSideAssembly_Video.VideoDisplay"
name="VideoControl" VIEWASTEXT>
</OBJECT>
<form id="Form3" name="Form1" method="post"
encType="multipart/form-data" runat="server" VIEWASTEXT>
<INPUT id="Hidden3" type="hidden" name="hidden1" runat="server">
<asp:image id="Image1" runat="server"></asp:image>
<asp:button id="Button3" runat="server" Text="TAKE
PHOTO"></asp:button>
</form>
<script language="javascript">
function TakePicture()
{
VideoControl.TakePicture();
document.Form1.hidden1.value = VideoControl.jpgFile;
}
</script>
</body>
I enable the button to call the JavaScript function TakePicture() with the
following
C# code in the web form:
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
Button3.Attributes.Add("onclick", "TakePicture()");
}
camera on the client system.
The problem is that the init function (in ClientSideAssembly_Video.dll) is
called once when the page is first displayed and then each time the button
is pressed.
I'm guessing that the component is being instantiated each time. Is there
any way to keep using the same instance?
Thanks,
Jim
<body MS_POSITIONING="GridLayout">
<OBJECT id="Object1"
classid="ClientSideAssembly_Video.dll#ClientSideAssembly_Video.VideoDisplay"
name="VideoControl" VIEWASTEXT>
</OBJECT>
<form id="Form3" name="Form1" method="post"
encType="multipart/form-data" runat="server" VIEWASTEXT>
<INPUT id="Hidden3" type="hidden" name="hidden1" runat="server">
<asp:image id="Image1" runat="server"></asp:image>
<asp:button id="Button3" runat="server" Text="TAKE
PHOTO"></asp:button>
</form>
<script language="javascript">
function TakePicture()
{
VideoControl.TakePicture();
document.Form1.hidden1.value = VideoControl.jpgFile;
}
</script>
</body>
I enable the button to call the JavaScript function TakePicture() with the
following
C# code in the web form:
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
Button3.Attributes.Add("onclick", "TakePicture()");
}