Jump to content
Search Community

LanLing

Members
  • Posts

    22
  • Joined

  • Last visited

LanLing's Achievements

0

Reputation

  1. I declared it as a public variable outside the functions and defined slideShowTween in slideShow() like you showed, but it still throws the null error. =/ It actually thinks the slideshow image, mainMenuSlideShow, is null, since I did a trace: TweenLite.to(menuLeftSide, 0.2, {alpha:0, onComplete:sendMenuToFrameLeft, onCompleteParams:[1]}); //go to frame 10, portrait luo TweenLite.to(menuLeftSide, 0.2, {alpha:1, delay:0.2}); //slideShow(); trace(menuLeftSide.mainMenuSlideShow); However the weird thing is the slideshow image is visible on stage at this default position (the position I put it in Flash), it's just not moving.
  2. Hello, I ran into another problem with the little slideshow I'm trying to do. Thanks for everyone who helped me with this previously. I have a simple sliding animation set up in for frame 1 of a class: public function slideShow():void { menuLeftSide.mainMenuSlideShow.x = 1040; //reset slideshow position menuLeftSide.mainMenuSlideShow.cacheAsBitmap = true; menuLeftSide.menuSlideShowMask.cacheAsBitmap = true; menuLeftSide.mainMenuSlideShow.mask = menuLeftSide.menuSlideShowMask; var slideShowTween:TweenLite = TweenLite.to(menuLeftSide.mainMenuSlideShow, 70, {x:-1350, ease:Linear.easeNone, onComplete:loop}); function loop():void { slideShowTween.restart(); } } This works fine, however when I go to another frame in the same class, then come back to frame 1 with the slideshow, the slideshow won't resume anymore, because "menuLeftSide.mainMenuSlideShow" (the slideshow image) would be null. This is the code I use to go to another frame. Destination frame is completely new keyframe and completely different from frame 1. if (e.target.name == "character1Link") { //when clicking character1Link TweenLite.to(menuLeftSide, 0.2, {alpha:0, onComplete:sendMenuToFrameLeft, onCompleteParams:[10]}); //go to frame 10 TweenLite.to(menuLeftSide, 0.2, {alpha:1, delay:0.2}); } Then coming back to frame 1 and resuming slideshow: if (e.target.name == "backToMain") { when clicking backToMain link TweenLite.to(menuLeftSide, 0.2, {alpha:0, onComplete:sendMenuToFrameLeft, onCompleteParams:[1]}); //go back to frame 1 TweenLite.to(menuLeftSide, 0.2, {alpha:1, delay:0.2}); slideShow(); //<--- this returns the null error } How would I set it so that when I go back to frame 1, the slideshow would immediately exist and be ready for use for the slideShow() function? Thanks.
  3. Thank you carl. I used for(var i:int = 1; i <=100; i++){ interludeIntro["interludeBegin" + i].alpha = 0; } Then individually applied TweenLite.to for each instance since I didn't want everything to appear at once, I wanted to add a 1sec delay after each instance appear. I looked over the link your provided on shuffling arrays, but it's kind of advanced and I'm not following the logic of the code. Can that tutorial simply go over each instance of a class (the interludeBegin instances are the only instances in the interludeIntro class) and fade each instance 1sec after another? Doing it manually I had delay:1, delay:2, delay:3,... etc
  4. I have a class "interludeIntro", inside this class are tons of movieclips (each with own instance name interludeBegin1, interludeBegin2, etc). First I want to make these invisible, then use tweenlite to fade them in one by one. This is my code: public function interludeBeginning():void { interludeIntro.alpha = 0; //set the whole class invisible TweenLite.to(interludeIntro.interludeBegin1, 0.5, {alpha:1,delay:1}); TweenLite.to(interludeIntro.interludeBegin2, 0.5, {alpha:1,delay:2}); TweenLite.to(interludeIntro.interludeBegin3, 0.5, {alpha:1,delay:3}); TweenLite.to(interludeIntro.interludeBegin4, 0.5, {alpha:1,delay:4}); ... ...//for all instances, fade in one by one } However this simply makes everything permanently invisible, despite the tween attempts. This code below works, but in a very awkward/redundant/unnecessary way: public function interludeBeginning():void { var interludeArray:Array = [interludeIntro.interludeBegin1, interludeIntro.interludeBegin2, interludeIntro.interludeBegin3, interludeIntro.interludeBegin4, ........ interludeIntro.interludeBegin15]; for each (var i:MovieClip in interludeArray) { i.alpha = 0; //set everything invisible } ... ... TweenLite.to(interludeIntro.interludeBegin1, 0.5, {alpha:1,delay:1}); TweenLite.to(interludeIntro.interludeBegin2, 0.5, {alpha:1,delay:2}); TweenLite.to(interludeIntro.interludeBegin3, 0.5, {alpha:1,delay:3}); TweenLite.to(interludeIntro.interludeBegin4, 0.5, {alpha:1,delay:4}); ... ...//for all instances, fade in one by one } For some reason I gotta fade out each instance individually rather as a whole class. This is not practical because what if my class has 100 instances? Listing all of them out in an array is going to be a huge mess. Thanks.
  5. Thank you carl and GreenSock. I'm going to use killTweensOf since I need to reset the position of the slideshow anyways.
  6. Thanks for suggestion, I'll just use the TweenLite method, I think I got too much stuff going on nothing's gonna save it from lag. Hmm how do I stop this animation when I go to another page? If I use the old AS method, I can use removeeventlistener when I go to another page: menuLeftSide.mainMenuSlideShow.removeEventListener(Event.ENTER_FRAME,onEnterFrameSlide); //stop sliding picture delegate.beginStory();
  7. But BlitMask can only create a rectangular mask right? My mask is an irregular shape and I use a png for it.
  8. Thanks works great. But still the same amount of lag as using the other function... hmm probably is because I got too much stuff running at same time then.
  9. Hmm using your function for some reason the tween starts out at really fast speed then gradually slows down to a speed of 0...
  10. Yeah I get the logic but I'm not exactly sure about the code... like what is the syntax for the onComplete? This is what I have but I don't think is right: TweenLite.to(menuLeftSide.mainMenuSlideShow,5,{x:-1400, onComplete:menuLeftSide.mainMenuSlideshow.x, onCompleteParams:[1000]});
  11. I'm not sure how to add the x position checker with TweenLite, so that its x position resets to 1000 when x is <-1406. private function slideShow():void { TweenLite.to(menuLeftSide.mainMenuSlideShow,10,{x:-1400}); }
  12. Hi I was wondering if the amount of lag in TweenLite for a simple horizontal tween would be less than just using default actionscript code? I'm trying to make a horizontal banner slide slowly across the screen, then when it gets to the last bit reset the position to the starting point and continue sliding: private function slideShow():void { menuLeftSide.mainMenuSlideShow.addEventListener(Event.ENTER_FRAME,onEnterFrameSlide); function onEnterFrameSlide(e:Event):void { if (menuLeftSide.mainMenuSlideShow.x <= -1406) { //when it slides to last bit of image menuLeftSide.mainMenuSlideShow.x = 1000; //bring it all the way to the right and slide again } menuLeftSide.mainMenuSlideShow.x -= 1; //slide direction is left } } This works, however it is slightly laggy. Not extremely noticeable but I'd expect no lag for a super-simple animation like this. Does TweenLite have something like this and is it more system-efficient and less laggy?
  13. Thank you. Simple line of code "mask.cacheAsBitmap = true" did the trick.
  14. Thank you. Using a mask worked. However now I want the mask to be an irregular shape. When I import a png image to use as a mask, flash only uses the rectangular area as the mask, not the image itself. This is what I mean: The slanted oval is the mask area I want, however Flash only uses the enclosing rectangle for the mask. How do I use the oval as the mask only? Thanks.
×
×
  • Create New...