Object is undefined : why?

Hi all.
I'm working on a script to facilitate the creation and editing of books in InDesign. I'm not a programmer, and besides a few lines of code written by me, the script consists of code found and adapted to the purpose.
I have a problem related to two objects (left_box and right_box) : they appear to be undefined, therefore I can not operate on the elements that populate the listboxes that are contained in the objects themselves.
I have reviewed the code many times but I do not understand where I'm wrong.
Thanks in advance for any help.
This is the complete code :
#target indesign
#targetengine Main
// ============================== V A R I A B L E S =================================//
var theName, theFolder;
var right_arr = [];
var left_arr = [];
main_win();
// ============================== M A I N ===========================================//
// -------------------- Creation of main window -------------------------------------//
function main_win() {
var dialog_win = new Window ("palette", "Book creator / Book modificator");
    dialog_win.alignChildren = ["fill", "fill"];
    var group_width =  450;
    var group_length = 100;
    var char_length = 45;
    var pm_width = 200; // placemark
    var pm_length = 300 // placemark
    var group_group_1 = dialog_win.add("group");
        group_group_1.alignChildren = ["fill", "fill"];
        var step_group_1 = group_group_1.add("panel");
            step_group_1.preferredSize = [Math.round(group_width / 2), group_length];
            step_group_1.alignChildren = "fill";
            var info_text_1 = step_group_1.add("statictext", undefined, "STEP 1\rSelect the option you are interested in, in order to activate its controls.\rWith no choice, only QUIT button is working.\r\r", {multiline: true});
                info_text_1.alignment = "fill";
                info_text_1.characters = Math.round(group_width / 20);
            var radio_group = step_group_1.add("group");
                radio_group.orientation = "column";
                radio_group.alignChildren = "fill";
                var radio1 = radio_group.add("radiobutton", undefined, " Create a new book");
                var radio2 = radio_group.add("radiobutton", undefined, " Open a book to edit");
        var step_group_2 = group_group_1.add("panel");
            step_group_2.alignChildren = "left";
            var info_text_2 = step_group_2.add("statictext", undefined, "STEP 2\r• Create a new book : first of all choose the destination folder, then type the desired name (max " + (char_length - 10) + " characters) without extension.\r• Open a book to edit : I think you don't need special instructions, right?.\r\r", {multiline: true});
                info_text_2.alignment = "fill";
                info_text_2.characters = Math.round(group_width / 8);
            var button_group = step_group_2.add("group");
                button_group.alignment = "center";
                button_group.alignChildren = "fill";
                var new_button = button_group.add("button", undefined, "Destination folder...");
                var old_button = button_group.add("button", undefined, "Open a book...");
                    new_button.enabled = false;
                    old_button.enabled = false;
            var dir_group = step_group_2.add("group");
                dir_group.add('statictext {text: "Book folder :", justify: "right"}');
                dir_group.alignChildren = "right";
                var book_dir = dir_group.add("statictext", undefined, theFolder);
                    book_dir.characters = char_length;
            var name_group = step_group_2.add("group");
                name_group.add('statictext {text: "Book name :", justify: "right"}');
                dir_group.alignChildren = "right";
                var book_name = name_group.add("edittext", undefined, theName);
                    book_name.characters = char_length - 10;
                    book_name.enabled = false;
    var group_group_2 = dialog_win.add("group");
        group_group_2.alignChildren = ["fill", "fill"];
        var step_group_3 = group_group_2.add("panel");
            step_group_3.preferredSize = [group_width, group_length * 4];
            var group_a = step_group_3.add("group");
                group_a.orientation = "row";
                var info_text_3 = group_a.add("statictext", undefined, "STEP 3\r• The left side shows the contents of the book to which you can add or remove documents, and / or order them as you like.\r• The right side shows the documents that are available in the selected folder (if checkbox is selected, the search is also done in the subfolders). Any documents already in the book are not listed. This list is sorted alphabetically by default.\r\r", {multiline: true});
                    info_text_3.alignment = ["left", "top"];
                    info_text_3.characters = Math.round(group_width / 7);
                var sub_group_a = group_a.add("group");
                    sub_group_a.orientation = "column";
                    sub_group_a.alignChildren = ["fill", "fill"];
                    var list_button = sub_group_a.add("button", undefined, "Files to add...");
                        list_button.enabled = false;
                    var check_sub = sub_group_a.add("checkbox", undefined, "Search in sub-folders");
                        check_sub.enabled = false;
                        check_sub.value = false;
            var group_b = step_group_3.add("group");
                var button_group_LS = group_b.add("group");
                    var move_group_LS = button_group_LS.add("group");
                        move_group_LS.orientation = "column";
                        move_group_LS.alignChildren = ["fill", "fill"];
                        var move_up = move_group_LS.add("button", undefined, "Move up");
                        var move_down = move_group_LS.add("button", undefined, "Move down");
                        button_group_LS.children[0].enabled = false;
                var list_group_LS = group_b.add("group");
                    var left_box = add_left (list_group_LS, left_arr);
                        left_box.preferredSize = [pm_width, pm_length];
                        function add_left (left_case, left_arr) {
                            var left_data = left_case.add("listbox", undefined, left_arr, {multiselect: true, showHeaders: true, columnTitles: [" > BOOK CONTENTS"]});
                            return left_data;
                        list_group_LS.children[0].enabled = false;
                var list_group_RS = group_b.add("group");
                    var right_box = add_right (list_group_RS, right_arr);
                        right_box.preferredSize = [pm_width, pm_length]
                        function add_right (right_case, right_arr) {
                            var right_data = right_case.add("listbox", undefined, right_arr, {multiselect: true, showHeaders: true, columnTitles: [" > AVAILABLE DOCUMENTS "]});
                            return right_data;
                        list_group_RS.children[0].enabled = false;
                var button_group_RS = group_b.add("group");
                    var move_group_RS = button_group_RS.add("group");
                        move_group_RS.orientation = "column";
                        move_group_RS.alignChildren = ["fill", "fill"];
                        var add_doc = move_group_RS.add("button", undefined, "Add to book");
                        var remove_doc = move_group_RS.add("button", undefined, "Remove from book");
                        button_group_RS.children[0].enabled = false;
    var button_dialog = dialog_win.add("group");
        button_dialog.alignment = "right";
        var quit_button = button_dialog.add("button", undefined, "QUIT");
        var doit_button = button_dialog.add("button", undefined, "DO IT");
            doit_button.enabled = false;
// -------------------- Evaluate choices --------------------------------------------//
    // --- STEP 1 ---//
    radio1.onClick = function() {
        check_open();
        new_button.enabled = true;
        old_button.enabled = false;
        new_button.active = true;
    radio2.onClick = function() {
        check_open();
        new_button.enabled = false;
        old_button.enabled = true;
        old_button.active = true;
    // --- STEP 2 ---//
    new_button.onClick = function() {
        book_name.text = "";
        new_book = Folder.selectDialog ("Choose the destination folder for the new book...");
        if (left_box.items.length > 0) {
            left_arr = [];
            upd_left(left_box);
        if (new_book != null) {
            book_dir.text = path_trim(new_book.fsName);
        book_name.enabled = true;
        book_name.active = true;
        list_button.enabled = true;
        check_sub.enabled = true;
    book_name.onChanging = function() {
        max_char = book_name.text;
        if (max_char.length > book_name.characters) {
            book_name.text = "";
            book_name.textselection = max_char.slice(0, book_name.characters);
    old_button.onClick = function() {
        old_book = File.openDialog ("Select the book file to open...", let_me_see, true);
        if (left_box.items.length > 0) {
            left_arr = [];
            upd_left(left_box);
        if (old_book != null) {
            book_dir.text = path_trim(old_book);
            book_split(book_dir.text);
            book_dir.text = the_folder;
            book_name.text = the_name;
        get_Docs(old_book);
        clean(left_arr);
        list_group_LS.remove(list_group_LS.children[0]);
        left_box = add_left (list_group_LS, left_arr);
        left_box.preferredSize = [pm_width, pm_length];
        book_name.enabled = false;
        list_button.enabled = true;
        list_button.active = true;
        check_sub.enabled = true;
        dialog_win.layout.layout(true);
    // --- STEP 3 ---//
    list_button.onClick = function() {
        var myFolder = Folder.selectDialog("Select a folder in which to search for documents...");
        if (right_box.items.length > 0) {
            right_arr = [];
            upd_right(right_box);
        check_folder(myFolder, check_sub.value);
        right_arr.sort();                   // sorting the values of the array
        right_arr = decodeURI(right_arr);   // replacing %20 with space
        right_arr = right_arr.split(',');   // converting into array
        var the_right_arr = right_arr.slice();
            right_arr = [];
            getFileName(the_right_arr);
        list_group_RS.remove(list_group_RS.children[0]);
        right_box = add_right (list_group_RS, right_arr);
        right_box.preferredSize = [pm_width, pm_length];
        list_group_LS.children[0].enabled = true;
        list_group_RS.children[0].enabled = true;
        button_group_LS.children[0].enabled = true;
        button_group_RS.children[0].enabled = true;
        doit_button.enabled = true;
        dialog_win.layout.layout(true);
    move_up.onClick = function () {
        var n = left_box.selection.index;
        if(n > 0) {
            swap (left_box.items[n - 1], left_box.items[n]);
            left_box.selection = n - 1;
    move_down.onClick = function () {
        var n = left_box.selection.index;
        if (n < left_box.items.length - 1) {
            swap (left_box.items[n], left_box.items[n + 1]);
            left_box.selection = n + 1;
    add_doc.onClick = function() {
        // something ...
    remove_doc.onClick = function() {
        left_arr.splice(left_box.selection.index, 1);
        upd_left(left_box);
    // --- LAST STEP ---//
    quit_button.onClick = function() {
        dialog_win.close();
    doit_button.onClick = function() {
        if (book_name.text != "") {
            check_book(new_book, book_name);
        else {
            alert("The book name is missing.");
    check_open();
    dialog_win.show ();
// ============================== F U N C T I O N S =================================//
// --- BEGINNIG ---//
    // -------------------- Check for open book files -----------------------------------//
    function check_open() {
        if (app.books.length != 0) {
            var q = confirm("All book files must be closed before proceeding. If you press YES I will close them for you, otherwise press NO and close them manually.");
            if (q == true) {
                for (var x1 = 0; x1 < app.books.length; x1++) {
                    var open = app.books[x1];
                    open.close();
                    radio1.checked = false;
                    radio2.checked = false;
            } else {
                exit(0);
// --- STEP 2 NEW BOOK / OLD BOOK ---//
    // -------------------- Adapt directory text to max length of the static text ---//
    function path_trim(path) {
        var theFile = new File(path);
        var pathTrim = ".../" + theFile.fsName.split("/").splice(0).join("/");
        if ((pathTrim.length - 50) < 50) {
            pathTrim = ".../" + theFile.fsName.split("/").splice(-3).join("/");
        else if ((pathTrim.length - 50) > 50) {
            pathTrim = ".../" + theFile.fsName.split("/").splice(-2).join("/");
        return pathTrim;
// --- STEP 2 OLD - LEFT SIDE ---//
    // -------------------- Selection of what can be shown in dialog window ---------//
    function let_me_see(bookPath){
        if (bookPath.constructor.name == "Folder") {return true}
        if (bookPath.name.slice(-5) == ".indb") {return true}
            return false;
    // -------------------- Extraction of the book name and its path ----------------//
    function book_split(split_it) {
        var the_path = new File(split_it);
        var book_path = decodeURI(String(the_path));
        //  the_name.text = book_path.pop(); // file name with extension
            the_name = (book_path.split('/').pop().split('.'))[0];
            the_folder = book_path.split("/").slice(0, -1).join("/");
            while (the_folder.charAt(0)=='/') the_folder = the_folder.substring(1,the_folder.length);
            return [the_name, the_folder];
    // -------------------- Left list update ----------------------------------------//
    function upd_left(left_data) {
        left_data.removeAll();
        var x2 = 0;
        while (left_data.items.length < left_arr.length) {
            left_data.add(left_arr[x2]);
            x2++;
    // -------------------- Extract document name from book -------------------------//
    function get_Docs(doc) {
        app.open(doc);
        var book_ref = app.activeBook;
        for (var x3 = 0; x3 < book_ref.bookContents.length; x3++){
            left_arr += book_ref.bookContents[x3].name;
        book_ref.close();
        left_arr = left_arr.split('.indd'); // converting into array
        return doc;
// --- STEP 3 RIGHT SIDE ---//
    // -------------------- Right list update ---------------------------------------//
    function upd_right(right_data) {
        right_data.removeAll();
        var x5 = 0;
        while (right_data.items.length < right_arr.length) {
            right_data.add(right_arr[x5]);
            x5++;
    // -------------------- Files search through folders ----------------------------//
    function check_folder(folder, sub_dir) {
        var myFilesList = folder.getFiles();
        for (var x6 = 0; x6 < myFilesList.length; x6++) {
            var myList = myFilesList[x6];
            if (myList instanceof File && myList.name.match(/\.indd$/i)) {
                right_arr.push(myList);
            else if (myList instanceof Folder) {
                if (sub_dir == true) {
                    check_folder(myList);
        return folder;
    // -------------------- Extract document name from folders list -----------------//
    function getFileName(value) {
        for (var x7 = 0; x7 < value.length; x7++){
            var theFile = (value[x7].split('/').pop().split('.indd'))[0];
                right_arr.push(theFile);
        right_arr.sort();
        return value;
    // -------------------- Swap for move up and move down --------------------------//
    function swap (x, y) {
        var temp = x.text; x.text = y.text; y.text = temp;
// --- LAST STEP ---//
    // -------------------- Check existance -----------------------------------------//
    function check_book(check_dir, check_name) {
        var check_path = check_dir + "/" + check_name.text + ".indb";
        if (File(check_path).exists == true) {
            alert("A book with the same name already exists, please change the name.");
        } else {
        // something
            alert("ALL DONE");
// ========== UTILIY ==========//
    // -------------------- Remove empty records ------------------------------------//
    function clean(what) {
        for(var i = what.length - 1; i >= 0; i--) {
            if(what[i] == "") {
               what.splice(i, 1);
// ========== THE END =========//

You can't really expect anyone to read that much code, without a sample to run the script against and see what happens. But by chance I noticed these lines:
right_arr.sort();                  // sorting the values of the array 
right_arr = decodeURI(right_arr);  // replacing %20 with space 
right_arr = right_arr.split(',');
which are probably the source of the problem. decodeURI() is a string function, not an array function. Unfortunately, instead of throwing an error, it converts an array to a string:
a = ['a%20b'];
$.writeln (a.constructor.name);  // Array
s = decodeURI(a);
$.writeln (s.constructor.name);  // String
You need to change %20 to a space in each individual array element. If this doesn't solve the problem you'll have to find the person who wrote the code and ask them to fix it.
Peter

Similar Messages

  • CompareTo(Object) is undefined for Object

    I'm getting an error -The method compareTo(Object) is undefined for the type Object- with this code:
    public static Object getMinimum (Object[] array)
       Object min = array[0];
       for (int i = 1; i < array.length; i++) {
          if (min.compareTo(array) > 0) {
    min = array[i];
    return min;
    The objects in the array will always implement the Cloneable interface, but they can't use it, as they are treated as Object instances, not as instances of their own class. How can I fix this without using a Comparator?
    Thanks in advance

    Or to be most generic
        public static <T extends Comparable<T>> T getMinimum(T[] array) {
            T min = array[0];
            for (int i = 1; i < array.length; i++) {
                if (min.compareTo(array) > 0) {
    min = array[i];
    return min;
    Of course, the forum software mucks that up,
    it should be
    <T extends Comparable<T>>
    Message was edited by:
    IanSchneider

  • Is there any log of object-generating ? - why is an object generated?

    is there any log of object-generating ? -
    why is an object generated?
    in Table REPOLOAD, i can see that an object / program is generated  (SDAT, STIME)
    is there any log-file, where i can see, why this object is forced to be generated ?

    it is a JavaBean class that implements Serializeable. suppose i have a method called copyObject(Object o) that returns a copy of o
    public Object copyObject(Object o)
    Object newObject = null;
    Class c = o.getClass();
    newObject = c.newInstance(c.getName());
    PropertyDescriptor p[] = Introspector.getBeanInfo(o.getClass()).getPropertyDescriptors();
    for (int i = 0; i < p.length; i++) {
    //this is the part i am not really certain, how do i read value from o, so i can set it to newObject for each element
    //String name = p.getName();
    //String value = p[i].getReadMethod() .;
    p[i].getWriteMethod().invoke(newObject, value);
    //how do i use the introspector to invoke method to copy from o to newObject?
    return newObject;

  • Design patterns,about value object ,how?why?could you give me a soluttion

    design patterns,about value object ,how?why?could you give me a soluttion
    use value object in ejb,thanks
    i want not set/get the value in ejb,find the method to solve it ,use value
    object ?
    how? thanks.

    Hai
    Enter your telephone number here, at the top it will say your Exchange, Phone and cabient number. If it doesn't mention cabinet that means you are directly connected to the exchange and not via PCP.
    If you are connected to a cabinet and it doesn't say FTTC is available, ask your neighbor to-do the same test (they have 2 be infinity connected). If they are, then proceed to contact the moderators here. Though it could not be showing because all the ports have been used up in the FTTC Cabinet.
    If this helped you please click the Star beside my name.
    If this answered your question please click "Mark as Accepted Solution" below.

  • Null object not centred, why?

    Create a null object and it's not centred to its location. Why?
    Seems like that would be the most obvious position to put the visual representation of a null object. So the least likely place for Adobe to put it?
    Or is there some logical reason?

    dissidently wrote:
    Rick, all other apps that have Null objects use them far more wisely than Adobe does. Mylenium has confirmed my suspicion, that these things weren't thought through, simply created (probably in a panic or out of laziness) as a half way house to what Null objects actually can be.
    I get your point about the anchor point, but that's not what I'm talking about. In ALL other apps with a Null object, the visual representation of that Null object is centred. There's a tonne of reasons to do that, and I'm not contending the placement of the Null objects "anchor", it's in the right spot. It's the visual representation of the Null object that's utterly wrong.
    That it's a deformable visual representation only compounds this problem.
    Your usual presumptuous assumptions.
    The null object was a remarkable improvement over how, in the olden days, we created invisibly small or transparent objects to do roughly the same thing.AE's were the first nulls I ever encountered. I learned how to use them when introduced and never really thought about how they might have been better. AE's nulls made perfectly good sense to me. And I don't use the other applications you are alluding to so I don't really need AE's null to be any different. I have, more than once, moved the null's anchor to its geometric center to help my project contributors grasp the concept. But they had no prior experience with nulls, either, so once they got it, I moved things back to their default because that works for me. Why are you still using After Effects?

  • Passing Objects to methods, why aren't they changed permanently?

    If an object is passed by reference, and primitive types are passed by value; then why does the following programme not alter the original values of A and B?
    I m trying to pass parameters into a method so that they can be altered and returned, can any one suggest a way to do this.
    Thanks,
    Ben.
    public class Application2 {
    Application2(){ }
         void goProc(){
              Integer A=new Integer(4);
              Integer B=new Integer(6);
              add(A,B);
              System.out.println("A2 " + A);
              System.out.println("B2 " + B);
         void add(Integer A,Integer B){
              System.out.println("A " + A);
              System.out.println("B " + B);
              A=A.valueOf(String.valueOf((A.intValue()+B.intValue())));
              System.out.println("added " + A);
    //Main method
         public static void main(String[] args) {
              Application2 App = new Application2();
              Integer A=new Integer(4);
              Integer B=new Integer(1);
              App.add(A,B);
              System.out.println("A1 " + A);
              System.out.println("B1 " + B);
              App.goProc();
    OUTPUT.
    A 4
    B 1
    added 5
    A1 4
    B1 1
    A 4
    B 6
    added 10
    A2 4
    B2 6

    If an object is passed by reference,It isn't. Instead, a pointer to the object is passed
    by value.That is exactly what passing by reference is.
    Objects passed by reference can be modified and it will affect the caller, but modifying the reference (assiging a new object) won't affect the caller.
    I m trying to pass parameters into a method so that
    they can be altered and returned, can any one
    suggest a way to do this.I think this is bad OO programing, it results in less readable code and may be hard to debug. Better is to make the method return the result and let the caller assign the new value. (This is my personal oppinion at least)

  • Testing global objects for undefined

    I have two forms that ask for similar information. I have set up global objects so when form #2 is opened, it will grab the info from form #1.
    But if form #1 is not opened (and therefore the global object is not created) I just want the fields in form #2 to be blank rather than display "Empty" for text fields and zeros for numeric fields.
    I tried testing for undefined the following way but it is not working.
    if (typeof global.testtext.rawValue != "undefined") {
    this.rawValue = global.testtext;
    In the above case, the condition always tests as false so the global variable is never set, even when it exists.

    Found a solution. I don't test for undefined. I go ahead and set the field to the global variable and then test for "Empty" if it's a text field and 0 if it is a nummeric field. If the global variable doesn't yet exist, the fields are left blank rather than displaying "Empty" or a zero.
    // For Text Field
    this.rawValue = global.TextField1;
    if (this.rawValue == "Empty") {
    this.rawValue = "";
    // For Numeric Field
    this.rawValue = global.NumericField1;
    if (this.rawValue == 0) {
    this.rawValue = "";

  • Double bounding box when scaling an object...why?

    Here is an example of the issue that I am having. I have a rectangle that I am looking to scale up from the top while keeping the width the same. When I zoom out to see the entire artboard and then go to scale the rectangle it shows up with two bounding boxes. As I drag the bounding box the piece is centered withing the second bounding box and all the spaces are stretched. The issue goes away when I am zoomed in but I don't want this to happen when zoomed out. Does anyone have a suggestion for this issue? I am figuring there is was key command I accidentaly hit and I would like to know how to disable this.
    Thanks,
    Brownj293

    Mr. Bugge:
    Thank you for your response and I apologize for the delay in mine. I couldn't try all of the fixes immediately because I had to complete some job duties before I could tinker with this issue.
    Things that did not work:
    Closing Firefox
    Clearing the Preferences
    Moving the Preferences Folder
    Deleting Temp Files
    Closing Other Adobe Programs (Including Bridge Running in the Background
    Things I cannot do for various reasons:
    Re-installing Acrobat
    Turning Off the Firewall (My Company Only Uses 1 Anyway)
    Things I haven't tried yet but hope to try later:
    Update Printer Definition or Change Default Printer
    Check for Corrupt Fonts
    Clear My Font Cache
    Things I learned:
    The issue is most easily recreated by transforming an object to a smaller object. However, zooming in will realign the bounding box but it will only stay aligned when zoomed in. I find it very curious.
    Even if I don't end up finding an answer, I do appreciate your time and help.

  • Why and how to fix this problem. firefox3.6.6 TypeError: Components.classes[cid] is undefined

    When I open Firefox I get this message.
    '''TypeError: Components.classes[cid] is undefined '''
    Why is this happening and how do I correct it?

    See :
    https://support.mozilla.com/en-US/questions/818225
    https://support.mozilla.com/en-US/questions/845990
    https://support.mozilla.com/en-US/questions/818932

  • Why it is difficult to copy Business Transactions and make it a Z object

    Hi
    I am looking for a proper explanation why it is difficult and not suggested to make a copy of the entire business transaction ( example va01 or any other transactions ) and make a z object and modify it so as to companies business scenarios.
    I need explanation with respect to solution manager,
    where standard sap ticket processing needs to be modified, why can't we copy it into a z object and modify, why we need access key to modify sap standard.
    Thanks & Regards
    Abhimanyu L

    Firstly what is the transaction you wish to modify.
    If I were doing it, I would look at how I would modify the standard SAP code compared to the effort in taking a copy. You should also take into consideration the time it may take to resolve any upgrade issues. Personally I would say that changing the standard SAP in most cases would be the quickest to develop. However, your business case may be to complex to amend the standard SAP.
    When you copy a standard transaction, there are occasions when the SAP Main program is hardcoded into the SAP code. This can also cause you problems as you would need to amend this to use your version of the main program. You can also have problems with Status menu's as they may be coded to use against the SAP Main program.
    Hope that makes sense.

  • Why java is called pure object oriented.

    i know that java is called as pure object oriented language.
    why it is called so even though it has primitive datatypes and also it doesnot support multiple inheritance completely. it only supports in the case of interfaces but not in the case of classes. then why it is called pure object oriented.

    Its because you cannot write an executable java program without creating an object. Well, you can:
    public class a
      public static void main( String a[] )
    }In contrary to C++, there can be no variables or functions in the wild (outside a class).
    You can not create an executable java program without creating a class (but not forcibly its instance, an object.)
    The "pure object oriented" wording in this sense has not really much importance, it is rather a marketing ploy.

  • Acrobat scripting object this.hostContainer is undefined when pdf is in Air

    Hi,
    I'm attempting to use the Adobe Acrobat hostContainer object
    to create a simple interface to allow my Adobe Air application to
    move between pages of an embedded pdf doc. However the output I get
    indicates that the hostContainer object is undefined. The script
    works correctly when the pdf is embedded in a stand-alone html
    file, but not in Air.
    I have Adobe Acrobat 9.0 and Adobe Reader 9.0 installed. It
    does not seem to be an issue with on machines with Adobe 8.0.
    My code in the document javascripts of the pdf is as follows:
    this.disclosed = true;
    if(this.external && this.hostContainer){
    try{
    this.hostContainer.messageHandler={
    myDoc:this,
    onDisclose:function(){return true;},
    onMessage:function(stringArray){
    var cmd=stringArray[0];
    try{
    if(cmd=="nextPage" &&
    this.myDoc.pageNum<this.myDoc.numPages){ this.myDoc.pageNum++;
    }else if(cmd=="previousPage" && this.myDoc.pageNum>0){
    this.myDoc.pageNum--;
    }catch(e){
    this.hostContainer.postMessage(
    ["error thrown in onMessage:",e.message]);
    onError:function(e){
    this.hostContainer.postMessage(["onError: ",e.message]);
    }catch(e){
    this.hostContainer.postMessage(["Error thrown in
    setup:",e.message]);
    }else{
    app.alert("unable to set up hostContainer:
    this.hostContainer="
    +this.hostContainer+" this.external="+this.external);
    The output is that the pdf displays correctly then the alert
    box pops up with [...]this.hostContainer=undefined
    this.external=true.
    If anyone has seen this issue or has any ideas it would be
    much appreciated.
    I've also posted about this problem in the Acrobat Scripting
    forum with no solution as yet.
    Thanks,
    Simon Kelly

    It seems that this issue was registered one month ago into the bug tracking system:
    http://bugs.adobe.com/jira/browse/FB-16281?page=com.atlassian.jira.plugin.system.issuetabp anels:comment-tabpanel
    Any update / workaround / planning so far ?
    The only solution I found is to use version 8.1.3 of the reader.
    Thanks,
    Philippe

  • Synchronizing Shared Objects

    // Server side
    application.onAppStart = function()
    // ... code here
    application.users_so = SharedObject.get("users_so", false);
    // ... more code here
    application.onConnect = function(newClient, userID)
    // client object properties being setup, etc
    application.users_so.setProperty(userID, newClient);
    // ... more code
    application.acceptConnection(newClient);
    // Client side
    nc.connect(rtmpURL, userID);
    users_so = SharedObject.getRemote("users_so", nc.uri, false);
    users_so.connect(nc);
    When I call the above on the client side I should receive a
    copy of all users that are stored in the server's shared object
    indexable by users_so.data[userID] correct?
    on the server side I perform the following:
    application.acceptConnection(newClient);
    newClient.call("updateStatus", null, userID);
    on the client side the updateStatus method looks like this:
    nc.syncQuestions = function(userID:String)
    trace("--> "+users_so.data[userID]+" <--");
    }; (is the ';' necessary?!?)
    this prints: --> undefined <--
    WHY?!? :( --> is this because of a race condition between
    the nc.connect() and the users_so.connect() ??
    NOTE: My problem seems to arise when I try to re-connect
    (i.e. connect w/ client, close client, re-open client)
    Cheers

    I have the feeling it's a timing problem because you're not
    waiting for the onStatus event from the netconnection before you
    connect the shared object.
    Try adding an onStatus handler to your netconnection, and
    wait for a code of "NetConnection.Connect.Success". Then connect
    your shared object.

  • Same trace,two results,why?

    //.....................
    trace(channelbtn[channellistnum+channelshownum]);//line1
    programtween_y.onMotionStopped = function(){
    trace(channelbtn[channellistnum+channelshownum]);//line2
    //line1,trace right result,but line2 trace undefined,why???
    "channelbtn[channellistnum+channelshownum]" is a button
    object, "channellistnum" and "channelshownum" are two
    numbers,they've been defined above line1,so line1 trace right
    result,but why line2 trace undefined?what's the different between
    these two function ways below:
    1. function a(){}
    2. a = function(){}
    Thank you for reply.......

    thank Osh_it,now i know where the problem is:
    In AS2.0,function like this way need Delegate!!!!This is very
    important,because the object is undefined in this function way.
    programtween_y.onMotionStopped = function(){
    trace(channelbtn[channellistnum+channelshownum]);//line2
    so,we should use this function like this:
    programtween_y.onMotionStopped = Delegate.create(this,aaa);
    private function aaa(){
    trace(channelbtn[channellistnum+channelshownum]);//line2
    It's ok,now!!!

  • Doc.hostContainer undefined error in xfa

    I want to send message from html to pdf ,so I draw form with liveCycle Designer ES ,
    I add the following codes in docReady event of form :
        var objDoc = event.target;
           app.alert(objDoc.hostContainer);
    then I embed that pdf file into html,like this:
        <object id='dddd' height=500 width=100% data="mypdf.pdf"></object>
    I open this html file .I get the error: "undefined" .why? thanx for ur reply.
    I use the following:
        liveCycle Designer ES 8.2.1
        acrobat reader 9.1/acrobat reader 8.1.3
        internet explorer 6.0.

    resolved

Maybe you are looking for

  • Creation of Custom IDoc with Message control for sales Order

    Hi all, I am trying to create custom Outbound IDoc with message control. I wrote the code in a function module and i want to register that function module. (as in inbound registration of function module as in BD51).I am not knowing if that registrati

  • Best way to get an .avi file out of a Final Cut Project

    Should I export it from the Timeline as an .avi, if so what compressor and settings should I use? Should I export it as a Quicktime movie and convert it to .avi from MPeg Streamclip, if so, what compressor and settings should I use for best effect? (

  • SMB Symlinks Showing as 0kb on Windows PCs

    Hello again everyone.  After my previous post on problems with wide symlinks and how to fix that finally resolved I now have another irritating issue I can't seem to put my finger on.  Seems that shares I have hosted off my Mac Pro over SMB are now r

  • [urgent]online game development

    i would like to know if i hope to develop an online game, like what we play in yahoo reversi, once the user put the black peg , the oponent can see he / she put the black peg , how this would be done...any recommend site to learn the online game prog

  • Program will not open

    I have successfully downloaded iTunes several times, but it will not open for me. The iTunes icon appears on the desktop and in the program files and I can click on it, but nothing happens. Is there something wrong with my computer. It has worked on