ActionScript 3.0 :: Create Alert Before Browser Window Is Closed?
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.
I have a chat program built using flash for the front end tied to a J2EE back end. My program creates socket connections which must be closed appropriately when a user signs off.
When a user decides to sign off they can click the sign off button and everything is peachy. However, a less responsible user may choose to sign off by simply killing the browser window. Is there any way to implicitly call an actionscript routine on this event?
Here's what I'd like to know: is it possible to run a SWF in a browser (as a kiosk), then have a separate browser window load on top of the SWF so it looks like it's part of the SWF?
[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.
I'm developing an AIR application which uses multiple windows. I'm running into an issue where I want to open new windows (toaster notifications for example) when the primary application window is not visible, but the behavior is different depending on how the window is closed.
When a user hides all application windows with CMD-H, opening a new window causes all application windows to come back to the foreground (instead of just that new window, like I would expect). If the user closed a window with CMD-W, however, that window does not become visible when I open a new window.
Is there a way to either 1) tell when the user uses cmd-h to hide all windows OR 2) tell whether a window is hidden using cmd-h vs. closed cmd-w?
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?
I have created a simple slideshow of thirteen frames. The slideshow script starts at Frame 2. This is because I have inserted a preloader in Frame 1. When I output my SWF and upload it to the web, it pulls down without incident. However, when I "Simulate Download" locally, Flash says this in the Output window:
TypeError: Error #1009: Cannot access a property or method of a null object reference. at AS3GallerywPreloader_fla::MainTimeline/updatePreloader() [AS3GallerywPreloader_fla.MainTimeline::frame1:9] And it keeps writing this error message, ad infinitum, until I close the SWF movie window!
Here is the preloader script: stop(); loaderInfo.addEventListener (ProgressEvent.PROGRESS, updatePreloader); function updatePreloader (evtObj: ProgressEvent): void{ var percent:Number = Math.floor((evtObj.bytesLoaded*100) /evtObj.bytesTotal); preloader_txt.text = percent+"%"; if (percent==100) { nextFrame (); }}
I should note that the slideshow portion functions as it should (the Back and Forward buttons advance frame by frame). In essence, the whole movie works. But I suspect I that error code is a bad thing to have. I ran the "Debug" feature (Debug-->Debug Movie), but got no apparent indication of a bad line of code.
In Flex (Flash Builder 4) I am opening a new window via PopUpManager.addPopUp. I have timer code that runs in my component and I need to stop my timer when that window opens and start the timer again when the window closes.
I figure it's easy enough to stop the timer in the function that opens the window, but how can I start the timer again when the window closes?
Is there a way to tell if there is a pop-up window in front of my component, or if a specific pop-up window is still open via PopUpManager?
is it possible for flash to detect when a user closes an html window with a swf embeded in it?
I want to record a user session time and need to be able to call a function and serverside script from within flash when a user closes the window...is there a way?
(I thought I might be able to do it with onUnload, but that will only work for unloading movieclips, not closing the main swf.)
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?
I was wondering if anyone might know why my Alert box doesn't appear when viewing the .swf in firefox when I click on the button that evaluates the code responsible activating the Alert.show command. It appears when I open the .swf in the flash player and inside the 'play movie' command within Flash itself. Do I need to include some type of file in the relative directory?
Does anyone know of a class file or third party component that has the same functions (or similar) of what the alert window component did in flash 8? I am doing this is AS3 obviously is why i need an alternative.Im trying to make a pop up modal window of sorts like the alert window component did.
Adobe AIR provides Alert.show(). However this seems to fail if there is no top level window like in the typical tray example ("Example: Creating an application with no windows"):
[URL]
I failed to make Alert.show() work in this situation. Seems that there is no alert() either.Is there any way to show an alert prompt (modal or nonmodal) in such a situation without reinventing the wheel?Example AIR tray application skeleton:
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;
I think I remember hearing that you can trigger a java alert message from within actionscript out to the html page but whats the code to do such a thing?
I have a function that checks for something when the user clicks a button. if that something is found, an alert comes up saying that it has been found and asks them if they would like to allow this to happen, or undo the action that caused the something to be found. the code looks like this:
Alert.show(thisString1, "Conflict: Multiple Projects", 3, this, conflictAnswer); upon pressing "Yes" or "No", the conflictAnswer function will be called... it looks like this: private function conflictAnswer(event:CloseEvent):void[code]....
but it didn't work.
EDIt: After reading the first respond, i've come up with this:
I am trying to style the Alert window on an external file but I get the following warning and the style won't be applied, keep in mind that the Alert is being called from an external AS file as well so the code is not embedded in the MXML.
The CSS type selector 'Alert' was not processed, because the Alert was not used in the application.Type alert in CSS selector 'Alert' must be qualified with a namespace.
Alert{ color : #124332; background-color: #ffffff; header-colors : #243322, #243322;
i have some script that called 'to make a popup alert / wndow alert like java script window alert' like this :Code:navigateToURL(new URLRequest("javascript:alert('Some Text..');"),"_Self");but thats didnt work for me, when i try to call that, that just open the blank url in my web browser.
Now I set dragEnabled="true", dropEnabled="true" and dragMoveEnabled="true" to archive the ability to reorder my Items via Drag and Drop. But as soon as I start to Drag an Item the whole Application crashes with:
i have a login system done in flex.once the user logs in and if he refreshes the page it will take you back to the login page.how can i make the logged in user stay in the same page using flex and java only?and also if once user is logged in and another loggs in with the same user name and passwrod how can i handle dat using flex and java?
I'm trying to make a popup alert modal window thing with an external class. I have a simple swf set up with just some random sample text, a rectangle, and a button. What I want to happen is for the "alert" class to initialize upon startup of the swf and then when I click the button (instance: btn), the alert will show up. If I get rid of all AS in the swf and set alert as the document class, it shows up just fine, so I think it should be working, but for some reason I get this instead when I try the button function:
I'm working on a project in Actionscript 3.0 in Flash Pro. I want to create a confirmation box. If I were using the Flex SDK I could do this using the Alert class in the mx.controls package. However it seems that no similar control exists in the standard Flash library, and any amount of googling just leads me to Flex references.
I am having an issue where I show an AlertBox message when the user hits ENTER and the focus is in a text area. The pop up works fine, but when the user hits enter the Alert closes as expected, but the TextArea listener receives the ENTER event from the Alert and pops the dialog up again. I have tried a number of ways to catch and eat the event but so far I have not been lucky. Is there way to accomplish this?
public function init():void { myTextInput.addEventListener(KeyboardEvent.KEY_UP, handleKeyStrokes);[code]....
i have a flash site that links to PDF's with the navigateToURL function which works etc But now i would like Link to rather open up a download window instead of just a new browser window?