Jump to content
Search Community

LanLing

Members
  • Posts

    22
  • Joined

  • Last visited

Everything posted by LanLing

  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.
  15. I want to create a very simple slideshow of images that loops continuously when it reaches the last image, or the last section of the image, however I need to constrain the display area of the slideshow. I cannot use images above the slideshow to cover it up, because the overlay I'm using is semi-transparent, therefore the slideshow image will still peek out from underneath it. This is what I mean: So the only way I can think of is to constrain the actual display area. Does anyone know how I would do this? For the sliding, I know I can just tween it directly in Flash. However I was wondering if TweenLite/Max has some easier way of looping it, so when it gets to the max x coordinate of the image (right end of image), it will loop again from the leftmost side of the image. Thanks.
  16. Update: I figured it out! My movieclips were in a sub-class of the main class, that's why it wasn't able to access it. I just had to use the string version of the movieclip instance names like "person1mc" in the dialogue array, then in my sub-class use "this[person1mc]" to convert it into a usable movieclip instance. Thanks for your help!
  17. Thank you, I sort of get what you mean. However using this format: var textBlocks:Array = new Array( [person1mc, "conversation1"], [person2mc, "conversation2"], ... ... ); Gave a "Line 11 1120: Access of undefined property person1mc." I clearly have the movieclip "person1mc" on the stage, with class name "Person1mc". Why is it not finding it? Earlier using the label name as a string worked...
  18. You mean putting all icons on different layers and assigning each one to a class/instance? The problem is I need to assign an icon for each section of dialogue. This is how my dialogue is laid out: var textBlocks:Array = new Array( ["Person1", "speech of person 1"], ["Person2", "speech of person 2"], ["Person1", "speech of person 1"], ... ... ); "Person1" and "Person2" are frame labels that I put in each of the 4 frames in Flash, each frame has the corresponding icon. This section of the script: public function startText():void { //starting the program _currentTextBlock = _textBlocks[_currentTextBlockIndex][TEXT]; characterIcon.gotoAndStop(_textBlocks[_currentTextBlockIndex][sPEAKER]); //go to the correct character icon ... ... } will read "Person1" and "Person2" as frame labels, using "gotoAndStop" and thus display the icon and text on the correct frame. For example "gotoAndStop(Person1)" will display person1's icon. If I put all the icons on separate frames I'm not sure how I would tell flash which of the 4 icons to display.
  19. Thanks, I found the problem is that I have the tweenlite activated at the beginning of the program, which will run when I launch the swf. It should only activate upon mouse click. I was wondering if it's possible to tween to a frame, but also keep the contents of the last frame? For example, on a layer called "characterIcon", right now I'm on icon 1 (frame 1), when I mouse click it fades in/out to icon 2 (frame 2), but I want to only change opacity of icon 1 to around 50% then bring icon 2 onto the stage, not erase icon 1 completely. Is this possible? Trying to make a text dialogue system where I can still see the faded portrait of the person who last spoke. This is the relevant code I have right now: package { import flash.events.Event; import flash.events.MouseEvent; import flash.display.MovieClip; import flash.media.Sound; import com.greensock.*; import com.greensock.easing.*; import com.greensock.plugins.*; TweenPlugin.activate([FrameLabelPlugin, FramePlugin]); OverwriteManager.init(2); public class DialogueText extends MovieClip { ... ... public function startText():void { //starting the program _currentTextBlock = _textBlocks[_currentTextBlockIndex][TEXT]; characterIcon.gotoAndStop(_textBlocks[_currentTextBlockIndex][sPEAKER]); //go to the correct character icon addEventListener(Event.ENTER_FRAME, updateText); addEventListener(MouseEvent.CLICK, fillText); } ... ... private function nextTextBlock(e:MouseEvent):void { //advances to correct text and portrait upon mouse click characterIcon.stop(); removeEventListener(MouseEvent.CLICK, nextTextBlock); txt.text = ""; // clear the text _currentTextBlockIndex++; _currentTextBlock = _textBlocks[_currentTextBlockIndex][TEXT]; // set the text TweenLite.to(characterIcon, 0.5, {alpha:0, onComplete:characterIcon.gotoAndStop, onCompleteParams:[_textBlocks[_currentTextBlockIndex][sPEAKER]]}); //fades out the last char portrait TweenLite.to(characterIcon, 0.5, {alpha:1, delay:0.5}); //fades in new portrait addEventListener(Event.ENTER_FRAME, updateText); // start updating the text addEventListener(MouseEvent.CLICK, fillText); } } }
  20. Thank you! That worked perfectly. Just a very minor problem, when I first test the movie it first shows a certain frame for around half a second then immediately fade to the correct frame. I've tried the "characterIcon.stop()" you wrote, "characterIcon.gotoAndStop(1)", neither works. Do you know what might be causing this? Is it on the code side or the flash side?
  21. Does anyone know if it's possible to fade in/out to another frame of a layer? For example I have a file called Project.fla, inside it there is a Text class, inside the Text class there is an Icons class, then inside the Icons class there are 4 frames (representing 4 icons). If I currently have icon 1 (frame 1) on the stage, how would I fade out this icon then fade in let's say icon 3 (frame 3)? Thanks.
×
×
  • Create New...