Jump to content
Sign in to follow this  
DrJeseuss

Flash object displays as a black box... why?

Recommended Posts

DrJeseuss

I'm using an XML Gauge found here and on most PC's all is fine, but on my (OLD) laptop, it shows only a black box. The laptop is running 2k3 and screen resolution is 32bit, so not too terrible, and yes I have flash ActiveX installed. I can display the flash fine in an IE browser window, but when displaying in an AutoIt GUI, it's just a black box. Here's the AutoIt code I'm using to place the flash in the GUI:

GUICreate("Embedded Flash", 640, 680, (@DesktopWidth - 640) / 2, (@DesktopHeight - 680) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
    $Flash = _CreateSWF('C:\Gauges\gauge.swf',10,10,400,300)


Func _CreateSWF($SWFPath, $SWFL, $SWFT, $SWFW, $SWFH, $SWFBGColor = "#505050")
    ; Create Flash Object
    $SWFObj = ObjCreate("ShockwaveFlash.ShockwaveFlash")
    $SWFActiveX = GUICtrlCreateObj( $SWFObj, $SWFL, $SWFT, $SWFW, $SWFH)
    ; Configure Flash Object
    With $SWFObj
        .Movie = $SWFPath
        .ScaleMode = 3 ;0 showall, 1 noborder, 2 exactFit, 3 noscale
        .bgcolor = $SWFBGColor
        .Loop = True
        .allowScriptAccess = "Always"        
        .FlashVars = '&xml_source=' & $xmlfile 
      EndWith
        Return $SWFObj
EndFunc

Has anyone seen this issue or have any ideas? I've tried upping the screen resolution up to 1024x768 but no help. Also, I tried 32bit and 16bit color, but again no help. Why would it work in IE but not AutoIt?

Share this post


Link to post
Share on other sites
PsaltyDS

I'm using an XML Gauge found here and on most PC's all is fine, but on my (OLD) laptop, it shows only a black box. The laptop is running 2k3 and screen resolution is 32bit, so not too terrible, and yes I have flash ActiveX installed. I can display the flash fine in an IE browser window, but when displaying in an AutoIt GUI, it's just a black box. Here's the AutoIt code I'm using to place the flash in the GUI:

GUICreate("Embedded Flash", 640, 680, (@DesktopWidth - 640) / 2, (@DesktopHeight - 680) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
    $Flash = _CreateSWF('C:\Gauges\gauge.swf',10,10,400,300)


Func _CreateSWF($SWFPath, $SWFL, $SWFT, $SWFW, $SWFH, $SWFBGColor = "#505050")
  ; Create Flash Object
    $SWFObj = ObjCreate("ShockwaveFlash.ShockwaveFlash")
    $SWFActiveX = GUICtrlCreateObj( $SWFObj, $SWFL, $SWFT, $SWFW, $SWFH)
  ; Configure Flash Object
    With $SWFObj
        .Movie = $SWFPath
        .ScaleMode = 3;0 showall, 1 noborder, 2 exactFit, 3 noscale
        .bgcolor = $SWFBGColor
        .Loop = True
        .allowScriptAccess = "Always"       
        .FlashVars = '&xml_source=' & $xmlfile 
      EndWith
        Return $SWFObj
EndFunc

Has anyone seen this issue or have any ideas? I've tried upping the screen resolution up to 1024x768 but no help. Also, I tried 32bit and 16bit color, but again no help. Why would it work in IE but not AutoIt?

Well, your demo is kind of pitiful, since it can't be run without some debugging... But, modified for an .swf file I actually have, this sort of works:
#include <GuiConstants.au3>
#include <WindowsConstants.au3>

GUICreate("Embedded Flash", 640, 680, (@DesktopWidth - 640) / 2, (@DesktopHeight - 680) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
$Flash = _CreateSWF('C:\Program Files\Rimage\QuickDisc\Printing.swf', 10, 10, 400, 300)
GUISetState()

Do
    Sleep(20)
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func _CreateSWF($SWFPath, $SWFL, $SWFT, $SWFW, $SWFH, $SWFBGColor = "#505050")
; Create Flash Object
    $SWFObj = ObjCreate("ShockwaveFlash.ShockwaveFlash")
    If Not IsObj($SWFObj) Then
        MsgBox(16, "Error", "$SWFObj is not an object")
        Return SetError(1, 0, 0)
    EndIf
    $SWFActiveX = GUICtrlCreateObj($SWFObj, $SWFL, $SWFT, $SWFW, $SWFH)
; Configure Flash Object
    With $SWFObj
        .Movie = $SWFPath
        .ScaleMode = 3;0 showall, 1 noborder, 2 exactFit, 3 noscale
        .bgcolor = $SWFBGColor
        .Loop = True
        .allowScriptAccess = "Always"
    ;.FlashVars = '&xml_source=' & $xmlfile
    EndWith
    Return $SWFObj
EndFunc  ;==>_CreateSWF

I had to add the #include's, set the state on the GUI, add a loop to keep the script running, and comment out the undeclared $xmlfile reference. The animation ran once and then stopped, so I guess the .Loop = True didn't take.

muttley

Edit: fixed code tag

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
DrJeseuss

PsaltyDS: pitiful demo yes. Sorry, I should have noted this was only a piece of the whole script which is rather large. The rest of it didn't seem to matter as far as the problem, so I posted up only the flash embed I'm using. My hope was that someone would recognize a problem, or have encountered such an issue. The script I have here is functional on most PC's, just not the laptop in AutoIt. But the same flash does work in IE on the laptop. So it's safe to assume the issue is with AutoIt, or the script to embed the flash in combination with something about the laptop. Thanks though.

Volly: I've read through your flash player, but as it's rather extensive I'm not finding the corrective part you referred to. What in your player differs from my embed that could be used to prevent the black display on certain systems? Thanks for the help.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.