Javascript :: To Execute Flex Cleanup Function When Browser Is Closed By User?
Oct 29, 2009
I have a Flex client application. I need a clean up function to run in Flex when the user closes the browser. I found the following solution on the net, but it only works half-way for me. How could I fix it?CustomEvent triggered, but not executed. >> EventHandler for CustomEvent.SEND_EVENTS is defined by a Mate EventMap. All the handler does is to call an HTTPServiceInvoker. In debug console, I'm able to see the handler and HTTPServiceInvoker being triggered, but neither the resultHandlers nor the faultHandlers were called. I know this event handler has no problem because when I dispatch the same CustomEvent.SEND_EVENTS in a button click handler, it behaves exactly as I expected)Browser seems to wait for cleanUp function to complete before it closes. (all traces were printed before browser closes down)
Code
I added the following into the index.template.html
window.onbeforeunload = clean_up;
[code].....
View 3 Replies
Similar Posts:
Feb 7, 2010
I was wondering if you can make an eventlistener to trigger to execute a function when the window/tab viewing the swf is closed. I searched around, and there seems to be a way to do this with flash.external class and javascript, but some users have javascript disabled, so is there a way to achieve this without javascript?
View 3 Replies
Oct 9, 2010
I am currently using ExternalInterface to call JS functions from Flex. Is it possible to do the same the other way around: have Flex execute a function when a certain trigger is executed in JS? I want to have a Flash app with buttons in HTML that when pressed call functions inside the Flex app.
View 1 Replies
Jul 30, 2009
I have an input text box with the instance name of input_txt and a dynamic text field named output_txt. I'm trying to do something with the dynamic field when the user has entered text into the input field. So far, this is what I have:
input_txt.addEventListener(TextEvent.TEXT_INPUT, update);
function update(event:TextEvent):void {
output_txt.text = "foobar";
}
I don't know if this is valid ActionScript 3.0. I am getting an error that says "the class 'TextEvent' could not be loaded."
View 4 Replies
Mar 12, 2011
I'm trying to execute a function like window.alert for example, from actionscript, when both the html file and the swf file are using the file: protocol.without changing global flash security settings
View 3 Replies
Nov 15, 2011
Generally when you unload an swf from another swf you would follow a cleanup utilzing removed from stage or unload events. But when you exit an as3 flash application by either navigating away from page or reloading the page or closing/removing the application. what is the best practices you would follow to ensure proper cleanup and garbage collection.
Question : what methods in solely as3 code can be used in this regard. It may be argued that once an swf is unloaded or removed its memory foot print can be verified to have decreased eg via the task manager Is this a good enough measure? Or is it advisable to handle the unloading/exiting in a proper manner ?
View 1 Replies
Oct 10, 2010
I was wondering if flex has some events that can call before I close the whole application or close browser. Since I would like to send a httpservice to a php before the swf is closed. I tried this before:
<mx:Application xmlns:mx="" creationComplete="init()" remove="clearHistroy()">
But it didn't work.
View 1 Replies
May 11, 2011
I came across a website recently that outputs a whole bunch of user info: IP, browser, OS, flash version, javascript, etc in a very easy to use format. It was specifically designed for remote support, in order to determine user operating environment. However, I cant recall the name of the website.
View 1 Replies
Dec 21, 2011
So I'm building a web application, and in part of the application the user should choose an XviD (.avi) video file from his machine, to be played in the browser (without uploading it). I decided to use Flash for this.
Now I have two questions about this:
Which Flash video player is free to use and capable of doing this? How should I let the user choose a video file, and how can I link the Flash video player to the file?
View 1 Replies
Jun 18, 2011
Is it possible to calculate sha256 hashes in the browser using the user's video card, eg. by using WebGL or Flash?
I'm afraid this is all there is to ask, but if more elaboration is needed
View 2 Replies
Nov 29, 2011
[URL] I needed to do clean up before the MC is gone ... so after some digging I found this event:
Event.REMOVED_FROM_STAGE
So I am trying to ask for some conformation here: Is this the ONLY situation that my MC will be deleted automatically by Flash? If so then I can just listen to this even and call my cleanup function when it happens...
View 1 Replies
Sep 9, 2009
FMS: 3.5..User is not getting disconnected from FMS on IE until IE is closed. While it works on Firefox and Chrome.When a user logs out on Firefox and Chrome, the user connection of FMS is getting updated. But it doesn't work on IE until IE is closed.
View 10 Replies
Feb 9, 2011
I am developing an lib which tracks user events, like button click, state change, module load and application finish.
My problem is how I can track the application finish event. I googled for it, but I found no good answer.
View 1 Replies
Sep 3, 2011
For some reason, the ExternalInterface.avaiable shows true, but it won't call alert(). Can anyone shed some light to this problem?
private function checkEI():void {
eiStatus = ExternalInterface.available.toString();
ExternalInterface.call("alert", "hi");
[code].....
View 2 Replies
Dec 3, 2009
[url] i first thought they were using a socket server for this but if they were using socket server, i can only login one per ip address right? but if i open up two different browser, i can log in with two different character interacting each other.what i really dont understand is, how the character dispears right after the browser closed, without using a socket server.
View 2 Replies
Aug 26, 2005
Is there any way to clear a flash file and html file from cache as soon as the browser is closed? I hate having to clear my cache everytime!
View 1 Replies
Oct 26, 2008
I've been working on something of late that will display text the first time the user views it, and the second time, say something different. I've accomplished this using haredObjects. However, it seems that the information (the shared object) isn't removed when the user leaves of closes the browser. I there a workaround for this?
View 2 Replies
Jan 29, 2010
I have flash as a gui to edit some docs. I'd like to caution the user to save before they close the window (or navigate away from it).ut can it be done with a .swf ?I think this was asked awhile back in this forum but I cant seem to locate it.
View 2 Replies
Oct 25, 2010
While live/recording will the stream closed in fms when I refresh the browser??
View 1 Replies
Jun 2, 2010
I create some elements( UIComponents, mainly Panels) inside the "mx:Application name=¯tst¯ . I need to cleanup all those UIComponent's on MouseClick event , using Actionscript. Is there any way I access the children elements of mx:Application ( I used var totalChildren:Number = this['tst'].numChildren ; but looks like it fails to access the children list).
View 1 Replies
Sep 19, 2010
I need to do some updates to components after a user has resized the browser window. Is there a good solution to determine when a user has completed resizing? I wasn't able to find any flex events that would cover this case.
View 1 Replies
Nov 15, 2011
I have an swf loaded in a browswer (fire fox) and i use log on console using [code]I have initialized my swf in the document class on the Event.Added to stage.and i have a clean up function performing all the clean up/exit process in the code on the event [code]Now Doubt that this is being called/ activated/trigered as i am not able to log the start and end of the function to the console.The console log is of firebug.What exactly am i missing here? I would like to call the cleanup function on reload of page or relode of swf or change of page.How do i trigger and log it properly
View 1 Replies
Jan 3, 2012
I want to add scripting functionality to my Adobe Flex application. I know it's possible to use the Browser control, and add the script packaged as a HTML file to the Browser control, and expose Flex objects. However I'd like to if it is possible to execute JavaScript without using the Browser control.UPDATE: I guess my question hasn't been clear enough. I'll explain what I'm trying to do.I want to make my application customizable using JavaScript ie., add scripting/plugins to my application dynamically.I realize that it's possible to dynamically execute Javascript by inserting the JS code into the HTMLLoader control. I would like to know there is a direct way to execute JavaScript without inserting it into the HTMLLoader control.
View 2 Replies
Feb 14, 2007
How can I execute the javascript from my flash application? That javascript returns the flash movie (.swf file). I want to load that swf file into movie clip. What control i can use or any way to do that?
View 11 Replies
Jul 8, 2010
I am refactoring some code. I have a PHP page that contains a MySQL query and stores the result in a PHP variable $my_result. This result is then echoed to a Flash SWF during embedding with SWFObject. I now want to call this PHP page that makes the query from a javascript function like so - one change I have made to the PHP is that instead of storing the result in a variable $my_result I am echoing the result. Javascript function to call the PHP page and make the database query
[Code]....
View 2 Replies
Feb 22, 2011
I need to load an SWF(child) which is embedded in a PHP page without loading the PHP page in the browser. I call this PHP page from another SWF(parent) using URLRequest. I do not want to load the SWF(child) directly in the SWF(parent), instead call the PHP page from SWF(parent). Is it possible?
View 4 Replies
Apr 14, 2010
I have developed a simple chat room but how do I go about showing who is online and what happen if the user close the web browser without disconnect, will the user name in the online list be remove immediately? I use mx.messaging.channels.StreamingAMFChannel and set <subscription-timeout-minutes>3</subscription-timeout-minutes>
View 1 Replies
Apr 21, 2010
How do I execute callback functions dynamically by passing a function in as an argument to another function?
Look at this example:
Code:
package {
public class myClass extends MovieClip {
public function myClass(callback) {
[code]....
View 2 Replies
Mar 29, 2010
I'm authoring in Flash CS4 using Motion Tweens.
Here is the situation. I have a JavaScript that closes the DIV containing my flash object. It currently closes after 15 seconds. That is supposed to be how long the Flash movie lasts. however, slower machines run the movie longer. this means the flash object closes too quickly and they don't see the entire movie. . . if I increase the time, the users of fast machines have to wait around awhile for the movie to disappear.
So, I would like the movie to execute the javaScript when it gets to the last frame.
View 5 Replies
Mar 22, 2012
My page uses both flash and javascript. Currently, I have a video player which makes use of commands like "videoP.sendEvent('PLAY');". I'm building a new, custom player and have never used the sendEvent() method.I've always used "setVariable" with a listener.
I'd like to NOT alter the code in my html page and make use of it's sendEvent() functionality. So, I guess my question is ... how do I RECEIVE the event? The player is already targeted properly within my html. I just need to tell my flash doc to execute the information it receives.
View 0 Replies