MePHiTiC Posted December 24, 2007 Share Posted December 24, 2007 I got the below code to play a Flash (swf) file from Weaponx (Thanks!). My intent is to play a Flash file then at the end leave the last frame of the Flash displayed, but over lay text on top of it. What I'm trying to do is the Flash does a logo and a please wait then goes to a winner frame. I want the winner frame to remain but then some how over lay text from the script on top of it. I thought maybe using a label but I couldn't get it to work. Any suggestions? #include <guiconstants.au3> $mGUI = GUICreate("Title", 1024, 768, 0, 0, -1 ) GUISetBkColor (0x000000) GUISetState(@SW_SHOW) ; Create Flash Object $swfObj = ObjCreate("ShockwaveFlash.ShockwaveFlash") $swfActiveX = GUICtrlCreateObj( $swfObj, 0, 0 , 1024, 768) ; Configure Flash Object (Make as Function) With $swfObj .Movie = @ScriptDir & '/attract.swf' .ScaleMode = 3;0 showall, 1 noborder, 2 exactFit, 3 noscale .bgcolor = "#000000" .Loop = True .WMode = "transparent" .allowScriptAccess = "Always" EndWith ; MAIN LOOP While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch Sleep(10) WEnd Thanks, MePH Link to comment Share on other sites More sharing options...
Siao Posted December 24, 2007 Share Posted December 24, 2007 (edited) You can draw text overlay on pretty much everything: expandcollapse popup#include <guiconstants.au3> #include <GDIPlus.au3> Global $hGraphic, $hTextColor, $hFontFamily, $hFont $mGUI = GUICreate("Title", 1024, 768, 0, 0, -1 ) GUISetBkColor (0x000000) GUISetState(@SW_SHOW) ; Create Flash Object $swfObj = ObjCreate("ShockwaveFlash.ShockwaveFlash") $swfActiveX = GUICtrlCreateObj( $swfObj, 0, 0 , 1024, 768) ; Configure Flash Object (Make as Function) With $swfObj .Movie = @ScriptDir & '/attract.swf' .ScaleMode = 3;0 showall, 1 noborder, 2 exactFit, 3 noscale .bgcolor = "#000000" .Loop = True .WMode = "transparent" .allowScriptAccess = "Always" EndWith _GDIPlus_Startup() DrawInit() ; MAIN LOOP While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE DrawCleanup() _GDIPlus_ShutDown() ExitLoop EndSwitch Sleep(10) TextDraw("Some text here", 50, 10, 400, 50) WEnd Func DrawInit() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($mGUI) $hTextColor = _GDIPlus_BrushCreateSolid(0xFFFF0000) $hFontFamily = _GDIPlus_FontFamilyCreate("Courier") $hFont = _GDIPlus_FontCreate($hFontFamily, 20) EndFunc Func DrawCleanup() _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFontFamily) _GDIPlus_BrushDispose($hTextColor) _GDIPlus_GraphicsDispose($hGraphic) EndFunc Func TextDraw($sString, $iX, $iY, $iW, $iH) Local $tRect = _GDIPlus_RectFCreate($iX, $iY, $iW, $iH) _GDIPlus_GraphicsDrawStringEx($hGraphic, $sString, $hFont, $tRect, 0, $hTextColor) EndFunc I put drawing into main loop. You may (and probably should) draw only when you need it, eventhough with drawing object, font and brush pregenerated at startup it doesn't hog the CPU that badly... Just keep in mind that if the text gets covered with some other window or window is minimized, it will be gone and you'll have to redraw it again. Edited December 25, 2007 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
MePHiTiC Posted December 26, 2007 Author Share Posted December 26, 2007 I put drawing into main loop. You may (and probably should) draw only when you need it, eventhough with drawing object, font and brush pregenerated at startup it doesn't hog the CPU that badly... Just keep in mind that if the text gets covered with some other window or window is minimized, it will be gone and you'll have to redraw it again.Siao, Thanks for the help! I gave this a try ... The flash seems to work, however there still isn't any text. I tried moving a few things around with my limited knowledge, but I couldn't get the text to display.Thanks again!MePH Link to comment Share on other sites More sharing options...
star2 Posted December 26, 2007 Share Posted December 26, 2007 (edited) expandcollapse popup#include <guiconstants.au3> #include <ScreenCapture.au3> $mGUI = GUICreate("Title", 800, 600,-1,-1,$ws_popup) GUISetBkColor (0x000000) GUISetState(@SW_SHOW) ; Create Flash Object $swfObj = ObjCreate("ShockwaveFlash.ShockwaveFlash") $swfActiveX = GUICtrlCreateObj( $swfObj, 0, 0 , 800, 600) ; Configure Flash Object (Make as Function) With $swfObj .Movie = @ScriptDir & '\login.swf' .ScaleMode = 2;0 showall, 1 noborder, 2 exactFit, 3 noscale .bgcolor = "#000000" .Loop = True .WMode = "transparent" .allowScriptAccess = "Always" EndWith $a = WinGetPos ($mGUI) Sleep (3000) _ScreenCapture_CaptureWnd ( "test.bmp",$mGUI,$a[0]-30,$a[1],$a[0]+ 750,$a[1] + 580 , False) $sGUI = GUICreate("Test", 800, 600) GUISetBkColor (0x000000) GUICtrlCreatePic ("test.bmp",0,0,800,600) GUICtrlSetState (-1, $gui_disable) GUICtrlCreateLabel ("this is a test lable" , 20,40,250,25) GUICtrlSetFont (-1,14,600) GUICtrlSetColor (-1,0x870190) $button = GUICtrlCreateButton ("Test Button", 10, 70,150,25) GUISetState(@SW_SHOW) GUISetState(@SW_HIDE,$mGUI) ; MAIN LOOP While 1 $msg = GUIGetMsg($sGUI) Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $button MsgBox (-1, "info" , "you have pressed the button") EndSelect Sleep(10) WEnd I would call it Splash With Flash !! nice ha !! hope this can be usefull !!! see yaflash.zip Edited December 26, 2007 by star2 [quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u] Link to comment Share on other sites More sharing options...
MePHiTiC Posted December 26, 2007 Author Share Posted December 26, 2007 expandcollapse popup#include <guiconstants.au3> #include <ScreenCapture.au3> $mGUI = GUICreate("Title", 800, 600,-1,-1,$ws_popup) GUISetBkColor (0x000000) GUISetState(@SW_SHOW) ; Create Flash Object $swfObj = ObjCreate("ShockwaveFlash.ShockwaveFlash") $swfActiveX = GUICtrlCreateObj( $swfObj, 0, 0 , 800, 600) ; Configure Flash Object (Make as Function) With $swfObj .Movie = @ScriptDir & '\login.swf' .ScaleMode = 2;0 showall, 1 noborder, 2 exactFit, 3 noscale .bgcolor = "#000000" .Loop = True .WMode = "transparent" .allowScriptAccess = "Always" EndWith $a = WinGetPos ($mGUI) Sleep (3000) _ScreenCapture_CaptureWnd ( "test.bmp",$mGUI,$a[0]-30,$a[1],$a[0]+ 750,$a[1] + 580 , False) $sGUI = GUICreate("Test", 800, 600) GUISetBkColor (0x000000) GUICtrlCreatePic ("test.bmp",0,0,800,600) GUICtrlSetState (-1, $gui_disable) GUICtrlCreateLabel ("this is a test lable" , 20,40,250,25) GUICtrlSetFont (-1,14,600) GUICtrlSetColor (-1,0x870190) $button = GUICtrlCreateButton ("Test Button", 10, 70,150,25) GUISetState(@SW_SHOW) GUISetState(@SW_HIDE,$mGUI) ; MAIN LOOP While 1 $msg = GUIGetMsg($sGUI) Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $button MsgBox (-1, "info" , "you have pressed the button") EndSelect Sleep(10) WEnd I would call it Splash With Flash !! nice ha !! hope this can be usefull !!! see ya Star2 - That did it!! Thanks for the help! MePH 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