Jump to content
Search Community

trying to play and reverse

chefkeifer test
Moderator Tag

Recommended Posts

I am trying to play and animation and reverse on roll over and roll out and i keep getting this error. never seen this one before. its not really telling "ME" anything.

 

TypeError: Error #1123: Filter operator not supported on type com.greensock.TimelineMax.
at adLeft_fla::braggingBoard_13/frame1()

 

Code

import com.greensock.*; 
import com.greensock.plugins.*;
import com.greensock.easing.*;
//*****====================================================*****
image1.rotationZ = 10;
image2.rotationZ = -10;
image3.rotationZ = 20;
image4.rotationZ = -20;
//*****====================================================*****
image1.buttonMode = true;
image1.addEventListener(MouseEvent.ROLL_OVER, over);
image1.addEventListener(MouseEvent.ROLL_OVER, out);
//-----------------------------------------------
image2.buttonMode = true;
image2.addEventListener(MouseEvent.ROLL_OVER, over);
image2.addEventListener(MouseEvent.ROLL_OVER, out);
//-----------------------------------------------
image3.buttonMode = true;
image3.addEventListener(MouseEvent.ROLL_OVER, over);
image3.addEventListener(MouseEvent.ROLL_OVER, out);
//-----------------------------------------------
image4.buttonMode = true;
image4.addEventListener(MouseEvent.ROLL_OVER, over);
image4.addEventListener(MouseEvent.ROLL_OVER, out);
//-----------------------------------------------
//*****====================================================*****
var images:Array = [image1, image2, image3, image4];
var imagesOver:TimelineMax = new TimelineMax({paused:true});
imagesOver.(TweenMax.to(images, 1, {rotationZ:0, scaleX:2, scaleY:2, x:-2.5, y:-1}));
//*****====================================================*****
// BUTTON OVER FUNCTION
function over(event:MouseEvent){//MAIN BUTTONS
		imagesOver.play();
		}
//------------------------------------------------
//BUTTON OUT FUNCTION
function out(event:MouseEvent){//MAIN BUTTONS
		imagesOver.reverse();
		}
//*****====================================================*****

Link to comment
Share on other sites

Incorrect Syntax:

imagesOver.(TweenMax.to(images, 1, {rotationZ:0, scaleX:2, scaleY:2, x:-2.5, y:-1}));

 

Since you're tweening an array you must use "allTo", in addition to adding it to the timeline.

imagesOver.appendMultiple(TweenMax.allTo(images, 1, {rotationZ:0, scaleX:2, scaleY:2, x:-2.5, y:-1}));

Link to comment
Share on other sites

I am trying to get it where if you mouse over image1 then it come to the front. right now when you mouse over any of the images all of them come to the front and only shows the one photo on top.

 

how do i get it to have whatever image i mouse over be the only the only that plays and reverses..do i need to go another route for this to happen..

 

   import com.greensock.*;
   import com.greensock.plugins.*;
   import com.greensock.easing.*;
   //*****====================================================*****
   image1.rotationZ = 10;
   image2.rotationZ = -10;
   image3.rotationZ = 20;
   image4.rotationZ = -20;
   //*****====================================================*****
   image1.buttonMode = true;
   image1.addEventListener(MouseEvent.ROLL_OVER, over);
   image1.addEventListener(MouseEvent.ROLL_OUT, out);
   //-----------------------------------------------
   image2.buttonMode = true;
   image2.addEventListener(MouseEvent.ROLL_OVER, over);
   image2.addEventListener(MouseEvent.ROLL_OUT, out);
   //-----------------------------------------------
   image3.buttonMode = true;
   image3.addEventListener(MouseEvent.ROLL_OVER, over);
   image3.addEventListener(MouseEvent.ROLL_OUT, out);
   //-----------------------------------------------
   image4.buttonMode = true;
   image4.addEventListener(MouseEvent.ROLL_OVER, over);
   image4.addEventListener(MouseEvent.ROLL_OUT, out);
   //-----------------------------------------------
   //*****====================================================*****
   var images:Array = [image1, image2, image3, image4];
   var imagesOver:TimelineMax = new TimelineMax({paused:true});
       imagesOver.appendMultiple(TweenMax.allTo(images.event.currentTarget, 1, {rotationZ:0, scaleX:2, scaleY:2, x:-2.5, y:-1}));
   //*****====================================================*****
   // BUTTON OVER FUNCTION
   function over(event:MouseEvent){//MAIN BUTTONS
            imagesOver.play();
            }
   //------------------------------------------------
   //BUTTON OUT FUNCTION
   function out(event:MouseEvent){//MAIN BUTTONS
            imagesOver.reverse();
            }
   //*****====================================================*****

Link to comment
Share on other sites

Why not simplify it to something like:

 

import com.greensock.*;
import com.greensock.plugins.*;
import com.greensock.easing.*;

image1.rotationZ = 10;
image2.rotationZ = -10;
image3.rotationZ = 20;
image4.rotationZ = -20;

var images:Array = [image1, image2, image3, image4];
var activeTween:TweenLite;

for (var i:int = 0; i 	images[i].buttonMode = true;
images[i].addEventListener(MouseEvent.ROLL_OVER, over);
images[i].addEventListener(MouseEvent.ROLL_OUT, out);
}

function over(event:MouseEvent):void {
activeTween = new TweenLite(event.currentTarget, 1, {rotationZ:0, scaleX:2, scaleY:2, x:-2.5, y:-1});
}

function out(event:MouseEvent):void {
activeTween.reverse();
}

Link to comment
Share on other sites

I tried using this code what am i doing wrong

 

function over(event:MouseEvent):void {
      activeTween = new TweenLite(event.currentTarget, .25, {rotationZ:0, scaleX:2, scaleY:2, x:-2.5, y:-1});
   setChildIndex(event.currentTarget,numChildren - 1);
   }

Link to comment
Share on other sites

I'm not sure how you set up your file (is that function in the event.currentTarget's parent?), but if that code isn't working, you could try:

 

event.currentTarget.parent.setChildIndex(event.currentTarget, event.currentTarget.parent.numChildren - 1);

 

You could also try using event.target instead of event.currentTarget.

 

It's always best to upload an example FLA that demonstrates the issue if you're still running into trouble (don't forget to zip it first).

Link to comment
Share on other sites

event.currentTarget.parent.setChildIndex(event.currentTarget, event.currentTarget.parent.numChildren - 1);

worked great thanks...

 

the setChildIndex is new to me...is there a way to do that within a tween? or you do have to do it like this?

 

function over(event:MouseEvent):void {
      activeTween = new TweenLite(event.currentTarget, .25, {rotationZ:0, scaleX:2, scaleY:2, x:-2.5, y:-1});
   event.currentTarget.parent.setChildIndex(event.currentTarget, event.currentTarget.parent.numChildren - 1);
   }

Link to comment
Share on other sites

I meant by within a tween. something like this

 

not that this really applies to this situation but for maybe something else..

 

function over(event:MouseEvent):void {
      activeTween = new TweenLite(event.currentTarget, .25, {rotationZ:0, scaleX:2, scaleY:2, x:-2.5, y:-1, event.currentTarget.setChildIndex.numChildren -1});
   }

Link to comment
Share on other sites

Yep, like I said, and onStart would handle it for you.

 

activeTween = new TweenLite(event.currentTarget, .25, {x:100, onStart:event.currentTarget.parent.setChildIndex, onStartParams:[event.currentTarget, event.currentTarget.parent.numChildren - 1]});

 

The only challenge with that is if there are other children added between the time that code runs and when the tween starts, the index may not be what you want/need. I'd recommend doing more like:

 

activeTween = new TweenLite(event.currentTarget, .25, {x:100, onStart:pushToTop, onStartParams:[event.currentTarget]});
function pushToTop(mc:DisplayObject):void {
   mc.parent.setChildIndex(mc, mc.parent.numChildren);
}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...