locked
Importing flash documents RRS feed

  • Question

  • I am trying to load a flash animated game into visual basic to work with a program I am using. I want to be able to load the game onto different forms as it will have different chapters. How do I make the game part of a windows form?
    Tuesday, April 5, 2011 6:56 PM

All replies

  • Ive sorted this problem myself using the Shockwave Flash Object tool. You can find this by right clicking in your tool bar, going to COM and then scrolling down to the Shockwave tools. You then use the code:

    ObjectName.Movie = "FilePath"

    This now works perfectly.

    • Marked as answer by LuigiT-W Tuesday, April 5, 2011 9:13 PM
    • Unmarked as answer by LuigiT-W Saturday, April 16, 2011 8:31 PM
    Tuesday, April 5, 2011 9:13 PM
  • I have been able to load the flash objects, but is there anyway i am able to embed them? i have changed the property of each to "embedded resource" but i then cant seem to call them directly with the program. for example, i would like to be able to write;

    Private Sub AxShockwaveFlash1_VisibleChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxShockwaveFlash1.VisibleChanged

        AxShockwaveFlash1.Movie = "LetterFallGame1.swf"

    End Sub

     

    but instead i have to use a file path. Is there anyway i can avoid having to use file paths?

    Saturday, April 16, 2011 8:32 PM
  • I think the best you can do is compile in the swfs as binary resources, extract them at runtime and write them to a temporary location - then you could use the path, and delete the files when your program closes.


    Tom Shelton
    Sunday, April 17, 2011 1:00 AM
  • but instead i have to use a file path. Is there anyway i can avoid having to use file paths?

    You can play flash from stream as byte array, i posted the code in the link below with embedded and managed resources sample. http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/53387027-0f15-483c-b9af-4d98c74b539a

    By the way,  too many files embedded in your executable might slow down the program when you run it.

    kaymaf


    CODE CONVERTER SITE

    http://www.carlosag.net/Tools/CodeTranslator/.

    http://www.developerfusion.com/tools/convert/csharp-to-vb/.


    Sunday, April 17, 2011 5:10 AM
  • I think the best you can do is compile in the swfs as binary resources, extract them at runtime and write them to a temporary location - then you could use the path, and delete the files when your program closes.


    Tom Shelton
    How do i compile as binary resources? ive imported the files into my program, so do i need to change something in the properties window? Im only running express edition by the way, if it makes any difference to what i am able to do in visual basic.
    Monday, April 18, 2011 8:24 PM
  • I have been able to load the flash objects, but is there anyway i am able to embed them? i have changed the property of each to "embedded resource" but i then cant seem to call them directly with the program. for example, i would like to be able to write;

     

    Private Sub AxShockwaveFlash1_VisibleChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxShockwaveFlash1.VisibleChanged

        AxShockwaveFlash1.Movie = "LetterFallGame1.swf"

    End Sub

     

     

    but instead i have to use a file path. Is there anyway i can avoid having to use file paths?

    Another addition to the problem is that i have compiled my program using Inno Setup, however, it cant seem to load the form. It throws up an error to do with Ax.interop and shockwaveflash objects. Does anyone know how to sort this?
    Friday, April 22, 2011 8:43 PM
  • I have been able to load the flash objects, but is there anyway i am able to embed them? i have changed the property of each to "embedded resource" but i then cant seem to call them directly with the program. for example, i would like to be able to write;

     

    Private Sub AxShockwaveFlash1_VisibleChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxShockwaveFlash1.VisibleChanged

        AxShockwaveFlash1.Movie = "LetterFallGame1.swf"

    End Sub

     

     

    but instead i have to use a file path. Is there anyway i can avoid having to use file paths?

    Another addition to the problem is that i have compiled my program using Inno Setup, however, it cant seem to load the form. It throws up an error to do with Ax.interop and shockwaveflash objects. Does anyone know how to sort this?

    Specifically, it all says:

    "Unhandled exception has occured in your application. if you click continue, the application will ignore this error and attempt to continue. if you click quit, the application will close immediately. An error occured creating the form. See Exception.InnerException for details. The error is: Could not load file or assembly 'AxInterop.ShockwaveFlashObjects. Version=1.0.0.0. Culture=neutral. PublicKeyToken=null' or one of it dependencies. The system cannot find the file specified."

    Then under details it says;

    "See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************
    System.InvalidOperationException: An error occurred creating the form. See Exception.InnerException for details.  The error is: Could not load file or assembly 'AxInterop.ShockwaveFlashObjects, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'AxInterop.ShockwaveFlashObjects, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
       at WindowsApplication2.LetterFall1.InitializeComponent()
       at WindowsApplication2.LetterFall1..ctor()
       --- End of inner exception stack trace ---
       at WindowsApplication2.My.MyProject.MyForms.Create__Instance__[T](T Instance)
       at WindowsApplication2.LetterFallSelect.Button1_Click(Object sender, EventArgs e)
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


    ************** Loaded Assemblies **************
    mscorlib
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.225 (RTMGDR.030319-2200)
        CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
    ----------------------------------------
    DeutscheGenie
        Assembly Version: 1.0.0.0
        Win32 Version: 1.0.0.0
        CodeBase: file:///C:/Program%20Files/DeutscheGenie/DeutscheGenie.exe
    ----------------------------------------
    Microsoft.VisualBasic
        Assembly Version: 10.0.0.0
        Win32 Version: 10.0.30319.1 built by: RTMRel
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
    ----------------------------------------
    System
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.225 built by: RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    System.Core
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.225 built by: RTMGDR
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
    ----------------------------------------
    System.Windows.Forms
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.1 built by: RTMRel
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    ----------------------------------------
    System.Drawing
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.1 built by: RTMRel
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    System.Runtime.Remoting
        Assembly Version: 4.0.0.0
        Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
    ----------------------------------------

    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.

    For example:

    <configuration>
        <system.windows.forms jitDebugging="true" />
    </configuration>

    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box."

    Sunday, April 24, 2011 9:25 PM