What is F-IN-BOX .Net Edition?

F-IN-BOX is a .NET component to enhance Macromedia / Adobe Flash Player ActiveX features. It does not use its own engine to display movies but provide a wrapper around official swflash.ocx/flash.ocx code instead. Thus it is possible to avoid certain Macromedia / Adobe Flash Player ActiveX limitations.

All Macromedia / Adobe Flash Player ActiveX versions are supported.

Both x86 and x64 are supported.

Want to see F-IN-BOX in action?

Just enter a correct e-mail to get a demo version.

If you don't receive a letter please write us: support (at) f-in-box.com, or via support form.

Load flash movies from stream directly (no temporary files!). Protect your flash movies.

It is known fact that the Flash Player ActiveX is able to load movies at certain URLs only. You have to save the movie to a temporary location from your application's resource before you can load it. You'll have to generate a corresponding link that you can pass to the Flash Player ActiveX and then delete the movie after. You'll have to admit that this is extremely inconvenient. Apart from being inconvenient there is a chance you'll fail when you try to create a temporary file if you don't have the appropriate permission or don't have access to a temporary folder. It is definitely not an appropriate approach when security is an issue since your movie can be easily intercepted. There is a solution! F-IN-BOX uses a different approach of swflash.ocx/flash.ocx code loading. It is able to load your movies directly to the Macromedia / Adobe Flash Player ActiveX thereby avoiding the temporary file step. The advantages are pretty obvious. And you can also protect your movies from unauthorized access using your favourite software protection application.

Using the component you can load any flash movie from memory directly. Just use the LoadMovieFromStream and PutMovieFromStream methods. No temporary files! Load any movie on-the-fly from any supported source. For example, you can put one or more flash movies in the resource section of your application and then load it from the exe! That's the portability and power of F-IN-BOX!

Here's an example of how to load a flash movie from a resource:

private void MainForm_Load(object sender, System.EventArgs e) 
    Stream MovieStream = 


Public Class Form1 
    Inherits System.Windows.Forms.Form 

    Friend WithEvents f_in_box__control1 As f_in_box__lib.f_in_box__control 

    Private Sub Form1_Load(ByVal sender As Object, _
                           ByVal e As System.EventArgs) _
                               Handles MyBase.Load 

        Dim MovieStream As Stream = _


    End Sub 

End Class

Create flash-enabled applications which are ready to work even when the Macromedia / Adobe Flash Player ActiveX is not installed!

One of the biggest problem using the Flash Player ActiveX is the mandatory component registration. The common approach is to save swflash.ocx/flash.ocx code to temporary files and then register them. The disadvantages are the same as above mentioned - insufficient permissions to save and register an swflash.ocx/flash.ocx. Now you can forget about these problems! F-IN-BOX is able to use swflash.ocx/flash.ocx from any source. For example, you can put an swflash.ocx/flash.ocx code inside of your application's resources and instruct F-IN-BOX to use it. It is important to note that F-IN-BOX does not use temporary files and swflash.ocx/flash.ocx registration but loads and uses the code directly. No more user management rights problems - no more temporary files and no more component registrations. It is up to you to decide what swflash.ocx/flash.ocx to use - by default already registered component is used.

Traditionally, there are many obstacles or annoyances that one will encounter when using Macromedia / Adobe Flash Player ActiveX in an application.

The Application...

  1. needs swflash.ocx/flash.ocx installed in the system before it will work.
  2. has to work flawlessly with the already installed version of the Macromedia / Adobe Flash Player ActiveX.
  3. has no easy way to prevent flash movies from being abused.

F-IN-BOX to the rescue. It solves these problems and more!

By default, the component will use the swflash.ocx/flash.ocx that's already installed on the system. The component can alternatively use any swflash.ocx/flash.ocx that you would like to provide it with using any supported source. An example of this how you can embed the flash.ocx into the resource section of your application's exe file and then load it at runtime. Using this method, your application will work even if the Macromedia / Adobe Flash Player ActiveX doesn't exist on the target system. With F-IN-BOX, hassling around with Macromedia / Adobe Flash Player ActiveX installation issues are a thing the past! It's so easy to do!

Here's an example of how to load swflash.ocx/flash.ocx code from a resource:

private f_in_box__lib.f_in_box__control f_in_box__control1;

private void MainForm_Load(object sender, System.EventArgs e)
	// Loads flash.ocx from resource
	System.IO.Stream StreamWithFlashOCXCode = 

	if (StreamWithFlashOCXCode == null)
		System.Windows.Forms.MessageBox.Show("Resource 'Flash.ocx' not found");

	f_in_box__lib.AxCode code = new f_in_box__lib.AxCode(StreamWithFlashOCXCode);

	f_in_box__control1 = new f_in_box__lib.f_in_box__control(code);

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
      Handles MyBase.Load

   'Loads flash.ocx from resource
   Dim StreamWithFlashOCXCode As System.IO.Stream = _

   If StreamWithFlashOCXCode Is Nothing Then
      MsgBox("Resource 'Flash.ocx' not found")
   End If

   Dim code As New f_in_box__lib.AxCode(StreamWithFlashOCXCode)

   f_in_box__control1 = New f_in_box__lib.f_in_box__control(code)
End Sub

Transparency is fully supported!

Using F-IN-BOX you are able to create applications based on transparent flash movies. You can create applications with translucency non-rectangle forms. Use Flash to make applications with modern user interface, make a business logic using .NET.

Use f_in_box__lib.f_in_box__form component to work with transparency:

// MyTranslucencyForm is inherited from f_in_box__lib.f_in_box__form
// Creating translucency form 
MyTranslucencyForm FlashPlayerForm = new MyTranslucencyForm();

// Loading movie from stream
System.IO.Stream MovieStream = 

// Positions
FlashPlayerForm.Width = 400;
FlashPlayerForm.Height = 400;
FlashPlayerForm.Left = 
   System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width / 2 - 
   FlashPlayerForm.Width / 2;
FlashPlayerForm.Top = 
   System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height / 2 - 
   FlashPlayerForm.Height / 2;

// Play and...
// ...show

' MyTranslucencyForm is inherited from f_in_box__lib.f_in_box__form;
' Creating translucency form 
Dim FlashPlayerForm As New MyTranslucencyForm

' Loading movie from stream
Dim MovieStream As System.IO.Stream = _

' Positions
FlashPlayerForm.Width = 400
FlashPlayerForm.Height = 400
FlashPlayerForm.Left = _
   Screen.PrimaryScreen.WorkingArea.Width() / 2 - _
   FlashPlayerForm.Width / 2
FlashPlayerForm.Top = _
   Screen.PrimaryScreen.WorkingArea.Height() / 2 - _
   FlashPlayerForm.Height / 2

' Play and...
' ...show


Ability to play Flash Video (FLV) from stream

Using F-IN-BOX you are able to play Flash Video (FLV) from external files, URL or directly from a stream. When F-IN-BOX loads Flash Video no temporary files are created everything runs directly from memory. You can encrypt your video and put into application's resource - F-IN-BOX loads FLV without ever saving or extracting the file to disk.

To play Flash Video from memory you should create flash movie that loads Flash Video from "private" URL (http://FLV/FlashVideo.flv). Flash Movie uses the following code to load Flash Video (put this in under a button in your Swf Flash Movie):

var netConn:NetConnection = new NetConnection(); 


var netStream:NetStream = new NetStream(netConn); 




When Flash tries to load Flash Video from http://FLV/FlashVideo.flv, F-IN-BOX provides content of FLV. Use global event GlobalLoadExternalResource to set handle the external resources and provide them to Flash. See the code:

f_in_box__control1.AxCode.OnLoadExternalResourceByFullPath += 
   new f_in_box__lib.AxCode.

private void OnLoadExternalResourceByFullPath(
   object sender, 
   String URL, 
   System.IO.Stream Stream, 
   ref bool Handled)
   if (URL == "http://FLV/FlashVideo.flv")
      System.IO.Stream FLVStream = 

      const int size = 64 * 1024;
      byte[] buffer = new byte[size];
      int ReadBytes;

      while ( (ReadBytes = FromStream.Read(buffer, 0, size)) > 0 )
         Stream.Write(buffer, 0, size);


      Handled = true;
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. _

      ' 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

            Stream.Write(buffer, 0, nReadBytes)
      End While


      Handled = True
   End If
End Sub

Enable/disable flash sounds

Using the library you can turn on/off flash sounds. Use property AxCode.SoundEnabled:

f_in_box__control1.AxCode.SoundEnabled = false;
f_in_box__control1.AxCode.SoundEnabled = False

Adjust sound volume

Using the library you can adjust sound volume. Use property AxCode.SoundVolume. To get maximum sound volume use f_in_box__lib.AxCode.MaxSoundVolume:

f_in_box__control1.AxCode.SoundVolume = f_in_box__lib.AxCode.MaxSoundVolume / 2;
f_in_box__control1.AxCode.SoundVolume = f_in_box__lib.AxCode.MaxSoundVolume \ 2

Get a snap image of the current flash movie frame

You can get a bitmap image from the current frame of a flash movie. It means you are able create applications that can coverts Flash movies to a series of bitmaps, JPEGs and others. Also you can build generated images to make an AVI video for example. To get bitmap with alpha, call GetBitmap of a f_in_box__form instance. f_in_box__control returns a bitmap without alpha:

private void SaveFrameButton_Click(object sender, System.EventArgs e) 
    Bitmap FrameBitmap = f_in_box__control1.GetBitmap(); 

    if (SaveBMPFileDialog.ShowDialog() == DialogResult.OK) 
Private Sub SaveFrameButton_Click(ByVal sender As System.Object, _
                                  ByVal e As System.EventArgs) _
                                          Handles SaveFrameButton.Click 

    Dim FrameBitmap As Bitmap = f_in_box__control1.GetBitmap() 

    If SaveBMPFileDialog.ShowDialog() = DialogResult.OK Then 
    End If 

End Sub

Flash External API

F-IN-BOX supports External API. You can call functions of a movie and a movie is able to get data from an application synchronously (instead of fscommand).

Call an ActionScript function from an application

Register your function using ExternalInterface.addCallback:

import flash.external.*; 

ExternalInterface.addCallback("CallMeFromApplication", this, InternalFunction); 

function InternalFunction(str: String): String { 
   TextArea1.text = str; 
   return "The function was called successfully"; 

Use the method CallFunction:

string Response = 
    f_in_box__control1.FlashMethod_CallFunction("Some text for F-IN-BOX.NET"); 

MessageBox.Show("The function returned: '" + Response + "'");
Dim Response As String = _ 
f_in_box__control1.FlashMethod_CallFunction("<invoke name=" + _
                                            """" + _
                                            "CallMeFromApplication" + _
                                            """" + _
                                            " returntype=" + _
                                            """" + _
                                            "xml" + _
                                            """" + _
                                            "><arguments><string>" + _
                                            "Some text for f-in-box .NET" + _

MsgBox("The function returned: '" + Response + "'")

Call an application function from a flash script

Use flash.external.ExternalInterface.call:

on (click) { 
   _root.TextArea1.text = flash.external.ExternalInterface.call("SomeFunction"); 

Handle event OnFlashCall:

private void f_in_box__control1_OnFlashCall(
   object sender, 
   string request)
      "<string>Current time is: " + 
      System.DateTime.Now.ToString() + 
Private Sub f_in_box__control1_OnFlashCall( _ 
   ByVal sender As Object, _
   ByVal request As String) Handles f_in_box__control1.OnFlashCall

      "Current time is: " + System.DateTime.Now.ToString() + "")

End Sub

Use a flash movie as a dynamic texture in DirectX applications

You can get semitransparent bitmap images from a flash movie. It means you are able create a dynamic texture for your DirectX application. Here the movie:

Here the texture based on the movie:

Texture based on the flash movie

Write code which is compatible with any version of Macromedia / Adobe Flash Player ActiveX

One of the problem with Macromedia / Adobe Flash Player ActiveX programming is that you have to control what version of Macromedia / Adobe Flash Player ActiveX you are using. For example, the property "Stacking" exists only in Macromedia / Adobe Flash Player ActiveX 5 but doesn't exist in later revisions. F-IN-BOX automatically detects what Macromedia / Adobe Flash Player ActiveX version is being used and prevents failure if access to non existant properties/methods is attempted. Applications using F-IN-BOX are not only compatible with any version of Macromedia / Adobe Flash Player ActiveX, but are also "smart" about how Macromedia / Adobe Flash Player ActiveX control is used. This makes your application more robust which can result in fewer technical support issues.