Sign in to follow this  
Followers 0
leonidas

Error with Flash and ObjEvent with version 3.3.8.1

5 posts in this topic

Hi

I'm having problems with AutoITversion 3.3.8.1. I can't receive FSCommands from my Adobe Flash .swf file.

But everything works fine and without any problem with version 3.3.6.1

With oldest version I receive FSCommands from .swf

I tried another version of Adobe Flash Player (older version) but the problem still exists.

Only when I uninstall AutoIT version 3.3.8.1 and install 3.3.6.1 ,I can solve the problem.

Please I need your help.

#include 'GUIConstantsEx.au3'

Global $hGUI = GUICreate("Demo Program",500,500)

Global $oSW = ObjCreate('ShockwaveFlash.ShockwaveFlash')
Global $Shockwave = GUICtrlCreateObj($oSW, 0, 0, 500, 500)

$swfObjEvents = ObjEvent($oSW, "FSCommand")
GUISetState(@SW_SHOWNOACTIVATE,$hGUI)

With $oSW
$oSW.LoadMovie(0, @ScriptDir & "\FlashTest.swf")
EndWith

While 1
$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()

Func FSCommand($type, $command, $arguments)
MsgBox(0,"","$command ==> " & $command & " - $Arguments ==> " & $arguments,3)
EndFunc

Share this post


Link to post
Share on other sites



That functionality was removed from the language because it caused unnecessary lag in script execution. Use proper and docummented way of event handling.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Can you please help me or guide me of how to do that?

I dont know from where I must start to find a solution.

Share this post


Link to post
Share on other sites

Sure. You have to know what event(s) you want to handle, meaning you have to know the name of the sink's event function the main object uses.

I have modified your code a bit to catch onreadystatechange event:

#include 'GUIConstantsEx.au3'

Global $hGUI = GUICreate("Demo Program", 500, 500)
Global $oSW = ObjCreate('ShockwaveFlash.ShockwaveFlash')
Global $Shockwave = GUICtrlCreateObj($oSW, 0, 0, 500, 500)

; Event dispatch object
Global $oSwfObjEvents = ObjEvent($oSW, "MyHandler_")

; Show GUI
GUISetState()

; Load swf
$oSW.LoadMovie(0, "http://edmullen.net/flash/clock7.swf")


While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
WEnd


; Here you define event function by using specified function prefix (MyHandler_) and appending the event name (e.g. onreadystatechange)
Func MyHandler_onreadystatechange($iNewState)
    ConsoleWrite("!>onreadystatechange event fired, newState = " & $iNewState & @CRLF)
    MsgBox(0, "Fired", "onreadystatechange event fired, newState = " & $iNewState)
EndFunc

...I hope that helps.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

A big thanks for your help trancexx.

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