Jump to content

Embedding Flash object with alpha blending


Zazza
 Share

Recommended Posts

Greetings,

I saw many requests like mine on this forum but I couldn't find a ultimate solution to the problem.

Here's the scenario:

I'm building a flash fullscreen GUI for a DVB program. AutoIT should embed the .swf file and display it with alpha blending background. In other words, I need to see the DVB application running under my GUI.

The problem is that I always end up with an opaque background. Among others, someone suggested to use the WinSetTrans command but this will not work since it controls the alpha value of the entire window.

I know that projectors like Zinc could make that but the final file would be an executable I couldn't embed anymore.

I saw no solution on the net. I wonder if it's really possible?

Thanks...

Edited by Zazza
Link to comment
Share on other sites

I'm sorry to bother but... No one ever tried that?

Thanks... Again. :unsure:

I know nothing about this so my suggestion might be useless, but why not create an ie window and then I would expect that it is relatively easy to add flash animation.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I know nothing about this so my suggestion might be useless, but why not create an ie window and then I would expect that it is relatively easy to add flash animation.

Thanks Martin but with HTML, I think the problem is just the same: an HTML page has got a white background. I need this white to be transparent.

Is there a way to have an HTML page or iframe totally transparent?

Edited by Zazza
Link to comment
Share on other sites

Thanks Martin but with HTML, I think the problem is just the same: an HTML page has got a white background. I need this white to be transparent.

Is there a way to have an HTML page or iframe totally transparent?

Oh, do you mean you want the gui holding the flash to be transparent? Then maybe you need a layered popup window and set the background colour as transparent. But maybe you have already tried that.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

This may (or may not) be what you after, and perhaps what martin was describing...

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

Opt("GUIOnEventMode", 1)
Opt("GUICloseOnESC", 1)


$width = @desktopwidth
$height = @desktopheight

Global $oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.10")
Global $flash = GUICreate("Videos", @desktopwidth, @desktopheight + 20, 0, 0, BitOR($WS_POPUP, $WS_CLIPSIBLINGS , $WS_CLIPCHILDREN , $WS_EX_TOPMOST))

GuiSetState (@SW_SHOW , $flash)

GUICtrlCreateObj($oRP, 0, 0, @DesktopWidth, @DesktopHeight + 20)

                    With $oRP
                    .bgcolor = "#000000"
                    .Movie = "http://www.youtube.com/v/x6DD1k4BAUg?fs=1&amp;hl=en_US&autoplay=1"
                    .ScaleMode = 1
                    .Loop = 'True'
                    .wmode = "transparent"
                    .FlashVars = ""
                    .menu = 'True'
                    .play()
                EndWith

$xCenter = (@DesktopWidth / 2) - 150
$yCenter = (@DesktopHeight / 2) - 150

Global $flash1 = GUICreate("Videos1", 300 , 300, $xCenter - 300, $yCenter, BitOR($WS_POPUP, $WS_CLIPSIBLINGS , $WS_CLIPCHILDREN , $WS_EX_TOPMOST))
GUISetBkColor (0x000000 , $flash1)

Global $boRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.10")
Global $flash2 = GUICreate("Videos2",  300 , 300, $xCenter + 300, $yCenter, BitOR($WS_POPUP, $WS_CLIPSIBLINGS , $WS_CLIPCHILDREN , $WS_EX_TOPMOST))

GUICtrlCreateObj($boRP, -1, -1, $xCenter - 80, $yCenter + 80)
WinSetTrans ("Videos2" , '' , 90)



                    With $boRP
                    .bgcolor = "#000000"
                    .Movie = "http://www.youtube.com/v/Q8_6aa-TTvI?amp;hl=en_US&autoplay=1"
                    .ScaleMode = 1
                    .Loop = 'True'
                    .wmode = "transparent"
                    .FlashVars = ""
                    .menu = 'True'
                    .play()
                EndWith




GuiSetState (@SW_SHOW , $flash2)



while 1
    GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_CLOSE")
    Wend


    Func GUI_Close()
        GUICtrlDelete ($oRP)
    GUIDelete($flash)
    Exit
EndFunc
Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Thanks iamtheky but this seems not what I'm looking for.

Anyway, I think a picture is worth a thousand words so here's what I'm trying to accomplish:

Posted Image

The video image is the DVB application running, the bluish background is a semi-transparent overlay, the white circle is the Flash swf file with transparent background.

I was thinking about using two GUIs (one inside another) but, for what I've seen, the child one can't be set as fully opaque while the parent is semi-transparent.

Is that so?

Thanks again for your contribution...

Edited by Zazza
Link to comment
Share on other sites

Thanks iamtheky but this seems not what I'm looking for.

Anyway, I think a picture is worth a thousand words so here's what I'm trying to accomplish:

Posted Image

The video image is the DVB application running, the bluish background is a semi-transparent overlay, the white circle is the Flash swf file with transparent background.

I was thinking about using two GUIs (one inside another) but, for what I've seen, the child one can't be set as fully opaque while the parent is semi-transparent.

Is that so?

Thanks again for your contribution...

Could you have the DVB app running, a bluish transparent popup window over that and run the flash file on top?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Could you have the DVB app running, a bluish transparent popup window over that and run the flash file on top?

I'm afraid not, because in that case, I would have a white background in the SWF file since Flash can only render animations with transparent background when embedded in a HTML page.

A wrapper (like Zinc) would convert the SWF in an executable with a transparent background but then AutoIt wouldn't communicate with the COM interface of the DVB application (that's the main point of the entire project).

Since I'm really no expert, maybe there's some kind of "workaround"...

Edited by Zazza
Link to comment
Share on other sites

I'm afraid not, because in that case, I would have a white background in the SWF file since Flash can only render animations with transparent background when embedded in a HTML page.

A wrapper (like Zinc) would convert the SWF in an executable with a transparent background but then AutoIt wouldn't communicate with the COM interface of the DVB application (that's the main point of the entire project).

Since I'm really no expert, maybe there's some kind of "workaround"...

Ok, just one more question. Since I don't really understand the problem I hope I don't irritate you :huh2:

In your first post you say you want to embed the .swf file in the AUtoit gui. What does that mean? If you mean you could use the exe made by zinc but you need an autoit gui around it and still have the flash animation transparent so you can see the video then it doesn't sound like a problem, because you only need to make an autoit gui with a hole in it the size of the video. Or am I completely lost here?

Or in post #7 you show what you're trying to accomplish and the only thing I guess that you have there that is not the video or the flash circle is the lettering. The letters could be added like that with AutoIt as well. (I'm probably still lost.)

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Really thanks Martin... And no, you're not irritating me. :huh2: On the contrary, you and the others, have dedicated much time to me.

I'll try to sum up, since I realize my observations could be confusing.

The DVB application (DVBViewer) needs to communicate thru the COM (Component Object Model) interface with Flash and vice versa. To do this, I'm trying to use AutoIt as a "bridge" between the two.

So the sequence is:

1) Start the DVB application

2) Start AutoIt script that create a GUI with the SWF inside

3) Interact with the DVB application using the SWF

The problem is that, by default, SWF backgrounds are opaque. So, inserting (ObjCreate) the SWF in an AutoIt GUI and run it would mean to cover the DVB application completely. Instead, I need to see thru the SWF animation.

The only ways (I found) to have the SWF with a transparent background are:

1) inside a HTML page. But, then again, the HTML page background would be opaque and cover the DVB application.

2) using for the SWF a wrapper like Zinc. But then, the executable can't be interrogated with ObjCreate and COM interface. I'd be happy to be proved wrong about this.

I know it's just an aesthetic problem but it's quite important to me.

Hope this clarifies things more.

Link to comment
Share on other sites

Can you explain how what you want is different from my suggestion?

--removed the checkerboard stuff so its just two videos

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


Opt("GUIOnEventMode", 1)
Opt("GUICloseOnESC", 1)


$width = @desktopwidth
$height = @desktopheight

Global $oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.10")
Global $flash = GUICreate("Videos", @desktopwidth, @desktopheight + 20, 0, 0, BitOR($WS_POPUP, $WS_CLIPSIBLINGS , $WS_CLIPCHILDREN , $WS_EX_TOPMOST))

GuiSetState (@SW_SHOW , $flash)

GUICtrlCreateObj($oRP, 0, 0, @DesktopWidth, @DesktopHeight + 20)

                    With $oRP
                    .bgcolor = "#000000"
                    .Movie = "http://www.youtube.com/v/x6DD1k4BAUg?fs=1&hl=en_US&autoplay=1"
                    .ScaleMode = 1
                    .Loop = 'True'
                    .wmode = "transparent"
                    .FlashVars = ""
                    .menu = 'True'
                    .play()
                EndWith

$xCenter = (@DesktopWidth / 2) - 150
$yCenter = (@DesktopHeight / 2) - 150

Global $flash1 = GUICreate("Videos1", 300 , 300, $xCenter - 300, $yCenter, BitOR($WS_POPUP, $WS_CLIPSIBLINGS , $WS_CLIPCHILDREN , $WS_EX_TOPMOST))
GUISetBkColor (0x000000 , $flash1)

Global $boRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.10")
Global $flash2 = GUICreate("Videos2",  300 , 300, $xCenter + 300, $yCenter, BitOR($WS_POPUP, $WS_CLIPSIBLINGS , $WS_CLIPCHILDREN , $WS_EX_TOPMOST))

GUICtrlCreateObj($boRP, -1, -1, $xCenter - 80, $yCenter + 80)
WinSetTrans ("Videos2" , '' , 90)



                    With $boRP
                    .bgcolor = "#000000"
                    .Movie = "http://www.youtube.com/v/Q8_6aa-TTvI?amp;hl=en_US&autoplay=1"
                    .ScaleMode = 1
                    .Loop = 'True'
                    .wmode = "transparent"
                    .FlashVars = ""
                    .menu = 'True'
                    .play()
                EndWith




GuiSetState (@SW_SHOW , $flash2)



while 1
    GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_CLOSE")
    Wend


    Func GUI_Close()
        GUICtrlDelete ($oRP)
    GUIDelete($flash)
    Exit
EndFunc
Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Can you explain how what you want is different from my suggestion?

Hi iamtheky,

because the main video (Mandelbrot iterations) in your example (that we can consider as a background) can't be set semitrasparent: you'll never will see through it unless you set the entire window opacity with the WinSetTrans command.

I think I have to live with that.

The closest solution I found is:

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

$GUI = GUICreate("Page", @DesktopWidth, @DesktopHeight, -1, -1, $WS_POPUP)
$object = _IECreateEmbedded ()
$object_ctrl = GUICtrlCreateObj($object, 0, 0, @DesktopWidth, @DesktopHeight)
_IENavigate($object, @ScriptDir & "\page.html")
GUISetState()
WinSetTrans("Page","",235)

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

The file "page.html" is an HTML page with a solid blue background and a SWF animation with wmode set to transparent. WinSetTrans will slightly change the opacity of the window (obviously including the SWF) allowing to see thru the HTML page.

Edited by Zazza
Link to comment
Share on other sites

i don ´t have experience emmbeding flash, but using _WinAPI_SetLayeredWindowAttributes() you will be able to make tranparent the client area of the window

Hi monoscout,

using _WinAPI_SetLayeredWindowAttributes() gives me strange rendering problem with shadows. I don't know if it's related to $WS_COMPOSITE style not working in Aero environment.

Edited by Zazza
Link to comment
Share on other sites

Like i said i never work embbeding Flash.. if you have a link to a semi transparent flsh for test purposes i will try to find a way to do it

Greetings,

you'll find a zip file attached. It contains the sample SWF and the script. The SWF background is white. Try to run the script on your desktop and tell me what you see, please.

Thank you.

test.zip

Link to comment
Share on other sites

i see a blue circle and a cyan button fading off without background....(transpasrent BK)

Hi... Try to run the script over (for example) a video or a non-white background. Is everything alright? No white parts surrounding the two objects like in this screenshot?

Posted Image

Edited by Zazza
Link to comment
Share on other sites

yes.. -.- the white border... ¿how i make the flash static?, because it banish all the time i guess the problem are the semi transparents parts are opaqued

EDIT; The only thing i found in the internet...

http://forums.creativecow.net/thread/191/863418

Edited by monoscout999
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...