Jump to content
Sign in to follow this  
CheshireSoft

How to Embed Flash Object? Getting error with every example.

Recommended Posts

CheshireSoft

I am simply trying to embed a flash movie in my application. I have pasted every single example I could find into the script editor but I can't get any of the scripts to run. Its always the same error. For instance here is an example:

#include <GUIConstants.au3>
Global $oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
GUICreate ("Flash", 820, 600, -1, -1)
$GUIActiveX    = GUICtrlCreateObj( $oRP, 10, 10 , 800 , 580)

With $oRP
    .bgcolor = "#000000"
    .Movie = 'http://...game.swf';
    .ScaleMode = 2
    .Loop = True
    .wmode = "Opaque"
    .FlashVars = ""
EndWith

GUISetState ()

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

$oRP = 0
GUIDelete ()
Exit

and I get this error:

Only Object-type variables allowed in a "With" statement.:

With $oRP

With ^ ERROR

->04:59:32 AutoIT3.exe ended.rc:1

>Exit code: 1 Time: 1.271

I get this error for every example of embedding a flash file I attempt to run.

Share this post


Link to post
Share on other sites
99ojo

Hi,

try:

Global $oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash")

;-))

Stefan

@Edit: Sry, code works also with Global $oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.1") and a local swf file on Win XP SP3:

#include <GUIConstants.au3>
Global $oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
GUICreate ("Flash", 820, 600, -1, -1)
$GUIActiveX    = GUICtrlCreateObj( $oRP, 10, 10 , 800 , 580)

With $oRP
    .bgcolor = "#000000"
    .Movie = @WindowsDir & '\Help\Tours\mmTour\intro.swf';
    .ScaleMode = 2
    .Loop = True
    .wmode = "Opaque"
    .FlashVars = ""
EndWith

GUISetState ()

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

$oRP = 0
GUIDelete ()
Exit

Check registry HKLM\Software\Classes\Shockwave.Shockwave entries.

Edited by 99ojo

Share this post


Link to post
Share on other sites
CheshireSoft

Hi,

try:

Global $oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash")

;-))

Stefan

@Edit: Sry, code works also with Global $oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.1") and a local swf file on Win XP SP3:

#include <GUIConstants.au3>
Global $oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
GUICreate ("Flash", 820, 600, -1, -1)
$GUIActiveX    = GUICtrlCreateObj( $oRP, 10, 10 , 800 , 580)

With $oRP
    .bgcolor = "#000000"
    .Movie = @WindowsDir & '\Help\Tours\mmTour\intro.swf';
    .ScaleMode = 2
    .Loop = True
    .wmode = "Opaque"
    .FlashVars = ""
EndWith

GUISetState ()

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

$oRP = 0
GUIDelete ()
Exit

Check registry HKLM\Software\Classes\Shockwave.Shockwave entries.

i dont have that in classes. maybe my error is because i dont have shockwave installed? testing now.

Share this post


Link to post
Share on other sites
99ojo

hi,

i dont have shockwave installed

Looks like...

If your Internet Explorer plays the swf file, create an embedded IE GUI.

;-))

Stefan

Edited by 99ojo

Share this post


Link to post
Share on other sites
CheshireSoft

looks like i did have shockwave installed. its still giving me this error when I try to run this code. I am running windows vista sp2. Can anyone confirm this error on vista? I am at a total loss here.

Share this post


Link to post
Share on other sites
CheshireSoft
:idea:

Share this post


Link to post
Share on other sites
CheshireSoft

heeeelp. this is a nasty bug its killing me.

Share this post


Link to post
Share on other sites
99ojo

Hi,

if you don't have the registry entries HKLM\Software\Classes\Shockwave.Shockwave you have problems with creating an com object.

1) You might have only the flash player installed. Install the Shockwave Player.

2) Does your browser (IE) does play the swf files? If yes, try to create an embedded IE browser in your gui.

See _IECreateEmbedded () for more info.

;-))

Stefan

Share this post


Link to post
Share on other sites
CheshireSoft

Hi,

if you don't have the registry entries HKLM\Software\Classes\Shockwave.Shockwave you have problems with creating an com object.

1) You might have only the flash player installed. Install the Shockwave Player.

2) Does your browser (IE) does play the swf files? If yes, try to create an embedded IE browser in your gui.

See _IECreateEmbedded () for more info.

;-))

Stefan

here is what my registry looks like. I am pretty sure its installed because i can view flash and shockwave in IE:

Posted Image

also, you cannot load flash in an IE object in autoit. at least it never works for me. it always tells me there is no flash player installed but in my normal IE there is.

Share this post


Link to post
Share on other sites
99ojo

Hi,

tested on WinXP SP3 and Win7 Ultimate 64 Bit as admin and normal user with AutoIt 3.3.6.1 -> no problems with generating flash object.

You may try to reinstall flash player.

;-((

Stefan

Share this post


Link to post
Share on other sites
CheshireSoft

Hi,

tested on WinXP SP3 and Win7 Ultimate 64 Bit as admin and normal user with AutoIt 3.3.6.1 -> no problems with generating flash object.

You may try to reinstall flash player.

;-((

Stefan

did you test my source or yours? can I see your source code please?

Share this post


Link to post
Share on other sites
99ojo

Hi,

I can't test your code, because i don't know a http site with a direct *.swf link...

Mine is listed above, but here it is again.

This works on XP SP3 and Win 7 64 bit. You may have to change the filename of intro.swf on Windows 7 system to an existing swf file.

#include <GUIConstants.au3>
Global $oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
GUICreate ("Flash", 820, 600, -1, -1)
$GUIActiveX    = GUICtrlCreateObj( $oRP, 10, 10 , 800 , 580)

With $oRP
    .bgcolor = "#000000"
    .Movie = @WindowsDir & '\Help\Tours\mmTour\intro.swf';
    .ScaleMode = 2
    .Loop = True
    .wmode = "Opaque"
    .FlashVars = ""
EndWith

GUISetState ()

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

$oRP = 0
GUIDelete ()
Exit

;-))

Stefan

Edited by 99ojo

Share this post


Link to post
Share on other sites
Tvern

The examples didn't work for me when running from Scite, but compiled it worked fine. (Win7 x64)

When running from scite, no object was created. ObjCreate did work to create other objects, like IE.

Adding the custom COM error handler resulted in this message:

We intercepted a COM Error !

Number is: 80040154

Windescription is: Klasse is niet geregistreerd (Dutch for "Class is not registered")

Hope this helps solving the issue

edit: added the error info

Edited by Tvern

Share this post


Link to post
Share on other sites
Weasly

Maybe you can try to re-register flash10e.ocx

"regsver32 C:\Windows\System32\Macromed\Flash\flash10e.ocx"

Share this post


Link to post
Share on other sites
Tvern

Tried "regsvr32 C:\Windows\SysWOW64\Macromed\Flash\Flash10g.ocx" without success.

A bit more testing reveals that:

x86 run and compile both work.

x64 run and compile both fail.

Using Win7 Ultimate x64.

Share this post


Link to post
Share on other sites
DW1

Tried "regsvr32 C:\Windows\SysWOW64\Macromed\Flash\Flash10g.ocx" without success.

A bit more testing reveals that:

x86 run and compile both work.

x64 run and compile both fail.

Using Win7 Ultimate x64.

That makes since. Flash does not support 64-bit browsers.

Share this post


Link to post
Share on other sites
Tvern

I could point out that I'm not embedding in a browser, but yeah, that'll be the problem. Not an AutoIt bug then.

Thanks for the clarification. I think it's safe to assume the OP had the same problem.

Edit:

Didn't want to bump this up anymore as I think it's resolved, but @99ojo:

I tested by running from scite (appears to use x64 by default) --- > failed

Selected Run from the test.au3 file's contextmenu --- > failed

Selected Run(x86) from the test.au3 file's contextmenu --- > succeeded

Compiled with default settings --- > succeeded

Compiled x64 --- > failed

Tried the test code in this topic with local *.swf files

I don't think a browser is embedded. I think the autoit GUI acts as a webbrowser. (x86, or x64)

I don't think IE, or the graphic driver have anything to do with it, unless autoit embeds IE in order to embed *.swf's

Edited by Tvern

Share this post


Link to post
Share on other sites
99ojo

Hi,

how did you test?

My example works fine on Win 7 64 Bit Ultimate (Compiled and as au3 script);

but it is running as a VMWare machine. I use a local stored swf file without problems.

You may post your test code if you haven't tried mine and i can test it on monday on my Win 7 machine.

By the way, how do i know, which browser, 64 bit or 32 bit version, is used as embedded object?

Both are available!

;-))

Stefan

P.S: ?? It might be a combination of ie, flash and graphic driver ??

Edited by 99ojo

Share this post


Link to post
Share on other sites
NIKHILSKYNET

I had the same problem,

it is solved when i changed 

Global $oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")

to

Global $oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.11")

i got ShockwaveFlash.ShockwaveFlash.11 from HKLMSoftwareClassesShockwaveFlash.ShockwaveFlash.11

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  

×