header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
jeet
Points:0
Posts:0

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.




1
Orbit
Points: 0
Posts:0
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

2
Kite
Points: 0
Posts:0
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();
}

3
jeet
Points: 0
Posts:0
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 ]]]


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 6+5 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions