Jump to content
Search Community

jajohns8

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by jajohns8

  1. First off, great set of classes you have. I am trying to make a sequence of tweens using timeline, but I can't seem to get the onComplete function to fire. I basically want a tween that repeats infinitely, but at the end of that tween' sequence, (before the repeat) I want it to initiate another tween on another object. At first I tried to append to timeline1, but that wasn't working, so I went with onComplete. The first tween works fine, but the call to the onComplete function fails. (Maybe the fact that it repeats is messing it up?) var timeline1:TimelineMax = new TimelineMax({repeat:-1, repeatDelay:30, delay:3}); timeline1.append( new TweenMax(myText2, 2, {x:131, alpha:1, ease:Back.easeOut, repeat:-1, yoyo:true, onComplete:finTween, onCompleteParams:[360, myR], repeatDelay:10}) ); function finTween(param1:Number, param2:MovieClip):void { TweenLite.to(param2, 1, {rotation:param1, overwrite:false});; }
  2. Greensock, thanks for your help, but I am a little lost. Your explanation makes sense to me as far as the tweening on the "current" value being the problem. When you say "create it ahead of time" how would I do that? Could you give me an example of how I would do that? I tried placing "_mytween = new TweenLite(myMC, 0.25, {scaleX:1.5, scaleY:1.5});" in my constructor, but it doesnt know the myMC value so it gives me an error. Where else could I place it to create it ahead of time? Thanks for taking the time to help. my Rooms.as class file again: package { import flash.display.*; import flash.events.*; import com.abrahamyan.liquid.ToolTip; import com.greensock.*; import com.greensock.easing.*; public class Rooms extends MovieClip { private var tooltip:ToolTip=ToolTip.getInstance() var myMC:MovieClip; var priorMC:MovieClip; private var _mottween:TweenLite; private var _revtween:TweenLite; private var _mytween:TweenLite; public function Rooms( ) // constructor { addEventListener(MouseEvent.ROLL_OVER, mouseOverListener); addEventListener(MouseEvent.ROLL_OUT, mouseOutListener); addEventListener(MouseEvent.CLICK, clickListener); OverwriteManager.init() //addEventListener(Event.ENTER_FRAME,move); } // end constructor function mouseOverListener(evt:MouseEvent):void { gotoAndStop("over"); var over_name=evt.target.name; evt.target.alpha=.3; var act_type:String="over"; var icon_type:String="plant"; //ParseempData(xmlData,over_name,act_type,icon_type); //trace("mouseOverListener method Rooms class"); tooltip.followMouse=true; tooltip.fixedWidth=150; tooltip.multiLine=true; tooltip.show("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut sodales placerat ligula. Proin elementum, ante vel consectetur pharetra"); myMC=MovieClip(evt.target); //_tween = new TweenLite(evt.target, 0.25, {scaleX:1.5, scaleY:1.5, overwrite:3}); _mytween = new TweenLite(myMC, 0.25, {scaleX:1.5, scaleY:1.5}); _mytween.play(); } function clickListener(evt:MouseEvent):void { //setBlank(); myMC=MovieClip(evt.target); trace(myMC); gotoAndStop("over"); var over_name=evt.target.name; var act_type:String="click"; var icon_type:String="plant"; trace("clickListener method Rooms class"); var newValx:Number; var newValy:Number; newValx=60; newValy=95 _mottween = new TweenLite(myMC, 1, {x:newValx,y:newValy, ease:Back.easeIn}); //trace(priorMC); priorMC=myMC; trace(priorMC); } function mouseOutListener(evt:MouseEvent):void { //gotoAndStop("out"); evt.target.alpha=1; tooltip.hide(); //trace("mouseOutListener method Rooms class"); _mytween.reverse(); } } // end class } // end package
  3. Aha. I see now. That worked. Thank you. However, I have some sort of conflict that is causing the reverse function to not carry out completely in some circumstances. I have 3 rectangles (right next to each other) on stage with a baseclass = Rooms, which is what my Rooms class is for: package { import flash.display.*; import flash.events.*; import com.abrahamyan.liquid.ToolTip; import com.greensock.*; public class Rooms extends MovieClip { private var tooltip:ToolTip=ToolTip.getInstance() var myMC:MovieClip; private var _tween:TweenLite; private var _mottween:TweenLite; public function Rooms( ) // constructor { addEventListener(MouseEvent.ROLL_OVER, mouseOverListener); addEventListener(MouseEvent.ROLL_OUT, mouseOutListener); addEventListener(MouseEvent.CLICK, clickListener); //addEventListener(Event.ENTER_FRAME,move); } // end constructor function mouseOverListener(evt:MouseEvent):void { gotoAndStop("over"); var over_name=evt.target.name; evt.target.alpha=.3; var act_type:String="over"; var icon_type:String="plant"; //ParseempData(xmlData,over_name,act_type,icon_type); trace("mouseOverListener method Rooms class"); tooltip.followMouse=true; tooltip.fixedWidth=150; tooltip.multiLine=true; tooltip.show("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut sodales placerat ligula. Proin elementum, ante vel consectetur pharetra"); myMC=MovieClip(evt.target); _tween = new TweenLite(evt.target, 0.25, {scaleX:1.5, scaleY:1.5}); } function clickListener(evt:MouseEvent):void { //setBlank(); gotoAndStop("over"); var over_name=evt.target.name; var act_type:String="click"; var icon_type:String="plant"; trace("clickListener method Rooms class"); var newVal:Number; newVal=-600; _mottween = new TweenLite(evt.target, 3, {x:newVal}); } function mouseOutListener(evt:MouseEvent):void { //gotoAndStop("out"); evt.target.alpha=1; tooltip.hide(); trace("mouseOutListener method Rooms class"); _tween.reverse(); } } // end class } // end package If I rollover each rectangle several times, at various speeds, sometimes, one or more of the rectangles appears to not finish it's reverse myTween function(in the mouseOutListener function) so it stays large. I have looked into adding the overwrite manager parameter, but I have not been able to get it to work correctly. I have tried overwrite 0-5 and the issue persists. _tween = new TweenLite(evt.target, 0.25, {scaleX:1.5, scaleY:1.5, overwrite:4});
  4. FIrst off, just wanted to say thanks to the developer(s). This is an awesome set of classes. I am a beginner to the world of AS3, and am just getting my feet wet with Object Oriented Programming, so please forgive some of the newb mistakes. I KNOW this has to be a simple mistake involving my NEWBness to object oriented programming. I have been able to implement TweenLite just fine in my mouseover event (a function in a Class file called Rooms.as) without any trouble. My code, inside my mouseOverListener function, that gets the movie clip that was just rolled over and implements my TweenLite effect (increase scale) looks like this: myMC=MovieClip(evt.target); var myTween:TweenLite = new TweenLite(myMC, .5, {scaleX:3,scaleY:3}); That works great. Now, I have been trying to reverse this tween (myTween) in my mouse out listener function. Inside my mouseoutLIstener function I have: myTween.reverse(); When I try to test, I get the error:"1120:Access of undefined property myTween". So this function is not seeing that TweenLite object (called myTween) I created. I tried the following in my mouseoutlistener function, and it worked to bring the scale back to 1: var myTween:TweenLite = new TweenLite(myMC, 1, {scaleX:1,scaleY:1});//works, but creates new object The problem is, I don't want to create a new object. I want to reverse the one that was just created. I have some more complex tweens that I would like to just use the reverse() function on. I am pretty sure this comes down to me not understanding scope in OOP, but if I could get a handle on why this isnt working, it would most definitely HELP my understanding. Any help would be greatly appreciated. In case it might help, here is the entire Rooms.as class: package { import flash.display.*; import flash.events.*; import com.abrahamyan.liquid.ToolTip; import com.greensock.*; public class Rooms extends MovieClip { // var speed:int; // how fast the fish is moving private var tooltip:ToolTip=ToolTip.getInstance() var myMC:MovieClip; // var myTween:TweenLite = new TweenLite(myMC, .5, {scaleX:3,scaleY:3}); public function Rooms( ) // constructor { addEventListener(MouseEvent.MOUSE_OVER, mouseOverListener); addEventListener(MouseEvent.MOUSE_OUT, mouseOutListener); addEventListener(MouseEvent.CLICK, clickListener); //addEventListener(Event.ENTER_FRAME,move); } // end constructor function mouseOverListener(evt:MouseEvent):void { gotoAndStop("over"); var over_name=evt.target.name; evt.target.alpha=.3; var act_type:String="over"; var icon_type:String="plant"; //ParseempData(xmlData,over_name,act_type,icon_type); trace("mouseOverListener method Rooms class"); tooltip.followMouse=true; tooltip.fixedWidth=150; tooltip.multiLine=true; tooltip.show("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut sodales placerat ligula. Proin elementum, ante vel consectetur pharetra"); myMC=MovieClip(evt.target); //TweenLite.to(myMC,1, {scaleX:2,scaleY:2}); //var myTween:TweenLite = new TweenLite(myMC, .5, {scaleX:3,scaleY:3}); var myTween:TweenLite = new TweenLite(myMC, .5, {scaleX:3,scaleY:3}); } function clickListener(evt:MouseEvent):void { //setBlank(); gotoAndStop("over"); var over_name=evt.target.name; var act_type:String="click"; var icon_type:String="plant"; //ParseempData(xmlData,over_name,act_type,icon_type); trace("clickListener method Rooms class"); } function mouseOutListener(evt:MouseEvent):void { gotoAndStop("out"); evt.target.alpha=1; tooltip.hide(); trace("mouseOutListener method Rooms class"); var myTween:TweenLite = new TweenLite(myMC, 1, {scaleX:1,scaleY:1});//works, but creates new object //myTween.reverse();//doesnt work, cant find myTween } } // end class } // end package
×
×
  • Create New...