-
1. Re: store data in backend with flash & AS3
kglad Jun 1, 2012 6:04 AM (in response to rahimhaji)yes, you can use the as3 urlLoader() class to post variables/values to server-side script (like php) which then adds the data to your db.
-
2. Re: store data in backend with flash & AS3
rahimhaji Jun 1, 2012 6:33 AM (in response to kglad)hi kglad,
thks for ur reply and advice, if i use urlLoader, should i use navigateToUrl? if i use navigate to url, it will open another new aspx page. i dont want that. Whatever is there in the screen it has to be there as it is. but i need to pass the variable/value to the server while reading the lessons. pls advice me.
Thanks in advance,
Syed
-
3. Re: store data in backend with flash & AS3
kglad Jun 1, 2012 6:34 AM (in response to rahimhaji)don't use navigateToURL(), use urlLoader(). it won't open another browser window.
-
4. Re: store data in backend with flash & AS3
rahimhaji Sep 17, 2012 4:57 AM (in response to kglad)Dear Friends,
iam loading my swf file in aspx file on the browser, when i click a button i will pass 2 variables to database and close or unload. If the user close the browser withtout click on that button i want to post that values and save in the dtabase. how can i do that pls explain me.
find below the code i used to store data when i click a button.
var variables:URLVariables = new URLVariables();
var varSend:URLRequest = new URLRequest("lmsHome.aspx");
var varLoader:URLLoader = new URLLoader;
varSend.method = URLRequestMethod.POST;
varSend.data = variables;
frdbut.addEventListener(MouseEvent.CLICK,sendMessage);
function sendMessage(event:MouseEvent):void {
variables.elecode = lescode;
variables.eleduration = "2:0"
varLoader.load(varSend);
}
Thanks in advance,
Syed Abdul Rahim
-
5. Re: store data in backend with flash & AS3
kglad Sep 17, 2012 5:57 AM (in response to rahimhaji)you can use the javascript onunload method to detect when users close that window and you can use the actionscript externalinterface class to communicate between javascript and actionscript.
-
6. Re: store data in backend with flash & AS3
rahimhaji Sep 18, 2012 5:43 AM (in response to kglad)Dear Mr.kglad,
Greetings! Thks for the reply, i tried, it is working as javascript, i mean when i close the browser it is working, but when i opend the file or refress, it is not working, i mean, i cannot pass any variale or run a function in flash.
pls tell me how to clear this problem, i want to run a function existing in flash while closing or refreshing the brower where the flash swf is loaded.
find below my code:
flash code:
import flash.external.ExternalInterface;
import flash.external.*;
ExternalInterface.call("show_alert","1234");
javascript code:
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
<script type="text/javascript" language="javascript">
function show_alert(s){
alert(s);
alert("This is a test..");
}
</script>
</head>
<body bgcolor="#ffffff" onUnload="show_alert('ind');">
Regards,
Syed Abdul rahim
-
7. Re: store data in backend with flash & AS3
kglad Sep 18, 2012 6:37 AM (in response to rahimhaji)if you want so pass 'ind' to show_alert() on loading and reloading, you can use:
<body bgcolor="#ffffff" onload="show_alert('ind');" onUnload="show_alert('ind');">
-
8. Re: store data in backend with flash & AS3
rahimhaji Sep 18, 2012 8:49 PM (in response to kglad)hi thks for the reply,
i want to run a function existing in flash while closing or refreshing the web brower where the flash swf is loaded.
pls help me..
Thanks in advance,
Syed Abdul rahim
-
9. Re: store data in backend with flash & AS3
kglad Sep 18, 2012 10:50 PM (in response to rahimhaji)call a different javascript function that uses the callback method of the externalinterface class. the help files have sample code.
note: use the embedding html shown (or swfobject) to embed your swf.


