[thelist] Flash problem: removeMovieClip

Millie Niss men2 at columbia.edu
Sun Jun 27 03:50:11 CDT 2004


If anyone can solve this Flash 2004 problem I'd be very grateful.... I am up
against a deadline with this, and I am really stuck!

I am defining a component that makes a movie clip from the library appear
when you roll over it.  This works.  I use attachMovie and give it a unique
name made up of the linkage name of the thing I'm attaching plus the depth
I'm attaching at.

But when I try to remove it, it won't go away!  I want RollOut to remove the
thing. When I trace the thing I'm trying to remove I get what I expect...

My code is as follows:

class DisjointRollOver extends MovieClip
{
 [Inspectable] private var toappear:String;
 [Inspectable] private var x:Number = 0;
 [Inspectable] private var y:Number = 0;
 [Inspectable] private var xs:Number = 100;
 [Inspectable] private var ys:Number = 100;
 [Inspectable] private var rot:Number = 0;
 [Inspectable] private var a:Number = 100;
 private var clip:MovieClip;
 private var clipname:String;

 public function DisjointRollOver()
 {
  init();
 }
private function init():Void
 {
  this.onRollOver = function()
  {
   if(this.toappear)
   {
    var depth:Number = _root.getNextHighestDepth();
    this.clipname = toappear + String(depth);
    _root.attachMovie(toappear, clipname, depth);
    this.clip = eval(clipname);
    eval(this.clipname)._x = this.x;
    eval(this.clipname)._y = this.y;
    eval(this.clipname)._xscale = this.xs;
    eval(this.clipname)._yscale = this.ys;
    eval(this.clipname)._rotation = this.rot;
    eval(this.clipname)._alpha = this.a;
   }
  }
  this.onRollOut = function()
  {
   if(this.clipname)
   {
    trace(this.clip);
    this.clip.removeMovieClip();
   }
  }
 }
}




More information about the thelist mailing list