Jump to content

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


Recommended Posts

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 4 weeks later...

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 3 years later...
  • 3 years later...
  • Moderators

@shockwaveflash did you happen to notice this thread is 7 years old? Please don't resurrect old threads, especially when your comment really adds nothing to the original discussion.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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