Connecting Tech Pros Worldwide Forums | Help | Site Map

Unloading createEmptyMovieClip

Member
 
Join Date: Jul 2007
Posts: 69
#1: Aug 28 '07
Hi,

I have a actionscript script that retrieves data from the database and creates a movie clip with a text field to store the data. I have next and previous buttons to navigate to show the next or previous ten database records.

When previous or next are clicked I want to remove the movie clips previously created using

Expand|Select|Wrap|Line Numbers
  1. titleMC = _root.sub_nav_mc.createEmptyMovieClip("articleTitleMC" + i, 
  2.      _root.sub_nav_mc.getNextHighestDepth());
  3. titleMC._x = 0;
  4. titleMC._y = yAxis;
  5. titleTF = titleMC.createTextField("articleTitleTF", 10, 0, 0, 82, 16);
  6. titleMC.articleTitleTF.text = articleTitle[1];
  7. titleMC.articleTitleTF.setTextFormat(titleFormat);
  8.  
.

Expand|Select|Wrap|Line Numbers
  1. articleTitle[1] contains data retrieved from the database.
. To remove these movie clips do I use unloadMovie or removeMovieClip? Here's the code I have for that.

Expand|Select|Wrap|Line Numbers
  1. for( var property in _root.sub_nav_mc )
  2. {
  3.      if( typeof( _root.sub_nav_mc[property] == "movieclip" ) )
  4.      {
  5.         _root.sub_nav_mc[property].unloadMovie();
  6.         trace( "Unloaded " + property );
  7.      }
  8. }
  9.  
I'd really appreciate any help.

Thanks, Sean

xNephilimx's Avatar
Expert
 
Join Date: Jun 2007
Location: Buenos Aires, Argentina
Posts: 200
#2: Aug 31 '07

re: Unloading createEmptyMovieClip


Hi Sebarry.
When the user navigates to previous or next records you may not need to remove the movieclips created, just update them with the new data.
Anyway, if for some reason or preference you want to remove them you should use the removeMovieClip method, since this method "deletes" a movieclip from the stage and the unloadMovie method just onloads a movie that was loaded into another one using the loadMovie method, leaving the target movieclip on the stage.

Kind regards,
The_Nephilim

Quote:

Originally Posted by Sebarry

Hi,

I have a actionscript script that retrieves data from the database and creates a movie clip with a text field to store the data. I have next and previous buttons to navigate to show the next or previous ten database records.

When previous or next are clicked I want to remove the movie clips previously created using

Expand|Select|Wrap|Line Numbers
  1. titleMC = _root.sub_nav_mc.createEmptyMovieClip("articleTitleMC" + i, 
  2.      _root.sub_nav_mc.getNextHighestDepth());
  3. titleMC._x = 0;
  4. titleMC._y = yAxis;
  5. titleTF = titleMC.createTextField("articleTitleTF", 10, 0, 0, 82, 16);
  6. titleMC.articleTitleTF.text = articleTitle[1];
  7. titleMC.articleTitleTF.setTextFormat(titleFormat);
  8.  
.

Expand|Select|Wrap|Line Numbers
  1. articleTitle[1] contains data retrieved from the database.
. To remove these movie clips do I use unloadMovie or removeMovieClip? Here's the code I have for that.

Expand|Select|Wrap|Line Numbers
  1. for( var property in _root.sub_nav_mc )
  2. {
  3.      if( typeof( _root.sub_nav_mc[property] == "movieclip" ) )
  4.      {
  5.         _root.sub_nav_mc[property].unloadMovie();
  6.         trace( "Unloaded " + property );
  7.      }
  8. }
  9.  
I'd really appreciate any help.

Thanks, Sean

Reply