How to Communicate with JavaScript?

Answer Posted / satyendra dewangan

Using getURL method in AS 2.0..we can possibly call
javascript function..

Syntax:-

getURL("javascript:weightMIN('"+argument+"');");


If you want to call javascript function:-

function weightMIN(val){

alert(val);
}


OR

You can use also ExternalInterface class in flash AS 2.0..
import flash.external.*;

var methodName:String = "goHome";
var instance:Object = null;
var method:Function = goToAdobe;
var wasSuccessful:Boolean =
ExternalInterface.addCallback(methodName, instance, method);

var txtField:TextField = this.createTextField("txtField",
this.getNextHighestDepth(), 0, 0, 200, 50);
txtField.border = true;
txtField.text = wasSuccessful.toString();

function goToAdobe() {
txtField.text = "http://www.adobe.com";
getURL("http://www.adobe.com", "_self");
}

Is This Answer Correct ?    5 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is meant by vector graphic animation? What is the use of pre-loader?

523


the class that is inheriting the another is known as the? : Adobe flash

511


How to create scrolling gallery in portfolio?

501


which is not a benefit when adding a title in the document properties? : Adobe flash

472


Do you know what are the different primitive data types used in actionscript?

450






what is the primary purpose of the stage object? : Adobe flash

497


at which point can you start usability testing? : Adobe flash

502


explain the correct way to create an alert box using geturl and javascript? : Adobe flash

428


which items cannot be hidden from screen readers? : Adobe flash

499


what is the purpose of the break statement? : Adobe flash

592


How to embed flash in html?

501


user accessibility on your video project is a key factor. Which two features should you choose? : Adobe flash

467


How to play a movie clip?

512


what are the statements is true about actionscript in regards to the enforcement of private scope and public scope? : Adobe flash

475


what are the statements uses proper for loop syntax? : Adobe flash

500