Jump to content

Embedded Games


Recommended Posts

Well I am able to find the source and such. Whenever I try to embed a swf into my gui it gives me the option to debug or not and nothing happens. I'm not sure what is wrong. Any ideas?

By the way, the link I use to the game is fine because I can navigate to it in any web browser.

Link to comment
Share on other sites

Just been messing around with adding flash, maybe there is a better way but can you use or modify this to your needs?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


    GUICreate("Embedded Flash", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
    $Flash = _GuiCtrlCreateFlash(10,60,600,300,"http://www.flashgames247.com/images/logo_rhino_199x91.swf")
    GUISetState()    ;Show GUI

    

; Waiting for user to close the window
    While 1
        $msg = GUIGetMsg()

        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            
        EndSelect
        
    WEnd

    GUIDelete()


Func _GuiCtrlCreateFlash($iXpos,$iYpos,$iWidth,$iHeight,$vSWFPath)
    $oIE = ObjCreate("Shell.Explorer.2")
    $GUIActiveX = GUICtrlCreateObj ($oIE, $iXpos, $iYpos, $iWidth, $iHeight)
    
    
    $tmp = '<object width="' & $iWidth & '" height="' & $iHeight & '">'
    $tmp &= '<param name="movie" value="AutoIt.swf">'
    $tmp &= '<embed src="' & $vSWFPath & '" width="' & $iWidth-42 & '" height="' & $iHeight-42 & '">'
    $tmp &= '</embed>'
    $hFile = FileOpen(@tempDir & "\AutoItFlash.html",2)
    FileWrite($hFile,$tmp)
    FileClose($hFile)
    $oIE.navigate(@tempDir & "\AutoItFlash.html")
    Return $GUIActiveX
    
EndFunc
Edited by ChrisL
Link to comment
Share on other sites

Update.. it does work for games!

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


    GUICreate("Embedded Flash", 640, 680, (@DesktopWidth - 640) / 2, (@DesktopHeight - 680) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
    $Flash = _GuiCtrlCreateFlash(10,10,400,300,"http://www.2inept.co.uk/icecastleblaster.swf")
    $Flash2 = _GuiCtrlCreateFlash(10,330,600,300,"http://www.flashgames247.com/images/logo_rhino_199x91.swf")
    GUISetState()     ;Show GUI

    

; Waiting for user to close the window
    While 1
        $msg = GUIGetMsg()

        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            
        EndSelect
        
    WEnd

    GUIDelete()


Func _GuiCtrlCreateFlash($iXpos,$iYpos,$iWidth,$iHeight,$vSWFPath)
    $oIE = ObjCreate("Shell.Explorer.2")
    $GUIActiveX = GUICtrlCreateObj ($oIE, $iXpos, $iYpos, $iWidth, $iHeight)

    $tmp = '<object width="' & $iWidth & '" height="' & $iHeight & '">'
    $tmp &= '<param name="movie" value="AutoIt.swf">'
    $tmp &= '<embed src="' & $vSWFPath & '" width="' & $iWidth-42 & '" height="' & $iHeight-42 & '">'
    $tmp &= '</embed>'
    $hFile = FileOpen(@tempDir & "\AutoItFlash.html",2)
    FileWrite($hFile,$tmp)
    FileClose($hFile)
    $oIE.navigate(@tempDir & "\AutoItFlash.html")
    FileDelete(@tempDir & "\AutoItFlash.html")
    
    Return $GUIActiveX
    
EndFunc
Edited by ChrisL
Link to comment
Share on other sites

Yea, I just checked back here! Thankyou very much for your help, I'm currently running through your _GUICtrlCreateFlash func to understand it, a little much for me, but I'll get it.

EDIT: I see, you embed it in a html file and then navigate to it, smart. It's a great idea. I wouldn't have thought of it.

Edited by xIShoopuffIx
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...