12/30/2009 4:29:36 AM
Title:
how to change variable value at runtime in flex application
i want to change variable value thru javascript at runtime : See the following url [http://www.specsavers.co.uk/glasses/mens-glasses ] click on try on button. You will see immediate loading of that frame.
How can i do this.
12/30/2009 6:05:38 AM
you can do it by using external interface class in flash. Any function can be exposed to javascript by flash using external interface . On click of button in HTML you can call the exposed function of flash and do what ever you want to do , You can also pass parameters
12/30/2009 6:18:33 AM
if you are using FLex then you can simply use it like this
//Call createCallBack() function on application initialize to expose external function "changeSpecks"
import flash.external.ExternalInterface;
//Expose function changeSpecks to javascript
public function createCallBack() {
ExternalInterface.addCallback("changeSpecks",changeSpecks);
}
private function changeSpecks():void{
//change the specks or do what ever you want to do in flash
}
//in javaScript you need to write this code to call the function
function callFlashFunction(){
//here mymovie is your embeded flash movie in page
var flash = document.getElementById("mymovie");
flash.changeSpecks();
}
12/30/2009 7:58:31 AM
thanks a lot .
this is all what i wanted to know.
you guys are very quick in reply [[[ AMAZING ]]]