Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

tiê.zinha

slide horizontal de movie clip

Recommended Posts

Tenho um movieclipe no meu stage, onde são carregadas (via XML) algumas imagens e tenho um efeito de rollOver pra essas imagens.

 

Mas eu gostaria que esse movieclipe ficasse passando pela tela, como um slide/scroll.

 

A questão é, como dar o comando do scroll sem necessidade de rollOver e sem interferir no meu rollOver?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Tenho um movieclipe no meu stage, onde são carregadas (via XML) algumas imagens e tenho um efeito de rollOver pra essas imagens.

 

Mas eu gostaria que esse movieclipe ficasse passando pela tela, como um slide/scroll.

 

A questão é, como dar o comando do scroll sem necessidade de rollOver e sem interferir no meu rollOver?

Poste seus codigos ou ate mesmo um fla, para que o pessoal tenho mais recursos para poder lhe ajudar.

abs

Compartilhar este post


Link para o post
Compartilhar em outros sites

Tenho um movieclipe no meu stage, onde são carregadas (via XML) algumas imagens e tenho um efeito de rollOver pra essas imagens.

 

Mas eu gostaria que esse movieclipe ficasse passando pela tela, como um slide/scroll.

 

A questão é, como dar o comando do scroll sem necessidade de rollOver e sem interferir no meu rollOver?

Poste seus codigos ou ate mesmo um fla, para que o pessoal tenho mais recursos para poder lhe ajudar.

abs

 

 

O Código de dentro do movieclipe (que carrega as imagens):

//Image Slider By John Bezanis for SWFspot
	  //Settings to play with
	  //the height of the images when not stretched
	  var maxheight = 80;
	  //the y position of the "floor" or where the images sit on
	  var floor = 350;
	  //The amount an image scales to as the mouse gets closer
	  var curvedistance = 160;
	  //The amount of gap in between each image
	  var sidegap = 5;
	  //The background color of the document. This is used for the reflection
	  var bgcolor = 0xFFFFFF;
	  /*no more settings to play with below here */
	  //Initialize the image count to 0
	  var imagecount = 0;
	  //if the get parameter "xmlfile" is not set, change the xml file to load the data to a default name
	  if (_root.xmlfile == undefined || _root.xmlfile == "") {
		//default name for the xml feed
		_root.xmlfile = "sliderfeed.xml";
	  }
	  var myXml:XML = new XML();
	  myXml.ignoreWhite = true;
	  //Load the xml file
	  myXml.load(_root.xmlfile);
	  //run when the xml file has loaded
	  myXml.onLoad = function() {

		  //parse the xml file and load in the images

		loadImages();
	  };
	  //start loading in the images
	  function loadImages() {
		//traverse through each pic of the xml file
		for (imageIndex=0; imageIndex<myXml.childNodes[0].childNodes.length; imageIndex++) {
		  //create a new instance of imagebox to load our pic,caption,and url into
		  attachMovie("imagebox", "im" + imageIndex, this.getNextHighestDepth());
		  //load in the pic
		  eval("im" + imageIndex).pic = myXml.childNodes[0].childNodes[imageIndex].childNodes[0].childNodes[0].nodeValue;
		  //load the caption
		  eval("im" + imageIndex).caption = myXml.childNodes[0].childNodes[imageIndex].childNodes[1].childNodes[0].nodeValue;
		  //load the url
		  eval("im" + imageIndex).url = myXml.childNodes[0].childNodes[imageIndex].childNodes[2].childNodes[0].nodeValue;
		  //set the index to the current index of the for loop
		  eval("im" + imageIndex).index = imageIndex;
		  //move this above the caption box
		  eval("im" + imageIndex).swapDepths(captionbox);
		  //increment the imagecount
		  imagecount++;
		}
	  }
	  //run at the start of each frame
	  onEnterFrame = function () {
		  //only run if the image have been loaded
		if (imagecount != 0) {
		  //figure out which image the mouse is closest to on the x plane
		  curmouseover = Math.max(0, Math.min(imagecount, imagecount*(_xmouse-sidegap)/(Stage.width-sidegap*2)));
		  //if the current x position is greater than our strip's width, create a movieclip as a placeholder
		  if (eval("im" + Math.floor(curmouseover))._x == undefined) {
			this.createEmptyMovieClip("im" + Math.floor(curmouseover), this.getNextHighestDepth());
			//Move the newly created clip to the width of the strip plus the sidegap
			eval("im" + Math.floor(curmouseover))._x = Stage.width+sidegap;
		  }
		  //if the current x position is past the strip's width, select the last pic 
		  if (curmouseover>=myXml.childNodes[0].childNodes.length) {
			//move the last pic to the stage width minus the width of the pic
			eval("im" + Math.floor(curmouseover))._x = Stage.width-eval("im" + Math.floor(curmouseover))._width;
		  } else {
			//else the x position is set based on the distance from the centerpoint of that index
			eval("im" + Math.floor(curmouseover))._x = _xmouse-(curmouseover-Math.floor(curmouseover))*eval("im" + Math.floor(curmouseover))._width;
		  }
		  //scale the image based on the image center's distance from x mouse position
		  scale = Math.max(100, curvedistance-(Math.abs((eval("im" + Math.floor(curmouseover))._x+eval("im" + Math.floor(curmouseover))._width/2)-_xmouse))/4);

		eval("im" + Math.floor(curmouseover))._xscale = scale;
		  eval("im" + Math.floor(curmouseover))._yscale = scale;
		  //Set the y position to the floor minus the height of the pic
		  eval("im" + Math.floor(curmouseover))._y = floor-eval("im" +Math.floor(curmouseover)).image_mc._height*eval("im" + Math.floor(curmouseover))._yscale/100;
		  //traverse through the images to the right of the current selected image, scaling and setting the x position
		  for (curpos=Math.floor(curmouseover); curpos<imagecount-1; curpos++) {
			//scale the image based on the image center's distance from x mouse position
			scale = Math.max(100, curvedistance-(Math.abs((eval("im" + Math.floor(curpos))._x+eval("im" + Math.floor(curpos))._width*1.5)-_xmouse))/4);
			eval("im" + Math.floor(curpos+1))._xscale = scale;
			eval("im" + Math.floor(curpos+1))._yscale = scale;
			//set the x position to the x position of the last image plus the width and sidegap
			eval("im" + Math.floor(curpos+1))._x = eval("im" + Math.floor(curpos))._x+(eval("im" + Math.floor(curpos))._width+sidegap);
			//move the y position according to how much the image is scaled
		   eval("im" + Math.floor(curpos+1))._y = floor-eval("im" + Math.floor(curpos+1)).image_mc._height*eval("im" + Math.floor(curpos+1))._yscale/100;
		  }
		  //traverse through the images to the left of the current selected image, scaling and setting the x position
		  for (curpos=Math.floor(curmouseover); curpos>0; curpos--) {
			//scale the image based on the image center's distance from x mouse position
			scale = Math.max(100, curvedistance-(Math.abs((eval("im" + Math.floor(curpos-1))._x+eval("im" + Math.floor(curpos-1))._width/2)-_xmouse))/4);

		   eval("im" + Math.floor(curpos-1))._xscale = scale;

		   eval("im" + Math.floor(curpos-1))._yscale = scale;
			//set the x position to the x position of the last image minus the width and sidegap
			eval("im" + Math.floor(curpos-1))._x = eval("im" + Math.floor(curpos))._x-(eval("im" + Math.floor(curpos-1))._width+sidegap);

		   //move the y position according to how much the image is scaled
			eval("im" + Math.floor(curpos-1))._y = floor-eval("im" + Math.floor(curpos-1)).image_mc._height*eval("im" + Math.floor(curpos-1))._yscale/100;
		 }
		}
	  };

E este é o código de rolagem:

onClipEvent (load)
{
   xcenter=360;
   speed=1/30;
}
onClipEvent (enterFrame)
{
   var distance=_root._xmouse-xcenter;
   _x+=(distance*speed);
   if (_x > 0) _x=-720;
   if (_x < -720) _x=0;
}

Eu preciso disso, mas sem depender do movimento do mouse...

e não sei como fazer

:(

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.