Volatil3
Volatil3

Reputation: 14978

Debugging ActionScript in Browser

I am trying to implement following:

How can I start a flash video from javascript?

However I am unable to call method from Javascript. The trace message I wrote within AS file is not able to see while calling file within browser.

How can I test whether my JS function is calling AS method or not?

Upvotes: 1

Views: 1304

Answers (4)

average dev
average dev

Reputation: 1118

Just check this example http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html , maybe you forgot something

Upvotes: 0

Daniel
Daniel

Reputation: 35684

The simplest method is to create a javascript function that only has an alert function inside. try calling it, you either get the pop-up or you don't.


edit:

Alert is a javascript command, but you can call it directly from flash using external interface call.

as:

var call_java:uint;
call_java = ExternalInterface.call('alert','!!!');

or... call the alert from a function AS:

var call_java:uint;
call_java = ExternalInterface.call('myFunction','!!!');

javascript:

funciton myFunction(val)
{
    alert(val);
}

Upvotes: 0

Volatil3
Volatil3

Reputation: 14978

here is the code which I am using:

import flash.external.*;

var flashFunction:String = "jsstopMainVideo"; var realFunction:Function = stopMainVideo; function stopMainVideo(){
trace("called from javascript"); //flvPlayer.stop(); }

//stopMainVideo();

var wasSuccessful:Boolean = ExternalInterface.addCallback(flashFunction, null, realFunction);

In JS I am doing:

var me = null; function getID( swfID ){ if(navigator.appName.indexOf("Microsoft") != -1){ me = window[swfID]; }else{ me = document[swfID]; } } getID("signupVideoVideo"); me.jsstopMainVideo();

I am getting JS error that function me.jsstopMainVideo() is not a function

Upvotes: 0

daihovey
daihovey

Reputation: 3575

The FlashBug addon for Firefox lets you see Flash trace outputs in your browser.

Upvotes: 1

Related Questions