www.webdeveloper.com
Results 1 to 3 of 3

Thread: Problem with appendChild

  1. #1
    Join Date
    Aug 2012
    Posts
    3

    Problem with appendChild

    Hi,

    I am designing a web application, and I have troubles when I update a view in aproximatetly the 50th time.

    I put the 3D object in the view using:

    Code:
    new_view =new Viewer( 3D_Object, 250, 250, 5); 
    document.getElementById(0).appendChild(new_view.gl.canvas);

    And when I want to update the view, because I manipulate this 3D object, I use:

    Code:
    old_view = new_view;
    new_view =new Viewer( 3D_Object, 250, 250, 5); 
    document.getElementById(0).removeChild(old_view.gl.canvas);
    document.getElementById(0).appendChild(new_view.gl.canvas);

    The updates work well in the firts 49 times aproximatetly, but in the time 50 the program hangs.

    In the firts times:
    http://i47.tinypic.com/zobyg3.jpg

    When the code breaks in the 50th time:
    http://i45.tinypic.com/2rc0mfm.jpg

    What is wrong?

    Tanks

  2. #2
    Join Date
    Mar 2007
    Location
    U.K.
    Posts
    1,127
    Quote Originally Posted by arcadi1988 View Post
    Code:
    document.getElementById(0).appendChild(new_view.gl.canvas);
    Why are you passing an integer to a function that expects a string?
    Where used, return should be executed unconditionally and always as the last statement in the function.

    That's my signature, it's not part of the damn post!

  3. #3
    Join Date
    Aug 2012
    Posts
    3
    I replaced the integers to strings, and does the same...

    http://www.mediafire.com/?hoefetczxe4tvus

    I cannot hang the web, because It's a offline application. I put the webpage in a zip (I passed the antiviruses).

    Proba6.html is the webpage, and It needs the libraries: csg.js, lightgl.js and viewer.js.

    The file INFO.txt, is a text file that contains the tool coordinates and workpiece dimensions. It needs to be in C: directory.

    For see the piece, It only works with chrome with the extention "--allow-file-access-from-files" for read the text file, like the direct acces that I put in the zip.

    A lot of thanks... I am very desperate because is the last thing that I need for my final project...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles