Announcement

Collapse
No announcement yet.

attachMovie, yes. But what about removing?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    attachMovie, yes. But what about removing?

    I don't have much trouble attaching new movieclips to the scene or inside existing objects. But how do I remove movieclips? I can't find anything relevant in the gfxObject class for doing this.

    Can I use the CreateEmptyMovieClip and replace the depth of the movie clip if I want to delete an existing clip?

    #2
    One option, as you suggested, is to replace the movie clip with a blank one.
    Code:
    var GFxObject RootMC
    
    // cache the _root timeline.
    
    RootMC = GetVariableObject("_root");
    
    // create a new movie clip at depth 0
    // called 'InstanceName' on the _root timeline, 
    // using a symbol from the library that has 
    // the linkage ID of 'LinkageID'.
    
    RootMC.AttachMovie("LinkageID", "InstanceName", 0);
    
    // replace the 'InstaneName' movie clip with an empty movie clip at depth 0.
    
    RootMC.CreateEmptyMovieClip("InstanceName", 0);

    Comment


      #3
      But to actually remove a movie clip, you'll need to use Invoke:

      Code:
      var GFxObject RoomMC, MyMovieClip;
      var array<ASValue> args;
      var ASValue asval;
      
      // Attach the movie clip to the _root
      
      RootMC = GetVariableObject("_root");
      MyMovieClip = RootMC.AttachMovie("LinkageID", "InstanceName");
      
      // Remove the movie clip
      
      asval.Type = AS_Boolean;
      asval.b = TRUE;
      args[0] = asval;
      
      MyMovieClip.Invoke("removeMovieClip", args);

      Comment


        #4
        Thanks for your answers, both of them actually =) I've been working on some other parts recently but this helped me in several ways. So one can actually call whatever built in flash function from US using the Invoke() function?

        Comment


          #5
          Essentially, yes.

          Comment

          Working...
          X