Bert Posted September 15, 2006 Share Posted September 15, 2006 In seeing the various flash players people have made, I put together one of my own. It has one small bug in it, and I don't quite know how to solve it. The problem is when I change how the file is viewed. If I set it to show all, it works fine. When I set it to no scale, the game is way too large for the viewing area if I have it set to anything other than "supersize" The game I using to test it is 64.246.26.61/flash/bubbles.swf. I download it to the @ScriptDir & "\games directory, and it should run. expandcollapse popup#Include <File.au3> #include <GuiConstants.au3> #include <GuiList.au3> #include <Array.au3> #include <ie.au3> Dim $selection, $Form1 Dim $selection2 If FileExists(@ScriptDir & "\bin\Fconfig.ini") = 0 Then DirCreate(@ScriptDir & "\bin") IniWrite(@ScriptDir & "\bin\Fconfig.ini", "settings", "size", "2") DirCreate(@ScriptDir & "\games") EndIf GUICreate("Flash Player by Volly", 300, 300, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $FileList = _FileListToArray (@ScriptDir & "\games\", "*.swf", 1) $atr = _ArrayTrim($FileList, 4, 1, 1) $st = _ArrayToString($atr, "|", 1) $Edit_1 = GUICtrlCreateList("", 20, 30, 170, 250) GUICtrlSetData($Edit_1, $st) $Button_2 = GUICtrlCreateButton("Play Game", 205, 30, 80, 30) $Button_3 = GUICtrlCreateButton("Exit", 205, 75, 80, 30) $Button_4 = GUICtrlCreateButton("Help", 205, 120, 80, 30) $lable_1 = GUICtrlCreateLabel("Player size", 205, 165, 80, 30) $Combo_5 = GUICtrlCreateCombo("", 205, 185, 80, 30) $inir_0 = IniRead(@ScriptDir & "\bin\Fconfig.ini", "settings", "size", "Normal") GUICtrlSetData($Combo_5, "Small|Normal|Large|Supersize", $inir_0) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_2 $read = GUICtrlRead($Edit_1) If $read = "" Then MsgBox(48, "Opps!", "You didn't select a game.") Else IniWrite(@ScriptDir & "\bin\Fconfig.ini", "settings", "size", GUICtrlRead($Combo_5)) $selection = $read & ".swf" GUISetState(@SW_HIDE) _viewer() GUISetState(@SW_SHOW) EndIf Case $msg = $Button_3 Exit Case $msg = $Button_4 MsgBox(64, "", " To add a Shockwave file to the list, you will need to copy" & @CRLF _ & "the file to the 'games' directory. Name the file so that you" & @CRLF _ & "will know what it is in the list. It will need to have the *.swf" & @CRLF _ & "file extension. When it is displayed in the player the *.swf" & @CRLF _ & "will not be shown.") Case Else ;;; EndSelect WEnd Exit Func _viewer() Local $W, $H $inir_1 = IniRead(@ScriptDir & "\bin\Fconfig.ini", "settings", "size", "") $inir_2 = IniRead(@ScriptDir & "\bin\Fconfig.ini", "game", $read, "Show All") If $inir_1 = "small" Then $W = @DesktopWidth - 420 $H = @DesktopHeight - 350 $Form1 = GUICreate($read, $W, $H, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS)) EndIf If $inir_1 = "Normal" Then $W = @DesktopWidth - 320 $H = @DesktopHeight - 250 $Form1 = GUICreate($read, $W, $H, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS)) EndIf If $inir_1 = "Large" Then $W = @DesktopWidth - 220 $H = @DesktopHeight - 150 $Form1 = GUICreate($read, $W, $H, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS)) EndIf If $inir_1 = "Supersize" Then $W = @DesktopWidth - 170 $H = @DesktopHeight - 100 $Form1 = GUICreate($read, $W, $H, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS)) EndIf $getz = WinGetClientSize($Form1) $get2 = ($getz[0] * .38) $get2b = ($getz[1] * .93) $getL = StringLen($get2) $getLb = StringLen($get2b) $get3 = StringInStr($get2, ".") If $get3 = 0 Then $get3 = $get2 $get3b = StringInStr($get2b, ".") If $get3b = 0 Then $get3b = $get2b $lenth = ($getL - $get3) $lenthb = ($getLb - $get3b) $ans = StringTrimRight($get2, $lenth + 1) $ansb = StringTrimRight($get2b, $lenthb + 1) $Obj = _IECreateEmbedded () $browser = GUICtrlCreateObj ($Obj, 8, 8, $W - 20, $H - 70) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) _IENavigate ($Obj, 'about:blank') $oDoc = _IEDocGetObj ($Obj) $oDoc.body.style.overflow = "auto" $oDoc.body.style.margin = "0px" $oDoc.body.style.padding = "0px" If $inir_1 = "Normal" Or "Large" Or "Supersize" Then $xx = 0 If $inir_1 = "Small" Then $xx = -15 $button_6 = GUICtrlCreateButton("End Game", $ans, $ansb + $xx, 80, 30) $drop_down_10 = GUICtrlCreateCombo("", $ans + 90, $ansb + ($xx + 4), 80, 20) GUICtrlSetData($drop_down_10, "Show All|No Border|No Scale", $inir_2) GUISetState(@SW_SHOW) $flash1 = @ScriptDir & "\games\" & $selection $sHTML = '<embed id=flashy src="' & $flash1 & '" ' $sHTML &= 'quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" ' $sHTML &= 'type="application/x-shockwave-flash" ' $sHTML &= 'width="100%" height="100%"></embed>' _IEBodyWriteHTML ($Obj, $sHTML) sleep(500) $Obj1 = _IEGetObjByName ($Obj, "flashy") If $inir_1 = "Show All" Then $Obj1.ScaleMode = 0 If $inir_1 = "No Border" Then $Obj1.ScaleMode = 1 If $inir_1 = "No Scale" Then $Obj1.ScaleMode = 3 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE $dataread = GUICtrlRead($drop_down_10) IniWrite(@ScriptDir & "\bin\Fconfig.ini", "game", $read, $dataread) GUIDelete($Form1) ExitLoop Case $button_6 $dataread = GUICtrlRead($drop_down_10) IniWrite(@ScriptDir & "\bin\Fconfig.ini", "game", $read, $dataread) GUIDelete($Form1) ExitLoop Case $drop_down_10 $dataread = GUICtrlRead($drop_down_10) If $dataread = "Show All" Then $Obj1.ScaleMode = 0 If $dataread = "No Border" Then $Obj1.ScaleMode = 1 If $dataread = "No Scale" Then $Obj1.ScaleMode = 3 EndSwitch WEnd EndFunc ;==>_viewer The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
lod3n Posted September 15, 2006 Share Posted September 15, 2006 If I set it to show all, it works fine.So, why change it then? [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now