Jump to content
Search Community

beno

Members
  • Posts

    78
  • Joined

  • Last visited

Everything posted by beno

  1. beno

    Reverse Tween

    The following code kinda works: public function myLeftHand():void { leftHand = new Hand(); leftHand.x = head.x - 30; leftHand.y = head.y + 50; addChild(leftHand); // leftHand.addEventListener(Event.ENTER_FRAME, checkFrame); // TweenMax.fromTo(leftHand, leftHand.totalFrames - 1, {frame:leftHand.totalFrames}, {frame:1}); TweenMax.fromTo(leftHand, leftHand.totalFrames - 1, {frame:leftHand.totalFrames}, {frame:1}); } The problem is that it's "time-delayed"...what should take one frame takes 5 or 10 and the whole thing goes in slow motion. How do I trouble-shoot this? TIA, beno
  2. beno

    Reverse Tween

    Where should I put this line? TweenMax.fromTo(leftHand, leftHand.totalFrames - 1, {frame:leftHand.totalFrames}, {frame:1}); //Place left hand on stage and fade in public function myLeftHand():void { leftHand = new Hand(); leftHand.x = head.x - 30; leftHand.y = head.y + 50; addChild(leftHand); leftHand.addEventListener(Event.ENTER_FRAME, checkFrame); } //check the hands and stop when they reach the 40 frame public function checkFrame(e:Event):void { if (e.target.currentFrame == 20) { e.target.removeEventListener(Event.ENTER_FRAME, checkFrame); // leftHand.gotoAndStop(leftHand.totalFrames); // TweenMax.to(leftHand, leftHand.totalFrames-1, {frame:1, useFrames:true, ease:Linear.easeNone}); } } When I put it in either the function leftHand plays all the way through, then the reverse plays one frame every 20 frames. Since I don't want the forward movie at all, I'd think I'd just eliminate the leftHand function, but if I do that then of course I can't call it at all. Please advise. TIA, beno
  3. Hi; You kindly provided me the following code: //check the hands and stop when they reach the 40 frame public function checkFrame(e:Event):void { if (e.target.currentFrame == 20) { e.target.removeEventListener(Event.ENTER_FRAME, checkFrame); leftHand.gotoAndStop(leftHand.totalFrames); TweenMax.to(leftHand, leftHand.totalFrames-1, {frame:1, useFrames:true, ease:Linear.easeNone}); } } However, what I would like to do is not have the forward motion at all. I want nothing but the reverse motion. I have been unsuccessful in my attempts to create this. Can you show me how? TIA, beno
  4. Absolutely no offense taken whatsoever, and thank you. Frankly, this is typical of the mistakes I make. I'm not well suited for programming because I'm primarily an artist...I think out of the right hemisphere. On the book, a list member said he's bought and is sending me one. Computer time for me is also a premium until I buy my Mac in a few weeks. However, once I finish this mammoth shopping cart I'm writing in Python, I'll be devoting almost all my computer time to Flash either in studying or working on my projects until I get this last brush fire put out. I muddled through Python and am actually now pretty decent as a programmer in the same. I'll muddle through Flash too, books and all And eventually it will stick beno
  5. Hi; No zip s/w on this computer at the internet cafe. Light file, but couldn't upload through your form. Please go here: http://angrynates.com/cart/main.fla http://angrynates.com/cart/Main.as TIA, beno
  6. Criticism well taken. I have done the best I can below. I have probably left in too many import statements, but I don't think that will make any difference. I have left in a few commented-out lines that maybe should be uncommented, I don't know. The script runs without errors, but doesn't reverse. Please advise. beno package { import flash.events.Event; import flash.events.ProgressEvent; import flash.events.Event; import flash.events.MouseEvent; import flash.display.MovieClip; import com.greensock.*; import com.greensock.easing.*; public class Main extends MovieClip { //Import Library Assests public var leftHand:Hand; public function Main() { init(); } public function init():void { myLeftHand(); } //Place left hand on stage and fade in public function myLeftHand():void { leftHand = new Hand(); leftHand.x = 300; leftHand.y = 100; addChild(leftHand); leftHand.addEventListener(Event.ENTER_FRAME, checkFrame); } //check the hands and stop when they reach the 40 frame public function checkFrame(e:Event):void { if (e.target.currentFrame == 40) { // e.target.stop(); // trace("hand is done tweening"); // e.target.removeEventListener(Event.ENTER_FRAME, checkFrame); var myTween:TweenMax = new TweenMax(leftHand, 2, {x:400}); leftHand.gotoAndStop(leftHand.totalFrames); TweenMax.to(leftHand, leftHand.totalFrames-1, {frame:1, useFrames:true, ease:Linear.easeNone}); myTween.totalProgress = 1; myTween.reverse(); } } } }
  7. Following your previous good advice, I chopped down this file to only the pertinent: package { import flash.net.URLRequest; import flash.display.Loader; import flash.events.Event; import flash.events.ProgressEvent; import flash.events.Event; import flash.events.MouseEvent; import flash.display.MovieClip; import com.greensock.*; import com.greensock.easing.*; public class Main extends MovieClip { //Import Library Assests public var leftHand:Hand; public function Main() { init(); } public function init():void { myLeftHand(); } //Place left hand on stage and fade in public function myLeftHand():void { leftHand = new Hand(); leftHand.x = 200; leftHand.y = 200; addChild(leftHand); leftHand.addEventListener(Event.ENTER_FRAME, checkFrame); TweenMax.from(leftHand, 2, {x:420}); } //check the hands and stop when they reach the 40 frame public function checkFrame(e:Event):void { if (e.target.currentFrame == 40) { e.target.stop(); trace("hand is done tweening"); e.target.removeEventListener(Event.ENTER_FRAME, checkFrame); // TweenMax.from(leftHand, 2, {x:200}); var myTween:TweenMax = new TweenMax(leftHand, 2, {x:400}); leftHand.gotoAndStop(leftHand.totalFrames); TweenMax.to(leftHand, leftHand.totalFrames-1, {frame:1, useFrames:true, ease:Linear.easeNone}); myTween.totalProgress = 1; myTween.reverse(); } } } } Unfortunately, the code you supplied me does not seem to do anything noticeable. leftHand proceeds forward; it does not reverse. What have I missed? TIA, beno
  8. Yes. I didn't notice until now that there was a second page! I don't want to tween x. I want to reverse shape tween. Impossible? beno
  9. This is strange, but I see greensock has updated this thread, but I don't see the update!! Also, re-reading your last post, I evidently didn't notice your last paragraph. Yes, that's an excellent suggestion. The code I supplied in my last post works with a change to the reference to "head" (which is just used for positioning), but it still produces the same effect. I look forward to your comments. beno
  10. The following code makes the hand slide along the x axis a bit (which I've tried to limit and would like to eliminate). It doesn't make it reverse the actual mc. The mc is a shape tween not a motion tween. package { import flash.net.URLRequest; import flash.display.Loader; import flash.events.Event; import flash.events.ProgressEvent; import flash.events.Event; import flash.events.MouseEvent; import flash.display.MovieClip; import com.greensock.*; import com.greensock.easing.*; public class Main extends MovieClip { //Import Library Assests public var leftHand:Hand; public function Main() { init(); } public function init():void { myLeftHand(); } //Place left hand on stage and fade in public function myLeftHand():void { leftHand = new Hand(); leftHand.x = head.x - 20; leftHand.y = head.y + 50; addChild(leftHand); TweenMax.from(leftHand, 2, {x:420}); } } } Please advise. TIA. beno
  11. Well, I'm new to all this and used some code someone graciously supplied me. I changed the offending import lines to the lines I actually originally had, which you also suggested, that of import com.greenstock.* and the other import accordingly. I downloaded that edition of greensock last month. However, it didn't give me any better results. If I can tag on a second question, I also have this line: TweenMax.to(myPic, 1, {shortRotation:{rotation:60}}); However, in addition to tweening the rotation, I would also like to move it from one (x,y) to another. Should I have two different TweenMax.to() lines, or should I combine it in one, and how would it look? Here again is the revised code: package { import LightExplosion; import flash.events.Event; import flash.events.MouseEvent; import flash.display.MovieClip; import com.greensock.*; import com.greensock.easing.*; public class Main extends MovieClip { //Import Library Assests public var head:HatAndFace; public var leftEye:Eyeball; public var rightEye:Eyeball; public var leftHand:Hand; public var rightHand:Hand; public var myPic:pic; public function Main() { init(); } public function init():void { hatAndFace(); eyeball1(); eyeball2(); myRightHand(); myLeftHand(); thePic(); } //Place Head and Hat on stage and fade in public function hatAndFace():void { head = new HatAndFace(); head.x = stage.stageWidth/2; head.y = stage.stageHeight/4; head.alpha = 0; addChild(head); TweenLite.to(head, 2, {autoAlpha:1}); } //Place left eye on stage and fade in public function eyeball1():void { leftEye = new Eyeball(); leftEye.x = head.x - 30; leftEye.y = head.y + 15; leftEye.alpha = 0; addChild(leftEye); TweenLite.to(leftEye, 2, {autoAlpha:1}); } //Place right eye on stage and fade in public function eyeball2():void { rightEye = new Eyeball(); rightEye.x = head.x + 30; rightEye.y = head.y + 15; rightEye.alpha = 0; addChild(rightEye); TweenLite.to(rightEye, 2, {autoAlpha:1}); } //Place right hand on stage and fade in public function myRightHand():void { rightHand = new Hand(); rightHand.x = head.x + 420; rightHand.y = head.y + 100; rightHand.alpha = 0; addChild(rightHand); rightHand.addEventListener(Event.ENTER_FRAME, checkFrame); TweenLite.to(rightHand, 2, {autoAlpha:1}); } //Place left hand on stage and fade in public function myLeftHand():void { leftHand = new Hand(); leftHand.x = head.x - 20; leftHand.y = head.y + 100; leftHand.alpha = 0; addChild(leftHand); leftHand.addEventListener(Event.ENTER_FRAME, checkFrame); TweenLite.to(leftHand, 2, {autoAlpha:1}); } //check the hands and stop when they reach the 40 frame public function checkFrame(e:Event):void { if (e.target.currentFrame == 40) { e.target.stop(); trace("hand is done tweening"); e.target.removeEventListener(Event.ENTER_FRAME, checkFrame); } if (e.target.currentFrame == 40) { // TweenMax.from(leftHand, 2, {x:200}); var myTween:TweenMax = new TweenMax(leftHand, 2, {x:200}); myTween.totalProgress = 1; myTween.reverse(); //TweenMax.to(leftHand, 2, {x:200, startAt:{totalProgress:1}}).reverse(); } } public function thePic():void { myPic = new pic(); myPic.x = stage.stageWidth/4 + 20; myPic.y = stage.stageHeight/1.5 - 10; addChild(myPic); TweenMax.to(myPic, 1, {shortRotation:{rotation:60}}); } } } TIA, beno
  12. Neither one of those suggestions worked which makes me suspect a more fundamental problem. Here is my complete code: package { import LightExplosion; import flash.events.Event; import flash.events.MouseEvent; import flash.display.MovieClip; import gs.*; import gs.TweenMax; import gs.easing.*; public class Main extends MovieClip { //Import Library Assests public var head:HatAndFace; public var leftEye:Eyeball; public var rightEye:Eyeball; public var leftHand:Hand; public var rightHand:Hand; public function Main() { init(); } public function init():void { hatAndFace(); eyeball1(); eyeball2(); myRightHand(); myLeftHand(); } //Place Head and Hat on stage and fade in public function hatAndFace():void { head = new HatAndFace(); head.x = stage.stageWidth/2; head.y = stage.stageHeight/2; head.alpha = 0; addChild(head); TweenLite.to(head, 2, {autoAlpha:1}); } //Place left eye on stage and fade in public function eyeball1():void { leftEye = new Eyeball(); leftEye.x = head.x - 30; leftEye.y = head.y; leftEye.alpha = 0; addChild(leftEye); TweenLite.to(leftEye, 2, {autoAlpha:1}); } //Place right eye on stage and fade in public function eyeball2():void { rightEye = new Eyeball(); rightEye.x = head.x + 30; rightEye.y = head.y; rightEye.alpha = 0; addChild(rightEye); TweenLite.to(rightEye, 2, {autoAlpha:1}); } //Place right hand on stage and fade in public function myRightHand():void { rightHand = new Hand(); rightHand.x = head.x + 100; rightHand.y = head.y + 100; rightHand.alpha = 0; addChild(rightHand); rightHand.addEventListener(Event.ENTER_FRAME, checkFrame); TweenLite.to(rightHand, 2, {autoAlpha:1}); } //Place left hand on stage and fade in public function myLeftHand():void { leftHand = new Hand(); leftHand.x = head.x - 100; leftHand.y = head.y + 100; leftHand.alpha = 0; addChild(leftHand); leftHand.addEventListener(Event.ENTER_FRAME, checkFrame); TweenLite.to(leftHand, 2, {autoAlpha:1}); } //check the hands and stop when they reach the 40 frame public function checkFrame(e:Event):void { if (e.target.currentFrame == 40) { e.target.stop(); trace("hand is done tweening"); e.target.removeEventListener(Event.ENTER_FRAME, checkFrame); } if (e.target.currentFrame == 40) { TweenMax.from(leftHand, 2, {x:200}); // var myTween:TweenMax = new TweenMax(leftHand, 2, {x:200}); // myTween.totalProgress = 1; // myTween.reverse(); //TweenMax.to(leftHand, 2, {x:200, startAt:{totalProgress:1}}).reverse(); } } } } The uncommented suggestion did nothing at all; that is, leftHand played the exact same as rightHand with no reverse. When I tried the commented out solution, Flash complained about a possibly undefined property of "totalProgress". Please advise. TIA, beno
  13. Hi; I have the following line of code: TweenMax.to(leftHand, 2, {x:200, startAt:{totalProgress:1}}).reverse(); The Flash movie plays, no errors are thrown, however it doesn't play in reverse. As you can tell, I want the mc to go to the end of the clip and play in reverse. Please advise. TIA, beno
  14. Never mind. I figured this out: public function myLeftHand(e:Event=null):void { var mcHandInstance2:mcHand = new mcHand(); addChild(mcHandInstance2); mcHandInstance2.x = 800; mcHandInstance2.y = 200; if (e.target.currentFrame == 20) TweenMax.to(mcHandInstance2, 2, {x:200, startAt:{totalProgress:1}}).reverse(); } Doesn't look pretty so still needs tweaking, but it does work! beno
  15. Here is my latest incarnation: public function myLeftHand(e:Event=null):void { if (this.currentFrame == 20) { var mcHandInstance2:mcHand = new mcHand(); addChild(mcHandInstance2); mcHandInstance2.x = 800; mcHandInstance2.y = 200; TweenMax.to(mcHandInstance2, 2, {x:200, startAt:{totalProgress:1}}).reverse(); } This doesn't throw any errors, but it doesn't print the hand mc to screen, either. Please point me in the right direction. TIA, beno
  16. Hi; I'm really green and AS3/GS ain't easy. I'm trying to do a reverse setting totalProgress to 1 so that I can simply play the mc in reverse from the outset. Here's the abbreviated code: package { import flash.display.MovieClip; import com.greensock.*; import com.greensock.plugins.*; import com.greensock.easing.*; public class Main extends MovieClip { public function Main():void { } public function init():void { leftHand(); } public function set totalProgress(value:Number):void { leftHand.value = 1; } public function leftHand():void { var mcHandInstance2:mcHand = new mcHand(); addChild(mcHandInstance2); mcHandInstance2.x = 800; mcHandInstance2.y = 200; TweenMax.reversed = true; } } which throws the following errors: 1119: Access of possibly undefined property value through a reference with static type Function. leftHand.value = 1; 1119: Access of possibly undefined property reversed through a reference with static type Class. TweenMax.reversed = true; Appreciate any help you can offer. TIA, beno
  17. But mcHatAndFace isn't an empty movie clip! I defined it in the Flash GUI with graphics. Can't I somehow link that movie clip to the script? beno
  18. I'm a newbie. I thought I did that by addChild(mcHatAndFace). Please be so kind as to advise. TIA, beno
  19. Hi; Please tell me why this alpha tween isn't showing up: package { import flash.display.MovieClip; import com.greensock.*; import com.greensock.plugins.*; import com.greensock.easing.*; public class Main extends MovieClip { private var mcHatAndFace:MovieClip; public function Main():void { TweenPlugin.activate([AutoAlphaPlugin]); mcHatAndFace = new MovieClip(); mcHatAndFace.x = 100; mcHatAndFace.y = 100; mcHatAndFace.alpha = 0; addChild(mcHatAndFace); TweenLite.to(mcHatAndFace, 1, {autoAlpha:1}); // 2nd param in seconds; 3rd in % alpha } } } TIA, beno
  20. Boy, I don't understand this < Here's my latest failed attempt. Clearly I'm missing how to integrate "Main". Please advise. import flash.display.MovieClip; import com.greensock.*; import com.greensock.plugins.*; import com.greensock.easing.*; TweenPlugin.activate([AutoAlphaPlugin]); public class Main extends MovieClip { private var mcHatAndFace:MovieClip; public function Main():void { mcHatAndFace = new LibraryItem(); mcHatAndFace.x = 100; mcHatAndFace.y = 100; mcHatAndFace.alpha = 0; addChild(mcHatAndFace); } } TweenLite.to(mcHatAndFace, 1, {autoAlpha:1}); // 2nd param in seconds; 3rd in % alpha TIA, beno
  21. Right. Great. So can somebody please tell me how to make this mc that is in my library appear on the stage with alpha fade-in? import com.greensock.*; import com.greensock.plugins.*; import com.greensock.easing.*; TweenPlugin.activate([AutoAlphaPlugin]); var mcHatAndFace:MovieClip = new MovieClip(); mcHatAndFace.x = 100; mcHatAndFace.y = 100; mcHatAndFace.alpha = 0; stage.addChild(mcHatAndFace); TweenLite.to(mcHatAndFace, 1, {autoAlpha:1}); Please? TIA, beno
  22. I'm sorry. I don't understand. (I'm new.) If I drag the mc to the stage, it shows the graphics captured in the mc. Therefore, it appears to me there is something in the mc. Please advise. beno
  23. Hi; I'm new to Flash/GreenSock but not to programming. Please tell me what's wrong with the following: import com.greensock.*; import com.greensock.plugins.*; import com.greensock.easing.*; TweenPlugin.activate([AutoAlphaPlugin]); var mcHatAndFace:MovieClip = new MovieClip(); mcHatAndFace.x = 100; mcHatAndFace.y = 100; mcHatAndFace.alpha = 0; stage.addChild(mcHatAndFace); TweenLite.to(mcHatAndFace, 1, {autoAlpha:1}); // 2nd param in seconds; 3rd in % alpha It never shows up on stage. TIA, beno
×
×
  • Create New...