F-IN-BOX .NET Help >> Classes >> AxCode >> Events
Syntax
[ C# ]
- public delegate void OnLoadExternalResourceByFullPathEventHandler(object sender, String URL, Stream Stream, ref bool Handled);
- public event OnLoadExternalResourceByFullPathEventHandler OnLoadExternalResourceByFullPath;
public delegate void OnLoadExternalResourceByFullPathEventHandler(object sender, String URL, Stream Stream, ref bool Handled);
public event OnLoadExternalResourceByFullPathEventHandler OnLoadExternalResourceByFullPath;
Description
OnLoadExternalResourceByFullPath is called when flash tries to load a resource addressed by full (not relative) URL, for example: http://tratata/1.swf.
[ C# ]
- private void OnLoadExternalResourceByFullPath(object sender, String URL, System.IO.Stream Stream, ref bool Handled)
- {
- if (URL == "http://FLV/FlashVideo.flv")
- {
- System.IO.Stream FromStream = System.IO.File.OpenRead(Path);
-
- FromStreamToStreamWriter writer =
- new FromStreamToStreamWriter(
- FromStream,
- Stream
- );
-
- Handled = true;
- }
- }
private void OnLoadExternalResourceByFullPath(object sender, String URL, System.IO.Stream Stream, ref bool Handled)
{
if (URL == "http://FLV/FlashVideo.flv")
{
System.IO.Stream FromStream = System.IO.File.OpenRead(Path);
FromStreamToStreamWriter writer =
new FromStreamToStreamWriter(
FromStream,
Stream
);
Handled = true;
}
}
[ VB.Net ]
- Private Sub OnLoadExternalResourceByFullPath(ByVal sender As Object, ByVal URL As String, ByVal Stream As System.IO.Stream, ByRef Handled As Boolean)
- If URL = "http://FLV/FlashVideo.flv" Then
- Dim FLVStream As System.IO.Stream = Me.GetType().Assembly.GetManifestResourceStream("Sample2_SWF_FLV_Embedding.flashvideo.flv")
-
-
-
-
-
-
- Const nSize = 64 * 1024
-
- Dim buffer(nSize) As Byte
-
- Dim nReadBytes As Integer
-
- While (True)
- nReadBytes = FLVStream.Read(buffer, 0, nSize)
-
- If 0 = nReadBytes Then Exit While
-
- Try
- Stream.Write(buffer, 0, nReadBytes)
- Catch e As System.IO.IOException
-
- Exit While
- End Try
- End While
-
- Stream.Close()
-
- Handled = True
- End If
- End Sub
Private Sub OnLoadExternalResourceByFullPath(ByVal sender As Object, ByVal URL As String, ByVal Stream As System.IO.Stream, ByRef Handled As Boolean)
If URL = "http://FLV/FlashVideo.flv" Then
Dim FLVStream As System.IO.Stream = Me.GetType().Assembly.GetManifestResourceStream("Sample2_SWF_FLV_Embedding.flashvideo.flv")
' You can write all content right here, but if FLVStream is BIG it takes long time
' The form will be unaccessible for user all this time
' Another option is to save Stream and write content in a separate thread
' You can find code example in the sample Sample1_SWF_And_FLV_Player
Const nSize = 64 * 1024
Dim buffer(nSize) As Byte
Dim nReadBytes As Integer
While (True)
nReadBytes = FLVStream.Read(buffer, 0, nSize)
If 0 = nReadBytes Then Exit While
Try
Stream.Write(buffer, 0, nReadBytes)
Catch e As System.IO.IOException
' Loading is interrupted
Exit While
End Try
End While
Stream.Close()
Handled = True
End If
End Sub
Copyright © Softanics. All rights reserved.
F-IN-BOX is a trademark of Softanics.
Macromedia and Shockwave Flash are trademarks of Adobe
|