1 Reply Latest reply on Sep 2, 2007 10:30 PM by kglad

    Strange behavior - creating, loading movie clips works only for first function call

    clem_of_rock
      Hello,

      I am reading an XML document and creating empty movie clips and attaching multiple instances of a movie clip from the library into each empty movie clip.

      it works fine in the first loop and function call but after that, the movie clips register as being created, and attached but they aren't showing up.


      Here's some of the code, in a nutshell:

      [code]
      function call_xml( start_cnt )
      {
      var xml_menu:String = 'gallery.xml';
      menuXML = new XML();
      menuXML.ignoreWhite=true;
      menuXML.load( xml_menu );
      menuXML.onLoad = parse_xml;
      }


      function parse_xml()
      {
      //---- create holder movie clips w/in the pc_movie_loader
      //---------------------------------------------------------------------------
      _root.pc_movie_loader.mc_holder_clip.unloadMovie();
      _root.pc_movie_loader.createEmptyMovieClip( 'mc_holder_clip', 1 );
      //----------------------------------------------------------------------------

      for( var i:Number = 0; i < node_1.length; i++ )
      {
      subnode_1 = node_1 .childNodes;

      if( i >= this_start_cnt && i < this_end_cnt )
      {
      _root.pc_movie_loader.mc_holder_clip.createEmptyMovieClip( 'mc_demo_panel_' + i, i );
      _root.attach_movie_clip('reg_demo_panel', _root.pc_movie_loader.mc_holder_clip['mc_demo_panel_' + i], '', row_x, row_y );
      _root.print_clip_elements(_root.pc_movie_loader.mc_holder_clip);

      row_cnt++;
      row_y = row_y + (_root.pc_movie_loader.mc_holder_clip['mc_demo_panel_' + i]._height + 10);

      if( row_cnt == 2)
      {
      row_x = 444;
      row_y = 10;
      row_cnt = 0;
      }
      }
      }

      }

      and here's the print_clip_elements test function I'm using to print the contents of the movie clips:


      function print_clip_elements( clip:Object )
      {
      for( var j in clip )
      {
      trace( "****** j:" + j + " : " + clip[j] );
      }
      }

      and here's the attach_movie_clip test function I'm using to attach the movie clips from the library:

      function attach_movie_clip( movie_clip:Object, level:Object, message_var:String, x_coords:Number, y_coords:Number )
      {
      level.attachMovie( movie_clip, movie_clip,10,{_x:x_coords,_y:y_coords});
      }
      [/code]

      When I call the print clip elements the output is as follows for every function call:


      ===== START PRINT MOVIE CLIPS ============================
      j:mc_demo_panel_4 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_4
      ===== END PRINT MOVIE CLIPS ============================


      ===== START PRINT MOVIE CLIPS ============================
      j:mc_demo_panel_5 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_5
      j:mc_demo_panel_4 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_4
      ===== END PRINT MOVIE CLIPS ============================


      ===== START PRINT MOVIE CLIPS ============================
      j:mc_demo_panel_6 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_6
      j:mc_demo_panel_5 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_5
      j:mc_demo_panel_4 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_4
      ===== END PRINT MOVIE CLIPS ============================


      ===== START PRINT MOVIE CLIPS ============================
      j:mc_demo_panel_7 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_7
      j:mc_demo_panel_6 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_6
      j:mc_demo_panel_5 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_5
      j:mc_demo_panel_4 : _level0.pc_movie_loader.mc_holder_clip.mc_demo_panel_4
      ===== END PRINT MOVIE CLIPS ============================

      it's registering that all the movie clips have been created and the mc_demo_panel library item has been attached.

      Any ideas why the first function call works and everyone after that doesn't?

      Thanks,
      Clem C