Jump to content

[SOLVED] Flash Transparency Not Working on All Computers


 Share

Recommended Posts

Allo!

I have a problem with transparency. I've included a test zip file which has all the files needed:

transparency.zip

  • transparency_test.au3 - AutoIT code
  • color_slider.swf - Flash File that allows you to change the color
  • color000000.gif - gif file colored completely black

When I run the program on my computer, it works fine. The color_slider initially displays black which is defined to show as transparent and so things come up as see through. Also programmed in is a GUI Hole so that too is transparent.

I then bring the program to a Dell Latitude 120L, which is a laptop, and things stop working. The hole still works, so that you can see through the round hole. But the colored transparency does not work. It shows up as black.

The funny thing is when I go into the Display Properties and change the Color quality to 16 bit from 32bit, THEN it starts working.

I don't even know if any of you will see the problem, because I'm sure most of you have high end computers. But here's hoping someone can figure this out.

Thanks!

#include <GUIConstants.au3>
Opt("ExpandEnvStrings", 0)      ;0=don't expand, 1=do expand
Opt("ExpandVarStrings", 0)      ;0=don't expand, 1=do expand
Opt("GUICloseOnESC", 0)         ;1=ESC  closes, 0=ESC won't close
Opt("GUICoordMode", 1)          ;1=absolute, 0=relative, 2=cell
Opt("GUIOnEventMode", 1)        ;0=disabled, 1=OnEvent mode enabled
Opt("GUIResizeMode", 0)         ;0=no resizing, <1024 special resizing
Opt("RunErrorsFatal", 1)        ;1=fatal, 0=silent set @error
Opt("SendAttachMode", 0)        ;0=don't attach, 1=do attach
Opt("SendCapslockMode", 0)      ;1=store and restore, 0=don't

; Create Main Window
$winObj = GUICreate("Transparency Tester", 640, 480, -1, 0, -1 ,BitOr($WS_EX_LAYERED,$WS_EX_TOOLWINDOW,$WS_EX_TOPMOST))
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
GUISetState(@SW_SHOW,$winObj)

; Transparency
GUICtrlCreatePic("color000000.gif", 0, 0, 640, 480)
GUICtrlSetState( -1, $GUI_DISABLE)

; Create Flash Object
$swfObj = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
$swfActiveX = GUICtrlCreateObj( $swfObj, 0, 0 , 640, 480)

;GUICtrlSetState($swfActiveX,$GUI_HIDE)

$swfObj.Movie = @WorkingDir & '/color_slider.swf'
$swfObj.ScaleMode = 3 ;0 showall, 1 noborder, 2 exactFit, 3 noscale
;$swfObj.bgcolor = "#000000"
$swfObj.Loop = True
$swfObj.WMode = "Opaque"

_GuiHole($winObj, 80, 30, 200)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

GUIDelete ()
Exit

Func _Quit() 
    Exit
EndFunc


Func _GuiHole($h_win, $i_x, $i_y, $i_size)
   Dim $pos, $outer_rgn, $inner_rgn, $wh, $combined_rgn, $ret
   $pos = WinGetPos($h_win)
  
   $outer_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", $pos[2], "long", $pos[3])
    If IsArray($outer_rgn) Then
        $inner_rgn = DllCall("gdi32.dll", "long", "CreateEllipticRgn", "long", $i_x, "long", $i_y, "long", $i_x + $i_size, "long", $i_y + $i_size)
        If IsArray($inner_rgn) Then
            $combined_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0)
            If IsArray($combined_rgn) Then
                DllCall("gdi32.dll", "long", "CombineRgn", "long", $combined_rgn[0], "long", $outer_rgn[0], "long", $inner_rgn[0], "int", 4)
                $ret = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $combined_rgn[0], "int", 1)
                If $ret[0] Then
                    Return 1
                Else
                    Return 0
                EndIf
            Else
                Return 0
            EndIf
        Else
            Return 0
        EndIf
    Else
        Return 0
    EndIf
  
EndFunc  ;==>_GuiHole
Edited by Errol
Link to comment
Share on other sites

Try to convert your GIF file to a PNG file

Hmmm, it seems that GUICtrlCreatePic doesn't work with png images.

What I did try was a jpg. And the results were strange.

It didn't work when I first ran it. While the script was running, I changed it to 16 bit, and transparency started working. Then I switched it back to 32 bit, and it still worked!

However, closing and rerunning the application reverted it back to not working.

*sigh*

Link to comment
Share on other sites

At the top you say:

The funny thing is when I go into the Display Properties and change the Color quality to 16 bit from 32bit, THEN it starts working.

Then in your last post you say:

It didn't work when I first ran it. While the script was running, I changed it to 16 bit, and transparency started working. Then I switched it back to 32 bit, and it still worked!

So apparently it works in both 16 and 32 bit color.

Edited by weaponx
Link to comment
Share on other sites

So apparently it works in both 16 and 32 bit color.

Sorry, I'll try and be more clear.

With GIF

  • 16bit on all computers - Transparency Always Works
  • 32bit on my computer - Transparency Works
  • 32bit on Dell Laptop - Doesn't Work

With JPG

  • 16bit on all computers - Transparency Always Works
  • 32bit on my computer - Transparency Works
  • 32bit on Dell Laptop - Doesn't Work. If I switch it to 16bit it starts working. If I switch it back to 32bit while script is still running, 32bit transparency works... until I restart the script, at which point it no longer works.
Link to comment
Share on other sites

  • 1 month later...

Hmmm, this may not be easily solvable, still can't find a way to do it.

Ah well, how about this then:

Anyone know how to automatically change the color quality from 32 bit to 16 bit and back again? I could have it pop up the display and mouse through everything visibly, but I was just hoping to do it a bit more automatically.

Thanks!

Link to comment
Share on other sites

  • 4 weeks later...

Ok, I think I've solved the problem, albeit it's a strange solution.

If you choose a transparent color, this will not show up as transparent in the loaded in .swf file.

However, if you put in a DYNAMIC TEXT character, make it a device font without any anti aliasing, and have its color the transparent color, it will be transparent.

So, I chose one character in the Arial font that is a block (square), made it the transparent color, and then covered the entire background with that font. I had to make sure it wasn't rotated or anything. Although, I was able to resize it.

Now transparency works.

*sigh*

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...