How to add exiting event listener in javascript
I am trying to figure out how to add an event listener in javascript for the exiting event when the red x is clicked on a Windows window (top right corner).
I found this among adobe documentation, but it does not work:
var app = air.NativeApplication.nativeApplication;
app.addEventListener(air.Event.EXITING, closeHandler);
function closeHandler(event) {
alert("Goodbye.");
And yes I have the AIRAliases.js included.
Thanks
The code posted above is from page 10 of the "HTML Developer’s Guide for ADOBE AIR (prerelease updated 11/16/2009)".
I am actually exiting the program because I only have one window open and I click on the red x in the top right corner to shut it down... in theory, the example above provided by Adobe, should interrupt the exit sequence by displaying an alert box amd then shut the program down.
Here's the excerpt from the manual...
unload events (for body and frameset objects)
Adobe AIR 1.0 and later
In the top-level frameset or body tag of a window (including the main window of the application), do not use the unload event to respond to the window (or application) being closed. Instead, use exiting event of the NativeApplication object (to detect when an application is closing). Or use the closing event of the NativeWindow object (to detect when a window is closing). For example, the following JavaScript code displays a message ("Goodbye.") when the user closes the application:
var app = air.NativeApplication.nativeApplication;
app.addEventListener(air.Event.EXITING, closeHandler);
function closeHandler(event)
alert("Goodbye.");
However, scripts can successfully respond to the unload event caused by navigation of a frame, iframe, or top-level window content.
Note: These limitations may be removed in a future version of Adobe AIR.
Similar Messages
-
How to add Select event in dynamic ALV
Hi,
I have created dynamic ALV and now i want to checked the selected row value.
If in the selected row contain 'A' value then i have to disable the Button given on the screen.
If in the selected row contain B' value then i have to enable the Button given on the screen.
How to add the event once I select the row.
I have done like this . but it is not
lw_api_2->do_dynamic_navigation(
source_window_name = 'ZWDCHHR_EX_TASK_DELE'
source_vusage_name = 'ZWDVHHR_EX_TASK_DELE_USAGE_1'
source_plug_name = 'TO_ALV'
target_component_name = 'SALV_WD_TABLE'
target_component_usage = 'ALV_USAGE1'
target_view_name = 'TABLE'
target_plug_name = 'DEFAULT'
target_embedding_position = 'ZWDVHHR_EX_TASK_DELE/VIEW_DELEG_MY_TASKS' ).
register event handler
lw_cmp_usage_2->add_event_handler(
listener = lw_api_2
handler_name = 'ONSELECT_TAB1'
controller_name = 'INTERFACECONTROLLER'
event_name = 'ON_SELECT' ).
Thanks and regards
Amita GandhiHi Amita,
You can try fetch the number of the row which was leadselected through R_PARAM->INDEX. (This would be just a normal integer variable. You can try check this out in debugging mode. ) Now you can just read the data of this row from the context node by saying as GET_ATTRIBUTE up on the nodes reference with the index as R_PARAM->INDEX.
Regards,
Uday -
How to add an event handler dinamically
Hi all
I ceated Rich Adf component dinamically
RichShowDetailItem pnl = new RichShowDetailItem();
pnlTabbed.getChildren().add(pnl);
pnl.addDisclosureListener(??????);
i have a method in my bean
public void showDetailItem_disclosureListener(DisclosureEvent disclosureEvent) {
how to add event handler for this component to call this method?
Thanks in Advance
SosoHi,
see: http://thepeninsulasedge.com/frank_nimphius/2008/02/01/adf-faces-rc-how-to-programmatically-add-an-event-listener-to-a-dynamically-created-component/
Frank -
How to add an event to my calendar?
How to add an event to my calendar? I tried several times and the events are not there.
We appreciate you trying, Deborah1964. We'll get your events added! From your home screen, tap Calendar then tap the plus sign in the upper right corner to enter a new event. After you've made sure to selecy the correct dates, times, calendar (email address), etc then tap Add at the top right corner to save the event. Please keep us posted if you run into any error messages or what happens after you save the event if you continue to have trouble.
JenniferH_VZW
Follow us on Twitter www.twitter.com/vzwsupport -
How to add click event to MatrixLayoutRow
Hi all,
I want to add click Event to MatrixLayoutRow, Do you know how to add this Event ?Hi there,
That link appears to be broken. I'm not sure what you mean by "no .css file was created". Edge does not directly use .css files.
To add a button action to an object in Edge is straightforward. See this video at the 2:00 mark:
http://www.youtube.com/watch?v=ysReea4yyys
Here's a breakdown of how to add a click event to an object:
1) click the curly braces to the left of the object in the Elements panel. This will launch the code event panel for your object.
2) click the "+" button at top left and select "click", to add a click event to your object.
3) assuming your object is on the root Stage, you can use the code presets at the right of your click event. Click the "play from" button at right of the events panel. This will insert sym.play(1000); which tells the timeline to play from the 1 second mark. You can change the play parameter to a frame label, say "intro", like this: sym.play("intro");
Look at the Edge Animate API for more details on the play method:
http://www.adobe.com/devnet-docs/edgeanimate/api/current/index.html -
How to add page event on the every pdf footer
How to add page event on the every pdf footer
there is an option available in third party tool which you are using for create PDF using java. so read API documentation. if you can also extend/customize any feature using java
-
How to send the Event Listener arguments in AS3?
In MXML
<mx:Button click="clickHandler();"
mouseDown="downHandler(event);" mouseOver="overHandler(btn);"
mouseMove="moveHandler('RAJAN');"/>
but AS3
var btn:Button = new Button();
btn.addEventListener(MouseEvent.CLICK, clickHandler, flase,
0, true);
only this kind of AS3 event only added, any other possibility
to pass the arguments to handler function.
please help.From that link:
If you define an event listener inline (inside the MXML tag),
you can add any number of parameters as long as the listener
function's signature agrees with that number of parameters.
If you add a listener with the addEventListener() method (in
ActionScript), you cannot pass any additional parameters to the
listener function, and that listener function can declare only a
single argument, the Event object (or one of its subclasses).
To pass additional parameters to listener functions defined
in AS, you must define the parameters in the listener function and
then call some other method passing it the additional parameters in
the call from the listener.
You can also define your own custom events, and then you are
free to define what args your event listeners take, and access the
data from the event object. -
I would like to add a button/trigger that goes back to the beginning of the animation when all the elements of my composition, including symbols which have their own timelines and trigger buttons, were created and drawn/played. It should be independent of the main timeline.
Is there any way to do it?
Thanks!Can a click event handler be added to the stage to control symbols that are on the stage? Like this question How to add a symbol event handler (on click or on mouseover) on the stage timeline
Basically we are looking for way to load in a bunch of instructions at run time, instead of having to individually control each individual symbol. -
How to add an event to an outlook or google calendar?
Good afternoon. I have a new client that expressed the desire to have the ability to add a "button that lets the customer add the event directly to their calendar." We haven't hashed out all the details, but I imagine by "their calendar" she means google, or outlook, or the like. She didn't want an internal calendar- meaning a member's calendar in a private area of the site- but an actually externally based one you would send the event to.
Has anyone had any experience with this, or know if this can be accomplished using modules (calendar or otherwise) with Business Catalyst.
Many thanks!marcabal has posted a very good explanation for sig 3030 here:
http://forums.cisco.com/eforum/servlet/NetProf?page=netprof&type=EmailAFriend&CommCmd=MB%3Fcmd%3Dpass_through%26location%3Doutline%40%5E1%40%40.1dd9b49a%2F0#selected_message
It may also explain some of the other problems.
I would like to add that in any field usually means that the signature does not require anything in that field in order to fire, and therefore, it is truly "not applicable". In the referenced post, marcabl indicated that filters should be a little more controllable in version 5.1. However, we haven't upgraded from 5.0 yet so I couldn't confirm that. I would hope that regardless of whether the data is applicable to the signature or not, the sensor would gather and display the information in SecMon.
With 3030, it came down to a question of, "is this signature really helping us keep this network secure?" I pulled a lot of hair out over that signature. -
How to add an Event action filter when victim address is " na "?
Using VMS/IPS MC to add an event action filter. IPS MC requires an victim address in the event action filter, however the alert in Security Monitor has "<na>" as the victim address.
I tried "0.0.0.0 255.255.255.255", which caught the alerts that had victim addresses, but the alerts with victim address of <na> are still being reported.
The signatures are 3250 and 3251 (tcp hijacks).marcabal has posted a very good explanation for sig 3030 here:
http://forums.cisco.com/eforum/servlet/NetProf?page=netprof&type=EmailAFriend&CommCmd=MB%3Fcmd%3Dpass_through%26location%3Doutline%40%5E1%40%40.1dd9b49a%2F0#selected_message
It may also explain some of the other problems.
I would like to add that in any field usually means that the signature does not require anything in that field in order to fire, and therefore, it is truly "not applicable". In the referenced post, marcabl indicated that filters should be a little more controllable in version 5.1. However, we haven't upgraded from 5.0 yet so I couldn't confirm that. I would hope that regardless of whether the data is applicable to the signature or not, the sensor would gather and display the information in SecMon.
With 3030, it came down to a question of, "is this signature really helping us keep this network secure?" I pulled a lot of hair out over that signature. -
How to populate the <html:option> tag dynamically
I have a tree view, in tree view tag ( <layout:maeuItem> tag i have written "onclick " event )
<layout:menuItem key="${agrovoc.AGURI}" link="#"
onClick="return copyVal(this)">
<script language="javascript" type="text/javascript">
function copyVal(obj){
str= obj.innerHTML;
l = str.length-4;
xyz= str.substring(12,l);
document.getElementById('agrovoc').value =document.getElementById('agrovoc').value + xyz+'\n';
</script>Here "xyz" contains the Term ( the term clicked in the tree view) now i want add these terms ( clicked in tree view) into <html: option> tag.... how to do this.. plz give me some ideas
<html:select property="agrovocbuffer" size="10" >
<html:option value="" styleId="agrovoc1"></html:option>
</html:select>Hi,
i have tried with this, it's works fine... but when i click on the next page ( i mean 2 or 3 page etc ) the content of <html:option> are erasing (deleting).. i wanted those terms wht i have selected in the 1st page to remain in <html:option> when i click on 2 nd page also...
Tree view code
<layout:menuItem key="${agrovoc.AGURI}" link="#"
onClick=" copyVal(this)">JavaScript
<script language="javascript" type="text/javascript">
var i=0;
var myArray=new Array();
function copyVal(obj){
var flag=0;
str= obj.innerHTML;
l = str.length-4;
xyz= str.substring(12,l);
while (xyz != null) {
for( var l=0;l<myArray.length;l++){
if( myArray[l]==xyz){flag=1;alret("The Term is already selected.");}
if(flag!=1){
document.getElementById('agrovoc').options[i] =new Option(xyz,xyz);
myArray=xyz;
i++;
//alert(i);
xyz=null;
function del(){
var oc=document.getElementById('agrovoc').options;
//alert(oc.length);
firstBox = document.getElementById('agrovoc');
selectedOption = firstBox.options[firstBox.selectedIndex].value;
selected = firstBox.options[firstBox.selectedIndex].index;
//alert(selected);
for( var l=0;l<myArray.length;l++){
if( myArray[l]==selectedOption){myArray[l]="";}
firstBox.options[firstBox.selectedIndex] = null;
var oc=document.getElementById('agrovoc').options;
//alert(oc.length);
for(var x=selected;x<oc.length;x++,selected++)
document.getElementById('agrovoc').options[x] =new Option(firstBox.options[selected].value);
i=oc.length;
</script>
<html:select> code<div align="left" id="hopt">
<td valign="top">
<logic:present name="hcount">
<html:select property="agrovocbuffer" size="15" styleId="agrovoc" multiple="true" style="width:200px;" >
<html:option value="" ></html:option>
</html:select><html:button property="button" onclick="del()"> DEL</html:button>
</logic:present>
</td>
</div>
And all the above code is in <html:form> tag & i have written a custom pagination page
Now i want all terms which are in <html:option> remain in options when i goto 2 nd page..
how to do this? In the DOM inspector i'm getting the options, but when see the source HTML there are no <html:options>.. when click on the 2 page link the terms which are in <html:option> are not going to the "Action" class .. :(
how to do this .. any idea plz..? -
How to get 'exit event' script to execute again when form file with saved data is re-opened?
I have created an Adobe Dynamic XML Form using LiveCycle Designer with many fields / subforms that are ‘visible’ or ‘hidden’ dependent upon the options selected from various Drop-Down Lists. The form has also been save-enabled. Users can successfully complete the form and save a copy with the data that has been input.
The problem I have is that when the saved file is re-opened the ‘hidden’ fields / subforms which were previously made visible by selection of the appropriate options from the Drop-down Lists are now NOT displayed. However if you make the same selections from each of the Drop-down Lists AGAIN the hidden fields / subforms are displayed and do contain the data that was entered.
The problem appears to be that the script which determines whether a field / subform is ‘hidden’ or ‘visible’ is an
<event activity="exit" name="event__exit">
which is followed by
if (this.rawValue == "0")- (i.e. the value of the Drop-down List)
sfCompanyDetails.presence = "visible";
sfRecruitmentAgency.presence = "hidden";
etc, etc
and, therefore, it is not executed again when the saved file is re-opened.
Can anyone please advise how to achieve this?Moved from Adobe Connnect Forums.
-
How to remove an event listener of Enter Frame
basically, i doing a three level game. 1st level is dodging the stone from sky, Secondly, samsh the wolf head. However, when i enter leve1 2 game, it show me an error.
TypeError: Error #2007: Parameter hitTestObject must be non-null.as:113 Cant access to null object or reference.as.83
I think due to when i enter level 2, the object is not available anymore, so happen this errors,izzit? how i gonna fix this?
package
import flash.display.MovieClip;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.ui.Mouse;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.events.Event;
public class level1 extends MovieClip
var vx:int;
var vy:int;
var collisionHasOccurred:Boolean;
var score:uint;
public function level1()
init();
function init():void
//Initialize variable
vx=0;
vy=0;
collisionHasOccurred=false;
stone.stop();
score=0;
optionPage.visible=false;
//Add event listeners
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
wolf2.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
function onKeyDown(event:KeyboardEvent):void
if(event.keyCode==Keyboard.LEFT)
vx=-5;
else if (event.keyCode==Keyboard.RIGHT)
vx=5;
else if (event.keyCode==Keyboard.UP)
vy=-5;
else if (event.keyCode==Keyboard.DOWN)
vy=5;
function onKeyUp(event:KeyboardEvent):void
if (event.keyCode==Keyboard.LEFT || event.keyCode==Keyboard.RIGHT)
vx=0;
else if (event.keyCode==Keyboard.DOWN || event.keyCode==Keyboard.UP)
vy=0;
function onEnterFrame(event:Event):void
trace(player);
trace(cursor);
trace(aaa);
trace(wolf2);
trace(wolf);
//Move the player
player.x+=vx; <-------------------------------------------------------------this is line 83
player.y+=vy;
//collision detection
if (stone.hitTestObject(player))
player.gotoAndStop(3);
health.meter.width-=2;
if (! collisionHasOccurred)
score++;
messageDisplay.text=String(score);
collisionHasOccurred=true;
else
player.gotoAndStop(1);
collisionHasOccurred=false;
if (health.meter.width <=1)
New.text="Game Over!";
stop();
fl_CountDownTimerInstance_3.stop();
if (player.hitTestObject(wall)) <-------------------------------------------------this is line 113
player.x-=vx;
player.y-=vy;
if (player.hitTestObject(wallA))
player.x-=vx;
player.y-=vy;
if (player.hitTestObject(wallB))
player.x-=vx;
player.y-=vy;
if (player.hitTestObject(wallC))
player.x-=vx;
player.y-=vy;
if (player.hitTestObject(wallD))
player.x-=vx;
player.y-=vy;
if (player.hitTestObject(wallE))
player.x-=vx;
player.y-=vy;
if (player.hitTestObject(wallF))
player.x-=vx;
player.y-=vy;
if (player.hitTestObject(wallG))
player.x-=vx;
player.y-=vy;
if (player.hitTestObject(wallH))
player.x-=vx;
player.y-=vy;
function fl_MouseClickHandler(event:MouseEvent):void
score++;
aaa.text=String(score);
trace("Mouse clicked");instead of:
if (player.hitTestObject(wall))
use:
if(player&&wall){
if (player.hitTestObject(wall)) -
How to add onmouseover event to a PanelBox
Hi All,
Is it possible to add an onmouseover event to a PanelBox? I'd like to have a hidden toolbar within the PanelBox and only show the toolbar when the user mouses over the PanelBox.
thanks ,dean.Hi ,
I just tried to see can we implement mouseOver / mouseDown / dbClick e.t.c on panel box.
here is the sample jspx code , here i tried mouse over on panelbox..
just copy paste into plain jspx and run the page and see...
it may help to solve your problem.
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document id="d1">
<!--<af:resource type="javascript"
source="/resources/js/portalscript.js"/>-->
<af:resource type="javascript">
function togglePanelBox(mouseEvent)
var panelBox = mouseEvent.getSource();
panelBox.broadcast(new AdfDisclosureEvent( panelBox, !panelBox.getDisclosed()));
</af:resource>
<af:form id="f1">
<af:pageTemplate viewId="/oracle/templates/threeColumnTemplate.jspx"
id="pt1">
<af:resource type="javascript"
source="/sample.js"/>
<f:facet name="center">
<af:panelBox text="PanelBox1" id="pb1"> <f:facet name="toolbar"/>
<af:clientListener method="togglePanelBox" type="mouseOver"/>
</af:panelBox>
</f:facet>
<f:facet name="header"/>
<f:facet name="end"/>
<f:facet name="start"/>
<f:facet name="branding"/>
<f:facet name="copyright"/>
<f:facet name="status"/>
</af:pageTemplate>
</af:form>
</af:document>
</f:view>
</jsp:root>
thanks,
Annapareddy S. -
How to add a title to a JavaScript Confirm dialog box.
function confirmDelete() {
var msg = "Do you want to continue removing the items ?";
return confirm(msg);
Presently it says http://locahost:8080/says etc on the title bar for the dialog box. Instead I want to set the title as "Confirm Delete". How can I do this?You're talking about the document title as you set it in the HTML head? Just alter the title of the document accordingly in the same Javascript function.
If you find Javascript hard, there's a nice tutorial at w3schools.com. And for Javascript related questions better use a forum devoted to Javascript. There are ones at webdeveloper.com and dynamicdrive.com.
Maybe you are looking for
-
My iPad is not responding. It does not unlock. I have a message: iCloud Backup, "This iPad hasn't been backed up in 5 weeks. Backups happen when this iPad plugged in, locked, and connected to Wi-Fi". My Question: plugged in to WHAT? locked, HOW? and
-
Transfer a file to a protected directory
Hi, I'm trying to save a file in a directory that is protected by userid and password. I'm using FM GUI_DOWNLOAD and receiving the exception GUI_REFUSE_TRANSFERFILE. Have someone already done this? Thanks a lot, Flavio.
-
How to reflect "Reverse Termination "changes through API
HI , we are writing interfaces to migrate all created /updated datain the local instance to global instance. frequency of interfaces will be daily..what will be the API used to reflect the Reverse termination cases in to global instance... Regards, N
-
Hi there... How can i put a namespace in my request xml in flex. So, my going data is: <clientRequestwithReturn> <MoneyTransferRequest> <requestChannel>01</requestChannel> <fromAccountNo>0008830006000007</fromAccountNo> </MoneyTransferRequest> </clie
-
Database connectivity problem..! Help..!
Hi, I have an application running on Windows platform deployed on Weblogic. This application is trying to access a Database which is configured on Redhat Linux 4 -I configure it as a JDBC connection pool in the weblogic, now if i test the connectivit