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 ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is meant by vector graphic animation?

468


which two file formats can be imported into a swf file at runtime? : Adobe flash

494


for methods within objects,what does the keyword this specifically refer to? : Adobe flash

537


which of the following is not a key benefit of usability testing? : Adobe flash

517


How does removal of actual objects and data work in actionscript?

477






what is not a disadvantage of using the fscommand? : Adobe flash

507


I shoot underwater with a ttl strobe that does not allow you to set flash exposure compensation. How do I set fill flash with this set up? : Adobe flash

474


the value of a variable of timeline scope will persist until? : Adobe flash

491


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

504


What are the ways in which actionscript's code can be protected?

470


what are the properties can be used to control the order in which the user can tab through the elements in a flash movie? : Adobe flash

486


Explain what are the data types supported by actionscript?

488


How to embed flash in html?

501


Tell me what are the different ways in which the variables can be assigned?

502


How many menus will you find on the menu bar?

505