Ir para conteúdo

Arquivado

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

Wagner Martins - SC

As3 - erros

Recommended Posts

Olá,

 

Fiz esse código as3 para fazer algumas animações:

 

// File downloaded from www.riacodes.com
import com.greensock.TweenLite;
import com.greensock.plugins.*;

TweenPlugin.activate([VisiblePlugin, ShortRotationPlugin, RoundPropsPlugin, TintPlugin, ColorMatrixFilterPlugin, BlurFilterPlugin, VolumePlugin, DropShadowFilterPlugin, BevelFilterPlugin, AutoAlphaPlugin, EndArrayPlugin, GlowFilterPlugin, FramePlugin, RemoveTintPlugin, BezierPlugin, BezierThroughPlugin, ColorTransformPlugin, FrameLabelPlugin]);

//use the default SlowMo ease (linearRatio of 0.7 and power of 0.7)
TweenLite.to(mc_ciple, 5, {x:600, ease:SlowMo.ease});

//use a new SlowMo ease with 50% of the tween being linear (2.5 seconds) and a power of 0.8
TweenLite.to(mc_ciple, 5, {x:600, ease:new SlowMo(0.5, 1.0)});
 
//this gives the exact same effect as the line above, but uses a different syntax
TweenLite.to(mc_ciple, 5, {x:600, ease:SlowMo.ease.config(0.5, 1.0)});
 
//now let's create an alpha tween that syncs with the above positional tween, fading it in at the beginning and out at the end
mc_ciple.alpha = 0;
TweenLite.to(mc_ciple, 5, {alpha:1, ease:SlowMo.ease.config(0.5, 1.0, true)});


var xml:XML;
var photos:Array;
var totalPhotos:Number;
var folder:String = "photos/";
var gallery:Sprite;
var photosLoaded:int=0;

function loadXML(file:String):void{
	var xmlLoader:URLLoader = new URLLoader();
	xmlLoader.load(new URLRequest(file));
	xmlLoader.addEventListener(Event.COMPLETE, parseXML);
}

function parseXML(e:Event):void{
	xml = new XML(e.target.data);
	totalPhotos = xml.children().length();
	loadGallery();
}

function loadGallery():void{
	photos = new Array();
	for(var i:int = 0; i<totalPhotos; i++){
		var loader:Loader = new Loader();
		loader.load(new URLRequest(folder + xml.photo[i].@src));
		photos.push(loader);
		loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplete);
	}
}

function onComplete(e:Event):void{
	photosLoaded++;
	if(photosLoaded == totalPhotos){
		createThumbs();
	}
}

function createThumbs():void{
	gallery = new Sprite();
	addChild(gallery);
	
	for(var i:int = 0; i < photos.length; i++){
		
		var thumb:Thumb = new Thumb();
		thumb.scaleX = thumb.scaleY = .5;
					
		thumb.x = (thumb.width + 5) * i;
		thumb.title =  xml.photo[i].@title;
			
		var bm:Bitmap = new Bitmap();
		bm = Bitmap(photos[i].content);
		bm.smoothing = true;
		thumb.photo.addChild(bm);
		
		gallery.addChild(thumb);
		TweenLite.from(thumb, .5, {scaleX:0,scaleY:0,alpha:0, delay: i*0.2, onComplete:addThumbListeners,onCompleteParams:[thumb]});
		
	}
	gallery.x = stage.stageWidth/2 - gallery.width/2;
	gallery.y = stage.stageHeight/2 - gallery.height/2;
	
}

function addThumbListeners(thumb:MovieClip):void{
	thumb.addEventListener(MouseEvent.ROLL_OVER, onThumbOver);
	thumb.addEventListener(MouseEvent.ROLL_OUT, onThumbOut);
}

function onThumbOver(evt:MouseEvent):void {
	var thumb:MovieClip = MovieClip(evt.target);
	TweenLite.to(thumb,.5,{scaleX:1,scaleY:1,onUpdate:arrangeThumb, onUpdateParams:[thumb]});
	TweenLite.to (thumb.bg, .5, {tint: 0x000000});
}

function arrangeThumb(thumb:MovieClip):void{
	if (thumb.scaleX>.6)
		gallery.addChild(thumb);
	if(thumb.scaleX==1)
		currentPhoto.text = thumb.title;
}

function onThumbOut(evt:MouseEvent):void {
	var thumb:MovieClip = MovieClip(evt.target);
	TweenLite.to(thumb,.5,{scaleX:.5, scaleY:.5});
	TweenLite.to (thumb.bg, .5, {tint: 0x999999});
	currentPhoto.text = "";
}

loadXML("gallery.xml");
Esta dando esse erro:

 

Scene 1, Layer 'actions', Frame 1, Line 12 1120: Access of undefined property mc_ciple.
Scene 1, Layer 'actions', Frame 1, Line 12 1120: Access of undefined property SlowMo.
Scene 1, Layer 'actions', Frame 1, Line 15 1120: Access of undefined property mc_ciple.
Scene 1, Layer 'actions', Frame 1, Line 15 1180: Call to a possibly undefined method SlowMo.
Scene 1, Layer 'actions', Frame 1, Line 18 1120: Access of undefined property mc_ciple.
Scene 1, Layer 'actions', Frame 1, Line 18 1120: Access of undefined property SlowMo.
Scene 1, Layer 'actions', Frame 1, Line 21 1120: Access of undefined property mc_ciple.
Scene 1, Layer 'actions', Frame 1, Line 22 1120: Access of undefined property mc_ciple.
Scene 1, Layer 'actions', Frame 1, Line 22 1120: Access of undefined property SlowMo.

Poderiam me ajuar a arrumar o erro, pois não estou encontrando o problema.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Você fez o código >> File downloaded from www.riacodes.com

 

e não funciona?

 

 

Por favor, poste o link do arquivo original.

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.