OnClose function

Hello

Use this function in my third screen .if, I press the button to return my unit it

trips out of my application.

public boolean onClose()
    {

        try
        {
            //Stop Player
            _player.stop();
        }
        //catch MediaException
        catch (MediaException e)
        {
            e.printStackTrace();
        }

        if (_player != null)
        {

            _player.close();
            _player = null;
        }

        System.exit(0);
        return true;
    }

instead I need to return to the first screen

How to do this?

Hi, don't override this onClose() method

public boolean keyChar (key char, int status, int time)
{
Boolean retval = false;
if(Key == Characters.Escape)
{

make your code here
retval = true;
Close();
}
on the other
{
retval = super.keyChar (key, status, time);
}

Return retval;
}

Tags: BlackBerry Developers

Similar Questions

  • Close button of the palette UI shooting onClose callback multiple times

    Hello

    When you do:

    palette.onClose = function() { ... }
    
    
    

    ... and then clicking the close button (the small circle of OS UI in the upper left corner), in the UI of the pallet the onClose triggers recall at least 20 times.

    Why? Is this a normal behavior?

    Disabling the OS user interface when close button (using option closeButton: fake) and create a button instead:

    palette.myCloseButton.onClick = function() { ... }
    
    
    

    The onClick is triggered only once and the palette window is closed.

    Everyone notices this difference? Is it me?

    I'd love to not have a close to my palette button... I prefer to use the narrow circular button UI OS (but not if he's going to fire the recall several times in a row).

    Thank you!!!

    I did a simple test, and it does not seem to be fired only once on my computer Mac Yosemite.

    #target illustrator-19
    function test(){
      var w = new Window("palette", "Test");
    
      var lbl = w.add("statictext", undefined, "Test");
    
      w.onClose = function(){
      alert('closed.');
      };
    
      w.show();
    };
    test();
    
  • Window type "palette" and onClose event.

    Hi friends

    I m having a problem with an onClose event in a panel type "palette." Let´s try to explain the problem.

    Suppose I have this unique construction:

    var myDialog = new window ("palette", "My dialog box", undefined, {closeButton:false});})

    var bt = myDialog.add ('button', undefined, 'Ok', {name: 'ok'});

    myDialog.onClose = function() {}

    for example: app.activeDocument.layers.add ();

    };

    myDialog.show ();

    If I change the window to type 'dialogue', everything seems preety good, but if I keep the dialogue as a "palette" box, and then the 'Ok' button does not close the dialog and, of course, the onClose does not.

    PS: I need the onClose because event I want closing code executed even if the user press "ESC" rather than use the OK"" button.

    No idea how to handle or an alternative to make the button and onClose works?

    Thank you very much

    Best regards

    Gustavo.

    It does not work because the pallets and Illustrator don't communicate with each other, to call illustrator in a palette, you MUST use BridgeTalk, search on this forum, there are many examples.

  • DatePicker onClose event

    Does anyone know how to add the "onClose" event to a date on the page selector. It is a datepicker automatically created by APEX in 4.0.2. Ive tried the following, but it does not work
    apex.jQuery('#P5_END_SERVICE_DATE').bind('onClose', function(dateText, inst) { 
        alert('test'); this.focus(); 
        apex.jQuery(this).valid();
    });
    Any help would be greatly appreciated.

    See you soon
    Matt

    Hi Matt,

    Try

    apex.jQuery('#P5_END_SERVICE_DATE').datepicker("option", {
       onClose: function(pDateText, pInst) {
                  alert('onclose');
                }
    });
    

    Concerning
    Patrick
    -----------
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Why Firefox denies my request for websocket server upgrade? (It works using Chrome)

    I have a simple web page that I use to test my server websocket manipulation.

    < meta charset = "utf-8" / >
    < title > WebSocket Test < /title >
    < script language = "javascript" type = "text/javascript" >

     var wsUri = "ws://192.168.1.18/";
     var output;
    
     function init()
     {
       output = document.getElementById("output");
       testWebSocket();
     }
    
     function testWebSocket()
     {
       websocket = new WebSocket(wsUri);
       websocket.onopen = function(evt) { onOpen(evt) };
       websocket.onclose = function(evt) { onClose(evt) };
       websocket.onmessage = function(evt) { onMessage(evt) };
       websocket.onerror = function(evt) { onError(evt) };
     }
    
     function onOpen(evt)
     {
       writeToScreen("CONNECTED");
       doSend("WebSocket rocks");
     }
    
     function onClose(evt)
     {
       writeToScreen("DISCONNECTED");
     }
    
     function onMessage(evt)
     {
       writeToScreen('RESPONSE: ' + evt.data+'');
       websocket.close();
     }
    
     function onError(evt)
     {
       writeToScreen('ERROR: ' + evt.data);
     }
    
     function doSend(message)
     {
       writeToScreen("SENT: " + message);
       websocket.send(message);
     }
    
     function writeToScreen(message)
     {
       var pre = document.createElement("p");
       pre.style.wordWrap = "break-word";
       pre.innerHTML = message;
       output.appendChild(pre);
     }
     window.addEventListener("load", init, false);
    

    < /script >

    WebSocket test

    I use a TI CC3200 to run the Web server code.

    It turns out TI implementation expects to find the upgrade header followed by the key in the query. This is the reason why he was working for the chrome.

    FireFox has the key before the upgrade header. TI code was not the key and just using a string NULL for her. So the answer accept had something to reasonable search, but didn't.

    It would have been nice if firefox didn't would be out something on the data of accept being wrong.

    In any case, TI is aware of the issue.

  • The value for a key in a PopupScreen "Cancel"

    Hello:

    I have a small problem to define a 'close' by default in a PopupScreen key. My PopupScreen has some EditFields, LabelFields and other things and I need when a press the button 'back' on the keyboard the PopupScreen person has to close.

    It's the "structure" of my class:

    public class ConfigureScreen extends PopupScreen
    {
        protected ButtonField _close;
    
        public Configure()
        {
            // Create and display ObjectChoiceField, EditField
            // the "_close" ButtonField and other things...
        }
    
        public void onClose()
        {
            // this is invoked by the _close ButtonField
            // and the "back" key
        }
    }
    

    As you can see I have a ButtonField 'close' which has FieldChangeListener set and call the onClose function that listens, I need that when the person press 'Return' ky, he should perform the onClose function.

    Sorry for my English and thanks for any help or reference you can give me.

    Peace.

    It's the complete solution:

    /**
     * Override the keyChar() method from PopupScreen.
     */
    protected boolean keyChar(char c, int status, int time)
    {
        switch(c) {
            case Characters.ESCAPE:
                onClose();
                break;
            default:
                return super.keyChar(c, status, time);
        }
    
        return true;
    }
    

    Thanks to YamilBracho for his help.

  • Positioning Panel

    Hello

    I would like to put this on the top right

    but the group is always at the Center

    How can I do to fix this?

    var win = new window ("palette", "PANEL");

    Win.cancel2Ok = win.add ("panel", [10,495,300,540], "");

    win.closeButton = win.cancel2Ok.add ("button", [10,10,280,35], "FARM");

    win.onDeactivate = function() {}

    Win.Update ();

    };

    var closeWin = false;

    win.closeButton.onClick = function() {}

    closeWin = true;

    Win.Close ();

    };

    win.onClose = function() {}

    closeWin = true;

    };

    Win.Show ();

    while(closeWin == false) {}

    App.Refresh ();

    };

    You can reposition the window in the .onShow event:

    var win = new Window("palette", "PANEL");
    win.cancel2Ok = win.add('panel', [10,495,300,540], "");
    win.closeButton = win.cancel2Ok.add("button",  [10,10,280,35], "CLOSE");
    win.onDeactivate = function(){
       win.update();
       };
    
    var closeWin = false;
    
    win.closeButton.onClick = function(){
       closeWin = true;
       win.close();
        };
    
    win.onClose = function(){
       closeWin = true;
        };
    
    win.onShow = function(){
      var ww = win.bounds.width;
      var hh = win.bounds.height;
      win.bounds.x  = 10;
      win.bounds.y  = 495;
      win.bounds.width  = ww;
      win.bounds.height  = hh;
    } 
    
    win.show();
    
    while(closeWin == false){
       app.refresh();
        };
    
  • Close the second round table

    Thanks to this forum, I learned a lot lately

    Now, I have this little problem that I can not rosolvere:

    I created a panel that opens another Panel

    The problem is that if I want to close the second panel with the close button which does not close

    to close the second Panel, I have to click x at the top of the page sx mac

    How can I do to close the Panel by clicking directly on the end?

    round table 1

    var win = new window ("palette", "GROUP1");

    win.cancelOk = win.add ("panel", [10,495,300,540], "");

    win.cancelOk.buildBtn = win.cancelOk.add ('button', [10,10,180,35], ' OPEN the PANEL 2', {name: 'ok'} ");

    win.closeButton = win.cancelOk.add ("button", [190,10,280,35], "FARM");

    ////////////////////////////////////////////start panel 2//////////////////////////////////////////

    win.cancelOk.buildBtn.onClick = function () {}

    var win = new window ("palette", 'GROUP 2');

    Win.cancel2Ok = win.add ("panel", [10,495,300,540], "");

    win.cancelOk.buildBtn = win.cancelOk.add ('button', [10,10,180,35], ' OPEN the PANEL 2', {name: 'ok'} ");

    win.closeButton = win.cancel2Ok.add ("button", [10,10,280,35], "FARM");

    win.onDeactivate = function() {}

    Win.Update ();

    };

    var closeWin = false;

    win.closeButton.onClick = function() {}

    closeWin = true;

    w.Close ();

    };

    win.onClose = function() {}

    closeWin = true;

    };

    Win.Show ();

    while(closeWin == false) {}

    App.Refresh ();

    };

    }

    ////////////////////////////////////////////finish panel 2//////////////////////////////////////////

    finisch Panel 1

    win.onDeactivate = function() {}

    Win.Update ();

    };

    var closeWin = false;

    win.closeButton.onClick = function() {}

    closeWin = true;

    w.Close ();

    };

    win.onClose = function() {}

    closeWin = true;

    };

    Win.Show ();

    while(closeWin == false) {}

    App.Refresh ();

    };

    It works for me, except that you had an error in the script:

    win.closeButton.onClick = function() {}

    closeWin = true;

    w.Close ();

    };

    Should read:

    win.closeButton.onClick = function() {}

    closeWin = true;

    Win.Close (); fixed here

    };

  • Copy develop settings from one photo to another: problems! Photo: getDevelopSettings LrDevelopController.setValue

    I've also attached the full code at the bottom of this message in case this is useful, but the summary

    I have a plugin of lua (rsjaffe MIDI2LR) who receives an application via a LrSocket MIDI messages. Everything works, but I tried to add copy/paste develop settings without success.

    In the following code, copy settings is:

    function copySettings()

    local photo = LrApplication.activeCatalog (:getTargetPhoto())

    parameters = photo: getDevelopSettings()

    end

    and paste the settings:

    function pasteSettings()

    applySettings (settings)

    end


    function applySettings (set) - still experimental

    If LrApplicationView.getCurrentModuleName () ~ = 'develop' then

    LrApplicationView.switchToModule ('develop')

    end

    for x, v to peers (set)

    -SERVER: send (string.format ("%s % d\n", x, develop_lerp_to_midi (v) "))

    -PARAM_OBSERVER [x] = v

    LrDevelopController.setValue (x, v)

    end

    end


    Functions called, but nothing happens to the picture of the target. I was also unable to attach a debugger (tried ZeroBrane studio as described in debugging Adobe Lightroom plugins with ZeroBrane Studio - ZeroBrane , but can not get Lightroom to load mobdebug.lrmodule.)


    Can someone point out where I'm wrong?

    Thank you.


    require "strict.lua" - catch some incorrect variable names

    require "Develop_Params.lua" - global table to develop params, we must observe

    local LrApplication = import "LrApplication".

    local LrApplicationView = import "LrApplicationView".

    local LrDevelopController = import "LrDevelopController".

    local LrFunctionContext = import "LrFunctionContext".

    local LrSelection = import "LrSelection".

    local LrShell = import "LrShell".

    local LrSocket = import "LrSocket".

    local LrTasks = import "LrTasks".

    local LrUndo = import "LrUndo".

    -File-local Consts

    local RECEIVE_PORT = 58763

    local SEND_PORT = 58764

    local PICKUP_THRESHOLD = 4

    -File-local vars

    Local CopyUUID

    local settings

    local LAST_PARAM = "

    local PARAM_OBSERVER = {}

    local PICKUP_ENABLED = true

    Local SERVER = {}

    -File-local work statements, advance declared to allow him to be in the scope of all calls.

    -When you define previously stated function, DO NOT USE local KEYWORD once again, it will define another local function.

    -These statement are intended to overcome certain Lua gotcha.

    local applySettings

    local copySettings

    local develop_lerp_to_midi

    local midi_lerp_to_develop

    local pasteSettings

    local processMessage

    local sendChangedParams

    local startServer

    local updateParam

    LOCAL = {}

    ['DecrementLastDevelopParameter'] is function () LrDevelopController.decrement (LAST_PARAM) end.

    ["VirtualCopy"] = function () LrApplication.activeCatalog ():createVirtualCopies() end,

    ['ToggleScreenTwo'] = LrApplicationView.toggleSecondaryDisplay,

    ['CopySettings'] = copySettings,

    ['PasteSettings'] = pasteSettings,

    }

    local TOOL_ALIASES = {}

    ["Magnifying glass"] = "magnifying glass."

    ["CropOverlay"] = "crop."

    ["SpotRemoval"] = "dust."

    ["Red eye"] = "red eye."

    ["GraduatedFilter"] = "degraded."

    ["RadialFilter"] = "circularGradient."

    ["AdjustmentBrush"] = "localized,"

    }

    local SETTINGS = {}

    ["Pick-up"] = function (enabled) PICKUP_ENABLED = (activated == 1) end.

    }

    function copySettings()

    local photo = LrApplication.activeCatalog (:getTargetPhoto())

    parameters = photo: getDevelopSettings()

    end

    function pasteSettings()

    applySettings (settings)

    end

    function midi_lerp_to_develop (param, midi_value)

    -map range from midday to develop the range of parameter

    local min, max = LrDevelopController.getRange (param)

    -If (param == 'Température') then

    -min = 3000

    -max = 9000

    -end

    local result = midi_value/127 * (max - min) + min

    Returns the result

    end

    function develop_lerp_to_midi (param)

    -map develop parameter range range midi

    local min, max = LrDevelopController.getRange (param)

    -If (param == 'Température') then

    -min = 3000

    -max = 9000

    -end

    local result = (LrDevelopController.getValue (param) - min) /(max-min) * 127

    Returns the result

    end

    function updateParam (param, midi_value)

    -This function performs a "Pick-up" check type

    -in other words, it will ensure the setting is close to develop

    -in what order entered value is before updating

    If LrApplicationView.getCurrentModuleName () ~ = 'develop' then

    LrApplicationView.switchToModule ('develop')

    end

    If ((not PICKUP_ENABLED) or (math.abs (midi_value - develop_lerp_to_midi (param)) < = PICKUP_THRESHOLD)) then

    PARAM_OBSERVER [param] = midi_lerp_to_develop (param, midi_value)

    LrDevelopController.setValue (param, midi_lerp_to_develop (param, midi_value))

    LAST_PARAM = param

    end

    end

    function applySettings (set) - still experimental

    If LrApplicationView.getCurrentModuleName () ~ = 'develop' then

    LrApplicationView.switchToModule ('develop')

    end

    for x, v to peers (set)

    -SERVER: send (string.format ("%s % d\n", x, develop_lerp_to_midi (v) "))

    -PARAM_OBSERVER [x] = v

    LrDevelopController.setValue (x, v)

    end

    end

    -message processor

    function processMessage (message)

    If (message) type == 'string' then

    -messages are in the format 'param value '.

    local _ param, value = string.find (message, '(%S+) %s(%d+)')

    If (ACTIONS [param] ~ = nil)-perform an action time

    If (ToNumber (value) == 127) then ACTIONS [param] (end)

    Else if (param:Find('Reset') == 1) then - reset other than those explicitly encoded in the ACTION items table

    If (ToNumber (value) == 127) then LrDevelopController.resetToDefault (param end:sub(6))

    Else if (param:Find('SwToM') == 1) then - perform a switch to the module

    If (ToNumber (value) == 127) then LrApplicationView.switchToModule (param end:sub(6))

    Else if (param:Find('ShoVw') == 1) then - change the display mode of the application

    If (ToNumber (value) == 127) then LrApplicationView.showView (param end:sub(6))

    Else if (param:Find('ShoScndVw') == 1) then - change the display mode of the application

    If (ToNumber (value) == 127) then LrApplicationView.showSecondaryView (param end:sub(10))

    ElseIf (TOOL_ALIASES [param] ~ = nil) then - switch to the desired tool

    If (ToNumber (value) == 127) then

    If (LrDevelopController.getSelectedTool () == TOOL_ALIASES [param]) then - switch between the tool/Magnifier

    LrDevelopController.selectTool ('magnifying glass')

    on the other

    LrDevelopController.selectTool (TOOL_ALIASES [param])

    end

    end

    ElseIf (PARAMETERS [param] ~ = nil) then

    Settings [param] (ToNumber (value))

    else - otherwise update a development parameter

    updateParam (param, tonumber (value))

    end

    end

    end

    -Send settings changed to MIDI2LR

    function sendChangedParams (Observer)

    for param in ipairs (DEVELOP_PARAMS), __________

    If (Observer [param] ~ = LrDevelopController.getValue (param)) then

    SERVER: send (string.format ("%s % d\n", param, develop_lerp_to_midi (param) "))

    Observer [param] = LrDevelopController.getValue (param)

    LAST_PARAM = param

    end

    end

    end

    function startServer (context)

    SERVER = {LrSocket.bind}

    functionContext = context,

    plugin = _PLUGIN,

    port = SEND_PORT,

    mode = "send."

    onClosed = function (socket) - this callback seems never called...

    -MIDI2LR closed the connection, allow reconnection

    -socket: reconnect()

    end,

    onError = function (socket, err)

    Socket: reconnect()

    end,

    }

    end

    -Main task

    LrTasks.startAsyncTask (function()

    LrFunctionContext.callWithContext ("socket_remote", function (context)

    LrDevelopController.revealAdjustedControls (true) - parameter reveal touched in the process of Panel

    -Add an observer to develop changes to the param

    LrDevelopController.addAdjustmentChangeObserver (context, PARAM_OBSERVER, sendChangedParams)

    local client = {LrSocket.bind}

    functionContext = context,

    plugin = _PLUGIN,

    port = RECEIVE_PORT,

    mode = "receive."

    onMessage = function (socket, message)

    processMessage (message)

    end,

    onClosed = function (socket)

    -MIDI2LR closed the connection, allow reconnection

    Socket: reconnect()

    -call SERVER: reconnect causes LR to hang for some reason any...

    SERVER: close()

    startServer (context)

    end,

    onError = function (socket, err)

    If err is 'timeout' then - reconnect if expired

    Socket: reconnect()

    end

    end

    }

    startServer (context)

    While true

    LrTasks.sleep (1/2)

    end

    client: close()

    SERVER: close()

    end)

    end)

    LrTasks.startAsyncTask (function()

    If (WIN_ENV) then

    LrShell.openFilesInApp ({_PLUGIN.path..' / Info.lua'},.. _PLUGIN.path' / MIDI2LR.exe')

    on the other

    LrShell.openFilesInApp ({_PLUGIN.path..' / Info.lua'},.. _PLUGIN.path' / MIDI2LR.app')-on Mac, it seems that the argument of files must include an existing file

    end

    end)

    This may be a correct way, it seems to work

    local settings

    function copySettings()

    LrTasks.startAsyncTask (function)

    local photo = LrApplication.activeCatalog (:getTargetPhoto())

    parameters = photo: getDevelopSettings()

    end)

    end

    function pasteSettings()

    If the parameters ~ = nil then

    LrTasks.startAsyncTask (function)

    Catalog = LrApplication.activeCatalog)

    Catalog: withWriteAccessDo ('pasteSettings', function()

    local photo = catalogue: getTargetPhoto()

    Photo: applyDevelopSettings (Settings)

    end)

    end)

    end

    end

  • How can I add arrows back / ahead of jQuery carousel?

    Hope someone here can help me. I just added a jQuery carousel called carouFredSel ( circular, Responsive Carousel - CarouFredSel jQuery ) to a project, I am working on. What I'm trying to do is to add and arrows forward so it will click to move forward or backward, rather than moving constantly. I'm still very very new to jQuery, so please forgive me. Anyone here able to help me change that jQuery to stop the automatic stuff and replace it with arrows at each end of the carousel?

    This is the code I have in my head that is relevant to the carousel:

    < script type = "text/javascript" src = "javaScript/jQuery.js" > < / script >

    "< script type =" text/javascript"src="javaScript/jquery.carouFredSel-6.2.1-packed.js "> < / script >

    < script >

    {$(document) .ready (function ()}

    $("#foo1").carouFredSel ();

    $("#foo1_a").fancybox ({}

    cyclic: true,

    onStart: function() {}

    $("#foo1").trigger ("pause");

    },

    onClosed: function() {}

    $("#foo1").trigger ("play");

    }

    });

    });

    < /script >

    NOTE: I (a jQuery) Fancybox put in place with her, which works very well. I don't understand this Script.

    Here is a link to my page: watercolors more | Galleries | Floral watercolors

    Here is a link to a page that shows an example of what I want: mean Bean games | 2D developers IOS

    Thank you very much!

    Dave

    Looks like the CSS has complicated things a bit, so we'll leave it for now.

    Make sure that the HTML code looks like. Notice that I left the paging out of the markup, this can be added later.

    
    

    Make sure that the builders alike

    
    

    Now when you view it in the browser, you should see Prev and Next to bottom. Clicking on these links will give you the result you are looking for. Use CSS to style buttons.

  • [JS] [CS5.5] interrupt a script via ScriptUI

    I have a script that automates the placement of PDF files in pages based on an input XML file. It works fine, but I want users to be able to interrupt the establishment, especially if they have accidentally passed the bad XML file to the script!

    The total time required for the investments of PDF may take a while, I put a window simple palette containing a progress bar to give an idea of the progress. I also added a Cancel button, but although the window seems to have developed at least from time to time during the internship, it is never possible to press the Cancel button, or close the window. The mouse pointer is an hourglass all the time.

    This is a test script simplified illustrating the problem. I have only run on CS5.5 on Windows XP, but I think it should work at least as far as CS4 on Mac and Windows. He asked a PDF file and then placed in a new document 16 times. My PC is slow enough so that it takes enough time together to give me enough time to hit the Cancel button, if it was possible to do. If your machine is really fast, you might want to increase gridSize so that the script has more to do.

    Is that what I do as my Undo button can be pressed? I need to import PDF window, so if this can and should be turned off, that's fine. I've tinkered with IdleTasks strings and was able to push my button to cancel, but the chain is not always end, and I ended up locking things badly. I probably need to read more about IdleTasks. There may be potential here, but I want to support prior to version CS5 if possible, and IdleTasks were introduced in CS5.

    #target indesign
    
    (function() {
        var gridSize = 4;
    
        // Ask user for a PDF
        var pdfFilter =($.os.toLowerCase().indexOf("macintosh") != -1) ?
            (function(file) { return file.name.match(/\.pdf$/); }) : '*.pdf';
        var pdfFile = File.openDialog("Choose a small PDF to place...", pdfFilter);
        if (!pdfFile) { return; }
    
        // Show a simple progress bar
        var active = true;
        var win = new Window('palette', 'Placing ' + pdfFile.name);
        var label = win.add('statictext', undefined, '');
        label.preferredSize.width = 300;
        label.justify = 'left';
        var progressBar = win.add('progressbar', undefined, 0, gridSize * gridSize);
        progressBar.preferredSize = [ 300, 12 ];
        var cancelButton = win.add('button', undefined, 'Cancel');
        cancelButton.onClick = function() { win.close(); };
        win.onClose = function() { active = false; };
        win.show();
    
        // Make a grid of rectangles and place the PDF in each rectangle,
        // advancing the progress bar as we go
        var doc = app.documents.add();
        var page = doc.pages[0];
        var mp = page.marginPreferences;
        var originX = page.bounds[1] + mp.left;
        var originY = page.bounds[0] + mp.top;
        var rectWidth = (page.bounds[3] - mp.right - originX) / gridSize;
        var rectDepth = (page.bounds[2] - mp.bottom - originY) / gridSize;
        var placePDF = function(n) {
            var y = Math.floor(n / gridSize);
            var x = n % gridSize;
            label.text = 'Placing PDF in [ ' + x + ', ' + y + ' ]';
            var rect = page.rectangles.add();
            rect.geometricBounds = [
                originY + y * rectDepth,
                originX + x * rectWidth,
                originY + (y + 1) * rectDepth,
                originX + (x + 1) * rectWidth
            ];
            rect.strokeWeight = 0;
            var pdfList = rect.place(pdfFile);
            pdfList[0].fit(FitOptions.PROPORTIONALLY);
            (progressBar.value)++;
            // Even this sleep doesn't let me press the cancel button!
            //$.sleep(1000);
        }
        for (var i = 0; active && i < gridSize*gridSize; i++) {
            placePDF(i);
        }
        win.close();
    })();
    

    Hi all

    To my knowledge ScriptUI can only process "update" events during execution of your heavy routine. As a solution Roey horns of Adobe suggested in the past that we "rely on the support of InDesign to cancel scripts using the Cmd-period or ESC key".

    In any case, IdleTasks is definitely the way to go in CS5 and later.

    @+

    Marc

  • Braces without a "declaration" of departure?

    Hi all

    This may be a simple/stupid question, but I couldn't find any information about this after googling for an hour...

    I was trying to figure out how I could get my XMLSocket in my program to try to reconnect if it fails, when I came across this page here:

    http://www.as3codes.com/wiki/index.php?title=Socket_%26_PHP_Data_Tutorial

    There is a section in this code, in the link above, that has a pair of curly braces wrapped around an if statement, followed by a seimcolon. I could not

    guess what was the purpose of doing and he will... ??

    Here's this code snippet, I mentioned, the part I'm talking about is the part in BOLD:

    * I have included the code snippets that are directly in front and directly after the section, I'm talking to you, this way you can kind of see it in context...

    IF TAKING FARM...

    chatSocket.onClose = function()

    {

    gotoAndStop ("retry");

    MSG = "< br >" + discoMsg;

    backupMsg = msg;

    retryConnection(); / / WAIT 10 seconds before calling it to reconnect...

    };

    This script prevents close running on retry.

    {

    If (connectedSocket == 2) {}

    chatConnect();

    }

    START SLIDE SHOW

    };

    /*====================================================================================             */

    /*                                                 Socket Connection Timer                                 */

    /*------------------------------------------------------------------------------------             */

    this.onEnterFrame = function() {}

    If (connectedSocket == retry) {}

    connecttimer += 1;

    If (connecttimer == 30) {}

    connectsec = "retry in: 9 seconds. ';

    }

    If (connecttimer == 60) {}

    connectsec = "retry in: seconds 8. ';

    }

    If (connecttimer == 90) {}

    connectsec = "retry in: 7 seconds.";

    }

    If (connecttimer == 120) {}

    connectsec = "retry in: 6 seconds."

    }

    If (connecttimer == 150) {}

    connectsec = "retry in: 5 seconds."

    }

    If (connecttimer == 180) {}

    connectsec = "retry in: 4 seconds."

    }

    If (connecttimer == 210) {}

    connectsec = "retry in: 3 seconds. ';

    }

    If (connecttimer == 240) {}

    connectsec = "retry in: 2 seconds."

    }

    If (connecttimer == 270) {}

    connectsec = "retry in: seconds 1. ';

    }

    If (connecttimer > = 300) {}

    MSG = backupMsg;

    chatConnect(); / / re - run the Socket connection code...

    connectsec = 'Retry NOW ';

    connecttimer = 1;

    }

    }

    };

    It seems that the person who wrote it actually uses the "{...};" quite often in his code (* i.e. curl braces followed by a semicolon). I think in

    some of the places where they use only (* that is like this-> '' ... = function() {...}; ") " ( ), but also include '= function()'. Is this just another way to you

    may write/declare a function in those cases where they use the code "... = function() {...}; ' ?

    I also thought it was maybe just another way to create EventListeners without explicitly defining before hand...? A little confused...

    I know that it is written in Actionscript 2, so maybe the question is moot given that the style could be gone along with AS2?

    Any thoughts would be greatly appreciated.

    Thanks in advance,

    Matt

    These media do nothing.  the code is the same, as if they were absent.

    However, if there is a constant pre-recorded config supports, the supports would lock up the code is conditionally compiled.  That is to say, updated according to the config constant conditions (true or false).

    more specifically,.

    {CONFIG::WEB}

    If (connectedSocket == 2) {}

    chatConnect();

    }

    }

    compile if CONFIG::WEB is set to true (in the constants Panel, file > publishing settings > advance actionscript 3 parameters - wrench > config constants).

  • catch the event when you click on the cross of closing

    Hello

    How you catch the event when you click on the cross of closing?

    Thanks in advance,

    Fred

    Discover the reminders of events management of window on page 122 of the Guide to Javascript Adobe pdf tools.

    You want something like:

    myWindow.onClose = function() {}

    your code goes here

    };

    or

    myWindow.onClose = myCloseFunction;

    function myCloseFunction() {}

    your code goes here

    }

  • [JS] Avoid multiple instantiation of pallets

    Hi all

    I feel so dumb asking such a stupid question, but I really can't get it to work. I have a simple dialog (a pallet). Thing that is user clicks several times, exits windows script much. I want to check for a former launched palette.

    I tried everything such a global variable to change onShow and onClose (isRunning = false), private variables.

    Any clue?

    #targetengine 'demo'
    
    var myDialog = (function(){
        var w = new Window('palette');
        return{
            show:function(){
                w.show();
            }
        }
    })();
    
    myDialog.show();
    

    Option 1: Global Variable

    #targetengine 'demo'
    
    var isRunning = false;
    
    var myDialog = (function(){
        var w = new Window('palette');
    
         w.onShow = function(){ isRunning = true; }
    
         w.onClose = function(){ isRunning = false; }
    
        return{
            show:function(){
                if(!isRunning) { w.show(); }
            }
        }
    })();
    
    myDialog.show();
    

    Option 2: private variable:

    #targetengine 'demo'
    
    
    
    var myDialog = (function(){
         var isRunning = false;
        var w = new Window('palette');
    
         w.onShow = function(){ isRunning = true; }
    
         w.onClose = function(){ isRunning = false; }
    
        return{
            show:function(){
                if(!isRunning) { w.show(); }
            }
        }
    })();
    
    myDialog.show();
    
    

    I can't operate if the palette is not executed if already done. I tried to check for existence of point of dialogue as in this page too, but it's not helping: http://kelsocartography.com/scripts/scripts/nvkelso/registrationButtons.jsx

    DRM for information. I am sure that it is so obvious.

    Loïc

    Actually, I guess that's not so strange. You redo your variable to each invocation, so isRunning myDialog is wrong every time. Simply adding a check to see if there is already some myDialog prevents it to run two at once:

    #targetengine 'demo'
    
    var myDialog = myDialog || (function(){
         var isRunning = false;
        var w = new Window('palette');
    
         w.onShow = function(){ isRunning = true; }
    
         w.onClose = function(){ isRunning = false; }
    
        return{
            show:function(){
                if(!isRunning) { w.show(); }
            }
        }
    })();
    
    myDialog.show();
    

    But, I think that you will have the same problems that I showed in my first post with things does not when you run later in the same session.

  • JavaScript works well with the date picker

    I tried onchange and onblur javascript events in the field of the HTML Form element...
    they work great with text fields... but not with the date picker...
    It seems after that date is selected, javascript is triggered, but set to get pulls the value of the field before the date chosen in the selector is placed here...

    is it possible to get the event fires with the value of dates...

    Hello

    Check your sample now.
    I have put your function setStatus page JavaScript and Execute when the Page loads

     $('#P1_DATE_FINISH').datepicker("option",{
      onClose:function(t,i){setStatus()}
     });
    
     $('#P1_DATE_START').datepicker("option",{
      onClose:function(t,i){setStatus()}
     });
    

    You can also replace this with

    $.datepicker.setDefaults({onClose:function(t,i){setStatus()}})
    

    Kind regards
    Jari

    Published by: jarola December 14, 2010 16:28

    You probably like to have event onchange in the text field, so I change to

    $('#P1_DATE_START,#P1_DATE_FINISH').datepicker("option",{
     onClose:function(t,i){setStatus()}
    }).change(function(){setStatus()});
    

Maybe you are looking for