Sign in to follow this  
Followers 0
bort

Resizing Shockwaveflash Control?

8 posts in this topic

I've succesfully created an instance of the ShockwaveFlash.ShockwaveFlash control in my au3 file (I use the most current beta version btw.). Now, I want to react to GUI resize events and adjust the size of the embedded control accordingly.

My message loop looks like this

While 1
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
            
        Case $msg = $GUI_EVENT_RESIZED
            $arr = WinGetClientSize($handle);
            $result = GUICtrlSetPos($GUIActiveX, 0, 0, $arr[0], $arr[1])
    EndSelect
    
Wend

But it does not work - no matter how I try to resize the ShockwaveFlash control nothing happens. Basically, what I want to achieve is that the control size is always 100% and the loaded Flash SWF file should resize accordingly.

Any ideas?

Thanks,

bort.

Share this post


Link to post
Share on other sites



I recently did somthing similar, I think I had to use WinMove().


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

That's interesting - could you please be a bit more specific?

Did you call WinMove() on the main GUI or on the ActiveX control? I tried both, but still no go.

bort.

Share this post


Link to post
Share on other sites

That's interesting - could you please be a bit more specific?

Did you call WinMove() on the main GUI or on the ActiveX control? I tried both, but still no go.

bort.

If you would like to provide an actual working script, then I/We could play around with it to give you a better idea.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Sure!

Attached is a ZIP containing the au3 script and a SWF (Flash) file.

The SWF file adjust automatically so it always takes 100% width and height. To check, simply drag & drop the SWF inside IE or FireFox. If you resize the browser window, the blue square (which is the SWF file) takes all available space and also displays its current size.

I want to recreate the same behaviour in my AutoIt GUI but still found no way. The funny thing is that the ActiveX control itself does resize (I added the WS_BORDER style to the ActiveX control and when resizing the main window the control also resizes!) but the SWF does not - it will always stay at the default 640x480 pixels at which it gets created initially.

Here's the code:

#include <GUIConstants.au3>
#NoTrayIcon

$flash = ObjCreate("ShockwaveFlash.ShockwaveFlash")
$handle = GUICreate ( "Flash Test", 640, 480, -1, -1, $WS_OVERLAPPEDWINDOW)
$GUIActiveX = GUICtrlCreateObj($flash, 0, 0, 640, 480)

GUICtrlSetStyle($GUIActiveX, BitOR(0x56000000, $WS_BORDER), 0); draw border around the control

$flash.Movie = @ScriptDir & "\FlashTest.swf"; load SWF file

GUISetState()

While 1
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $GUI_EVENT_RESIZED
            $arr = WinGetClientSize($handle); get current window size
            GUICtrlSetPos($GUIActiveX, 0, 0, $arr[0], $arr[1]); apply size to control - does not seem to work
    EndSelect
    
Wend

GUICtrlDelete($GUIActiveX)
$fp = 0
GUIDelete()

Exit

Thanks!

FlashTest.zip

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I don't understand what your trying ... it's working fine... use this as an example so you can see:

#include <GUIConstants.au3>
#NoTrayIcon

$flash = ObjCreate("ShockwaveFlash.ShockwaveFlash")
$handle = GUICreate ( "Flash Test", 640, 480, -1, -1, $WS_OVERLAPPEDWINDOW)
$GUIActiveX = GUICtrlCreateObj($flash, 0, 0, 640, 480)

GUICtrlSetStyle($GUIActiveX, BitOR(0x56000000, $WS_BORDER), 0); draw border around the control

$flash.Movie = @ScriptDir & "\FlashTest.swf"; load SWF file

GUISetState()

While 1
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $GUI_EVENT_RESIZED
            $arr = WinGetClientSize($handle); get current window size
            GUICtrlSetPos($GUIActiveX, 0, 100, $arr[0] / 2, $arr[1] / 2)
    EndSelect
    
Wend

GUICtrlDelete($GUIActiveX)
$fp = 0
GUIDelete()

Exit

Edit: I see, if you make it larger your having an issue.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Yes, and also the text inside the blue box should change/adjust but it always says 640x480. Somehow the resize event is not getting through to the ShockwaveFlash object that lives inside the ActiveX control.

Share this post


Link to post
Share on other sites

Well after doing some homework on flash (and only some as I'm not familiar with it all), it looks like you need a $flash.setbounds but I don't know how to impliment that.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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  
Followers 0