Unloading createEmptyMovieClip

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sebarry
    New Member
    • Jul 2007
    • 69

    Unloading createEmptyMovieClip

    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

    Code:
    titleMC = _root.sub_nav_mc.createEmptyMovieClip("articleTitleMC" + i, 
         _root.sub_nav_mc.getNextHighestDepth());
    titleMC._x = 0;
    titleMC._y = yAxis;
    titleTF = titleMC.createTextField("articleTitleTF", 10, 0, 0, 82, 16);
    titleMC.articleTitleTF.text = articleTitle[1];
    titleMC.articleTitleTF.setTextFormat(titleFormat);
    .

    Code:
    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.

    Code:
    for( var property in _root.sub_nav_mc )
    {
         if( typeof( _root.sub_nav_mc[property] == "movieclip" ) )
         {
            _root.sub_nav_mc[property].unloadMovie();
            trace( "Unloaded " + property );
         }
    }
    I'd really appreciate any help.

    Thanks, Sean
  • xNephilimx
    Recognized Expert New Member
    • Jun 2007
    • 213

    #2
    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

    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

    Code:
    titleMC = _root.sub_nav_mc.createEmptyMovieClip("articleTitleMC" + i, 
         _root.sub_nav_mc.getNextHighestDepth());
    titleMC._x = 0;
    titleMC._y = yAxis;
    titleTF = titleMC.createTextField("articleTitleTF", 10, 0, 0, 82, 16);
    titleMC.articleTitleTF.text = articleTitle[1];
    titleMC.articleTitleTF.setTextFormat(titleFormat);
    .

    Code:
    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.

    Code:
    for( var property in _root.sub_nav_mc )
    {
         if( typeof( _root.sub_nav_mc[property] == "movieclip" ) )
         {
            _root.sub_nav_mc[property].unloadMovie();
            trace( "Unloaded " + property );
         }
    }
    I'd really appreciate any help.

    Thanks, Sean

    Comment

    Working...