Comunidad de diseño web y desarrollo en internet online

remover un clip de pelicula cargado con attachMovie

Citar            
MensajeEscrito el 16 Jul 2006 05:04 pm
Hola amigos del foro, pues mi pregunta es como remover un clip de pelicula que llamo desde la biblioteca con el metodo attachMovie.

Por flashernest

11 de clabLevel



 

firefox
Citar            
MensajeEscrito el 16 Jul 2006 05:25 pm

Por JuDaS

105 de clabLevel



Genero:Masculino  

Bogota, Colombia

firefox
Citar            
MensajeEscrito el 16 Jul 2006 05:37 pm
Gracias judas, ya he probado pero no me funciona, el problema es que estoy haciendo un reproductor de mp3 y el boton se duplica por el xml, entonces cuando tengo una lista de 10 canciones y paso a otra que tiene 5 me aparecen las 5 mas las 5 de la anterior lista.

este es el codigo:

Código :

this.album2.onRelease = function() {
   removeMovieClip("butTemp");
   gotoAndStop("Scene 1", 1);
   stopAllSounds();
}
stop();
title_txt.autoSize = "left";
timeDisplay_txt.autoSize = "left";
toolTip._visible = false;
var amountLoaded:Number;
var duration:Number;

playlist = new XML();
playlist.ignoreWhite = true;
playlist.onLoad = function(success) {
   if (success) {
      _global.songname = [];
      _global.songband = [];
      _global.songfile = [];
      for (var i = 0; i<playlist.firstChild.childNodes.length; i++) {
      _global.songname[i] = playlist.firstChild.childNodes[i].attributes.name;
      _global.songband[i] = playlist.firstChild.childNodes[i].attributes.band;
      _global.songfile[i] = playlist.firstChild.childNodes[i].attributes.file;
      attachMovie("butTemp","but"+i,i+50);
      eval("but"+i).id=i;
      _root["but"+i]._x = 5;
      _root["but"+i]._y = 40 + (i*15);
      _root["but"+i].but_txt.text = songname[i];
      if (i >= 3){
         _root["but"+i]._x = 160
         _root["but"+i]._y = -5 + (i*15);
      }
      _root["but"+i].onRelease = function(){
         clearInterval(timeInterval);
         _root.timeDisplay_txt.text = "00:00/00:00";
         _root.sound_mc.songStarter(songfile[this.id]);
      }
   }
   }
   _root.createEmptyMovieClip("sound_mc", 1);
   _global.song_nr = 0
   _root.sound_mc.songStarter(songfile[song_nr]);
};

function timer(sound_obj) {
   time = sound_obj.position/1000;
   min = Math.floor(time/60);
   min = (min<10) ? "0"+min : min;
   sec = Math.floor(time%60);
   sec = (sec<10) ? "0"+sec : sec;
   timeDisplay_txt.text = min+":"+sec+"/"+totalDuration;
}
function duration (){
   timed = _root.sound_mc.sound_obj.duration/1000;
   mind = Math.floor(timed/60);
   mind = (mind<10) ? "0"+mind : mind;
   secd = Math.floor(timed%60);
   secd = (secd<10) ? "0"+secd : secd;
   totalDuration = mind+":"+secd;
}
MovieClip.prototype.songStarter = function(file) {
   if (this.sound_obj) {
      this.sound_obj.stop();
      delete this.sound_obj;
   }
   this.sound_obj = new Sound(this);
   this.sound_obj.loadSound(file, true);
   this.sound_obj.setVolume(0);
   this.sound_obj.start(0, 00);
   this.onEnterFrame = function() {
      if (this.sound_obj.position>0) {
         delete this.onEnterFrame;
         timeInterval = setInterval(timer, 1000, this.sound_obj);
         track = this.sound_obj.id3.songname;
         artist = this.sound_obj.id3.artist;
         this._parent.title_txt.text =artist+" - "+track;
      } else {
         this._parent.title_txt.text = "loading...";
      }

   };         
   this.sound_obj.onSoundComplete = function() {
      clearInterval(timeInterval);
      _root.timeDisplay_txt.text = "00:00/00:00";
      (song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;
      _root.sound_mc.songStarter(songfile[song_nr]);
   };
   this._parent.volume1.dragger.onPress = function() {
      startDrag(this, true, 0, this._y, this._parent.volBG._width, this._y);
      _root.toolTip._visible = true;
      setInterval(draggableTip,100);
      function draggableTip(){
         _root.toolTip._x = _root._xmouse;
      }
      this.onEnterFrame = function() {
         var p = (this._x/this._parent.volBG._width)*100;
         this._parent._parent.sound_mc.sound_obj.setVolume(p);
         
      };
   };
   this._parent.volume1.dragger.onRelease = function() {
      delete this.onEnterFrame;
      stopDrag();
      
   };
   this._parent.volume1.dragger.onReleaseOutside = function() {
      _root.toolTip._visible = false;
      stopDrag();
      
   };
};

function soundStatus(){
   var amountLoaded = _root.sound_mc.sound_obj.getBytesLoaded() / _root.sound_mc.sound_obj.getBytesTotal();   _root.loader.loadBar._width = amountLoaded * 260;
   duration = _root.sound_mc.sound_obj.duration;
   position = _root.sound_mc.sound_obj.position;
   _root.playHead._x = position / duration * 272 + 5;
}

btn_play.onRelease = function() {
   clearInterval(timeInterval);
   _root.timeDisplay_txt.text = "00:00/00:00";
   this._parent.sound_mc.songStarter(songfile[song_nr]);
};
btn_stop.onRelease = function() {
   clearInterval(timeInterval);
   _root.timeDisplay_txt.text = "00:00/00:00";
   this._parent.sound_mc.sound_obj.stop();
};
btn_fw.onRelease = function() {
   clearInterval(timeInterval);
   _root.timeDisplay_txt.text = "00:00/00:00";
   (song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;
   _root.sound_mc.songStarter(songfile[song_nr]);
};
btn_rev.onRelease = function() {
   clearInterval(timeInterval);
   _root.timeDisplay_txt.text = "00:00/00:00";
   (song_nr == 0) ? _global.song_nr=songfile.length-1 : _global.song_nr--;
   _root.sound_mc.songStarter(songfile[song_nr]);
};

playlist.load("Files/SafelyEP.xml");
setInterval(duration,100);
setInterval(soundStatus,100);


usa las etiquetas code

Por flashernest

11 de clabLevel



 

firefox
Citar            
MensajeEscrito el 16 Jul 2006 05:44 pm
que pena me podrias explicar lo de las etiquetas code? :)

Por flashernest

11 de clabLevel



 

firefox
Citar            
MensajeEscrito el 16 Jul 2006 05:48 pm
jaja, cuando posteas codigo muy largo hace que se desface el foro, para eso estan las etiquetas code, te encierra el codigo y queda todo mas prolijo y visible.
saludos

Por Mariux

BOFH

7756 de clabLevel

28 tutoriales
15 articulos

Genero:Femenino   Héroes Editores

Diseñadora & ilustradora

firefox
Citar            
MensajeEscrito el 16 Jul 2006 05:49 pm
jajaja :)

Por flashernest

11 de clabLevel



 

firefox
Citar            
MensajeEscrito el 16 Jul 2006 09:56 pm
la sintaxis más fácil es butTemp.removeMovieClip();
Saludos.

Por Zah

BOFH

4290 de clabLevel

27 tutoriales
5 articulos

  Bastard Operators From Hell Editores

Zaragoza, España

firefox
Citar            
MensajeEscrito el 17 Jul 2006 02:00 am
Ya lo he colocado dentro del boton y tambien iniciando el codigo pero no me ha funcionado.

Por flashernest

11 de clabLevel



 

firefox
Citar            
MensajeEscrito el 17 Jul 2006 12:07 pm
attachMovie("butTemp","but"+i,i+50);

Es que el botón se llama but+i, no butTemp. Si quieres eliminarlos todos, sería algo así:

Código :

for (a in _root) {
   suj = _root[a];
   if (typeof (suj) == "movieclip" && suj._name.substr(0, 3) == "but") {
      suj.removeMovieClip();
   }
}

Por Zah

BOFH

4290 de clabLevel

27 tutoriales
5 articulos

  Bastard Operators From Hell Editores

Zaragoza, España

firefox
Citar            
MensajeEscrito el 17 Jul 2006 03:17 pm
Muchas Gracias zah, ya lo he colocado y funciona perfecto :)

Por flashernest

11 de clabLevel



 

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.