Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

Carl last won the day on April 4 2019

Carl had the most liked content!

Carl

Moderators
  • Posts

    9,152
  • Joined

  • Last visited

  • Days Won

    532

Everything posted by Carl

  1. all tweens have a default ease of Quad.easeOut to have no easing use import com.greensock.easing.Linear TweenMax.to(timer_mc, 60, {shortRotation:{rotation:-360, ease:Linear.easeNone}});
  2. i looked at your swf. very cool. glad you got it working! looks like a lot of fun.
  3. try using ROLL_OVER instead of MOUSE_OVER and ROLL_OUT instead of MOUSE_OUT MOUSE_OVER AND MOUSE_OUT WILL fire from every child object of btnMcText and I imagine you have some stuff in their that isn't the parent of cover1. MOUSE_OVER AND MOUSE_OUT work for my example because my file is built in such a way that all the movie clips are in the same container and they all have the same structure. I'm also setting mouseChildren = false which prevents sub-clips from firing erroneous events. if you are just targeting one button at a time use the eventListeners mentioned above and it won't be an issue. Carl
  4. this is what i would do make sure your textfield is called message_txt and you are embedding fonts import com.greensock.*; var words:Array=["this","is","what","i","would","do"]; var count:Number=0; function showText() { if (count message_txt.alpha=0; TweenMax.to(message_txt, 2, {alpha:1, onComplete:showText}); message_txt.text=words[count]; count++; } else { trace("no more words"); } } showText();
  5. from looking at your code, I would suggest not nesting updateTotal inside updatePrices. might just be a scope issue. which line is throwing the error> the tween or the trace?
  6. yes, you can tween a dynamic Textfield the same way you would tween a MovieClip. you should have no problem re-using your textfield for multiple messages and blurring them.
  7. that means you are trying to reference or control something that doesn't exist. most of the time it is because you either don't have an instance name on a symbol, or you have a typo in a name in your code.
  8. no problem X10. I will admit that the thought of flash always doing something at 30fps regardless of how small does make my brain think it is a lot of work. in reality though any computer at idle is probably running dozens of processes and performing 1000s of calculations constantly. its hard to fathom how 3d games are rendering thousands of polygons a second and so forth. In the olden days enterframe events were considered sort of taboo if not dangerous. That had a lot to do with the capabilities of the flash player... and still does to some extent. Things are much better. I also understand your concern when dealing with a persistant app that may be running for days and months. Flash has a reputation for memory leaks and such. Flash has come a long way though and is powering multi-story high displays in times square nyc around the clock. http://blogs.adobe.com/lifeasanse/2007/ ... lboar.html I've also learned to accept that Jack doesn't sling any nonsense, even if I don't immediately understand it:) GreenSock has been optimized to the nth degree and battle tested excessively. I'm quite sure you are going to be just fine.
  9. ok, now I got it. when you do trace("out"); tlOut=new TimelineMax; tlOut.append(TweenMax.delayedCall(1,hide)); return tlOut; } the tlOut timline's duration is only as long as the amount of time in the delayed call.... what the hide function returns has no immediate effect on the duration of the tlOut timeline and thus no effect on the duration of the parent tal timeline. so that's why animateIn happens directly after animateOut and your show / hides get overwritten when using delays of 0. it actually makes perfect sense as the hide function isn't called until 1 second AFTER the tlOut timeline starts playing so if hide returns a tween that is 4 seconds long it has no effect on offsetting the appends you to do with animateOut and animate in check out the code below import com.greensock.*; import com.greensock.core.TweenCore; var tlIn:TimelineMax=new TimelineMax; var tlOut:TimelineMax=new TimelineMax; function show():void { trace("show"); tlIn.append(TweenMax.to(mc,4,{autoAlpha:1})); } function hide():void { trace("hide"); tlOut.append(TweenMax.to(mc,4,{autoAlpha:0})); } function animateIn():TweenCore { trace("in"); tlIn=new TimelineMax; tlIn.append(TweenMax.delayedCall(1,show)); return tlIn; } function animateOut():TweenCore { trace("out"); tlOut=new TimelineMax; tlOut.append(TweenMax.delayedCall(1,hide)); return tlOut; } stage.addEventListener(MouseEvent.CLICK, onClick); function onClick(event:MouseEvent):void { trace("CLICK"); var tal:TimelineMax=new TimelineMax tal.append(animateOut()); trace("tal " + tal.duration); tal.append(animateIn()); trace("tal " + tal.duration); } note the show and hide tweens are both 4 seconds long. the delayed calls are both 1 second long. output: CLICK out tal 1 //THIS IS THE DURATION OF THE DELAYED CALL in tlOut that is returned by animateOut(); in tal 2 ///THIS IS THE DURATION OF THE PREVIOUS DELAYED CALL PLUS THE DELAYED CALL in tlInthat is returned by animateIn(); //when the above code runs, the hide and show functions have not yet been called, thus their duration of 4 seconds is not accounted for:) hide show hopefully this makes some sense. thanks for the opportunity to challenge myself. this was a good one.
  10. i'll admit I don't totally understand why you are doing it this way , as it seems a bit circuitous to be jamming 0 duration delayed function calls into timelinelines that return timelines and such. That doesn't mean its necessarily wrong or anything. i'm no genius. you don't have to explain it to me, you could have a very sound reason. I did find your problem interesting though as I wondered why it wasn't working. Here is what I found. I believe the crux of the problem is that using delayed call with 0 duration prevents the parent timeline from accurately gauging its duration and thus both appends happen at the same time. The first thing I did was load up a bunch of traces and set your delayedCalls to 1 instead of 0 and everything worked as expected: import com.greensock.*; import com.greensock.core.TweenCore; var tlIn:TimelineMax=new TimelineMax; var tlOut:TimelineMax=new TimelineMax; function show():void { tlIn.append(TweenMax.to(mc,1,{autoAlpha:1})); } function hide():void { trace("hide"); tlOut.append(TweenMax.to(mc,1,{autoAlpha:0})); } function animateIn():TweenCore { trace("in"); tlIn=new TimelineMax; //CHANGED DELAY TO 1 tlIn.append(TweenMax.delayedCall(1,show)); return tlIn; } function animateOut():TweenCore { trace("out"); tlOut=new TimelineMax; //CHANGED DELAY TO 1 tlOut.append(TweenMax.delayedCall(1,hide)); return tlOut; } stage.addEventListener(MouseEvent.CLICK, onClick); function onClick(event:MouseEvent):void { trace("CLICK"); var tal:TimelineMax=new TimelineMax //added traces of the timeline's duration tal.append(animateOut()); trace("tal " + tal.duration); tal.append(animateIn()); trace("tal " + tal.duration); } this code works and outputs: ---------- CLICK out tal 1 //duration after append(animateOut); in tal 2 //duration after append(animateIn); hide show ---------- so that output proves that a) the functions are all firing and in the right sequence the tal timeline is accurately having it's duration adjusted when new timelines are appended Now, if we change the delays back to 0 we this output ---------- CLICK out tal 0 in tal 0 hide show -------- notice the main timeline tal never knows how long those tweens are, or it has the same 0 duration for both appends. so in essence both hide and show are running at the same time. it still doesn't make perfect sense to me, but hopefully this helps you or someone else figure out what you need to do instead of using delayedCall(0, something).
  11. bitmap alpha and filter tweens are among the most processor intensive tasks for flash. this is not a limitation of the greensock platform. although "quite large" and "stage dimensions" are pretty vague, yes I imagine that is the problem. for small images like 640x480 no problem. I did a test with 1600x1200 and it definitely pulsed / flickered for me too. removing the blur made the playback much smoother.
  12. aldipower, if you are still concerned that ENTER_FRAME events naturally being fired by flash are having a negative impact on the performance of your app you can chose to code you app in a way that lowers the frame rate when it is inactive / idle: http://www.gotoandlearn.com/play.php?id=112 Jack, thanks for the clear explanation on all this. From my experience too, an ENTER_FRAME listener that does virtually nothing isn't going to stress an application.
  13. according to my test, yes, you only need an update on the second tween try this if you aren't sure: TweenLite.to(mcA, 1, {width:100, onUpdate:adjustMcA}); TweenLite.to(mcB, 1, {width:100, onUpdate:adjustMcB}); function adjustMcA(){ trace("adjustMcA " + mcA.width + " / " + mcB.width); } function adjustMcB(){ trace("adjustMcB " + mcA.width + " / " + mcB.width + "\n"); } you will get the following output adjustMcA 154.35 / 250 adjustMcB 154.35 / 154.35 adjustMcA 151.85 / 154.35 adjustMcB 151.85 / 151.85 adjustMcA 150.3 / 151.85 adjustMcB 150.3 / 150.3 adjustMcA 147.55 / 150.3 adjustMcB 147.55 / 147.55 adjustMcA 144.75 / 147.55 adjustMcB 144.75 / 144.7 adjustMcA 142.1 / 144.7 adjustMcB 142.1 / 142.15 you will see that a: adjustMcB always runs after adjustMcA b: when adjustMcB runs, its value for mcA's width is the same as it was in the previous tween c: when adjustMcB runs both widths are the same showing that the both tweens have been calculated also, its my understanding that the tweens are rendered at the same exact time. you should have no problem adjusting the size of a, while tweening b and c. (in my example i'm tweening mcA AND mcB
  14. hey benbob, thanks for checking out snorkl.tv and subscribing to youtube channel. dig your video game mashups unfortunately I don't know anything about after effects:(
  15. yeah, you need to specify your function name and the parameters separately like TweenLite.to(objArr[selected], 1, {x:tempX, y:tempY, onUpdate:attackTest, onUpdateParams:[objArr[selected]]}); the params need to be in array format in [ ] as this allows you to pass in multiple params. also note when specifying the function to use, only provide the name of the function and no () GOOD onUpdate:someFunction BAD onUpdate:someFunction()
  16. yeah, there are a few ways, check this out: http://www.snorkl.tv/2010/09/how-to-twe ... tweenlite/
  17. i have an approach which is bit different then the code in your FLA but it is much more flexible and will crossfade between 100s of images if necessary. the code looks like this: import com.greensock.*; //list all the images you want to fade in sequence here var mcs:Array=[mc1,mc2,mc3]; //set all their alpha's to 0 TweenMax.allTo(mcs, 0, {alpha:0}); function showImage(index:Number):void { var mc:MovieClip=mcs[index]; mc.alpha=0; addChild(mc); TweenLite.to(mc, 1, {alpha:1, onComplete:getNextImage, onCompleteParams : [index]}); } function getNextImage(index:Number):void { if (index index++; } else { index=0; } //wait 2 seconds before telling the next image to fade in TweenLite.delayedCall(2, showImage, [index]); } showImage(0); first image fades in, then second image fades in on top of it, then third image fades in on top of 2... attached is a sample fla -------- if a cross fade isn't important, meaning an image fades completely out BEFORE the next image fades in like: image 1 fades in > image 1 fades out and then image 2 fades in > image 2 fades out and then image 3 fades in > image 3 fades out etc... that can be done in very little code with import com.greensock.*; var mcs:Array=[mc1,mc2,mc3]; TweenMax.allTo(mcs, 0, {alpha:0}); var tl:TimelineMax=new TimelineMax({repeat:-1}); tl.appendMultiple(TweenMax.allTo(mcs, 1, {alpha:1, repeat:1, repeatDelay:5, yoyo:true}, 7));
  18. in the future, use smaller images or replace your images with simple vector art to make the fla as small as possible. even if you could upload the fla, people don't want to have to download such large files. i did a test with my own movieclips. where you do myTimeline.append( new TweenMax(before_mc, 3, {autoAlpha:1, visible:1}) ); myTimeline.append( new TweenMax(before_mc, 1, {autoAlpha:0, delay:3}) ); //Same issue as the precvious where the stage is blank for about two seconds. myTimeline.append( new TweenMax(after_mc, 5, {autoAlpha:1, visible:1}) ); remove visible:1 autoAlpha automatically sets the visible property to 1 so there must have been a conflict after making this change there was no time that the stage was blank
  19. hey x10, allTo works great when all the objects are tweening with the same properties/values. in order to add multiple tweens to a timeline with slightly different random values I would suggest using a loop to create and append each tween. here is a preview of the output : http://snorkl.tv/dev/randomBezierMotion/ import com.greensock.*; var tl:TimelineMax = new TimelineMax({paused:true}) for (var count:Number = 0; count var newBox:Box = new Box(); newBox.x = 400 newBox.y = 50 addChild(newBox); TweenMax.to(newBox, 0, {tint:Math.random()*0xffffff}); //simple motion for test //tl.append(TweenLite.to(newBox, 1.5, {x:randomNumber(0,800), y:randomNumber(0,600)}), -1.4); //random bezier tl.append(TweenLite.to(newBox, 1.5, {bezierThrough:[{x:rn(100,110), y:rn(0,10)}, {x:rn(50,60), y:rn(50,60)}, {x:rn(0,10), y:rn(100,110)}]}), -1.4) } tl.play(); //randomNumber function rn(min:Number, max:Number):Number { return Math.floor(Math.random() * (1 + max - min) + min); } //just for fun:) stage.addEventListener(MouseEvent.CLICK, reverse) function reverse(e:Event){ if(tl.reversed){ tl.play(); }else{ tl.reverse(); } } i've attached a sample fla carl ps. btw the whole instance name v name thing AS3 screwed me up too, that's why I knew about the kirupa thread:)
  20. it seems your file wasn't attached. please save as CS4 as requested zip the fla before posting if you find your can not include the images for some reason, please have simple movie clips on the stage with the proper instance names so that I don't have to rebuild assets to get it to work. thanks Carl
  21. that's an excellent suggestion X10 and thanks for jumping in to help! From the amount of code provided that is the best place to start.
  22. it will be much easier to troubleshoot if you upload a cs4 fla with only this code and the necessary assets. thanks. as a general tip, there is no need to combine autoAlpha with visible... although i doubt that is causing any trouble.
  23. there seems to be a disconnect in your code your timeline is referencing a clip named testExp1 myTimeline.append(TweenLite.to(testExp1, 1, {bezierThrough:[{x:147, y:121}, {x:121, y:102}, {x:109, y:127}, {x:329, y:133}], orientToBezier:true}),3); but your addwaveClips functions seems to be generating clips with the names test0, test1, test2, test3, test4, etc based on 'test' + m. also there could be a scope issue with you defining your testWaveClip var inside your function as the scope of that variable only exists in that function. also, instance names in as3 aren't really the same as they were in as2. I'm not expert but reading this may help: http://www.kirupa.com/forum/archive/ind ... 29180.html so based on the suggestions in that thread i would recommend setting up an array outside your function var waveClips:Array = [] then inside your testWave function loop add each new wave to the array waveClips.push(testWaveClip) you can than use TimelineLite's appendMultiple function to do a TweenMax.allTo(waveClips, 1, {someProperty:someValue}); also, in your addWaveClips function's loop when you are creating your clips, you can probably also append them to an existing timeline as well.
  24. Hey Zync, That's an awesome answer. As someone who frequently participates on these boards, just want to say its great to see others jumping in to help people out. Thanks! Carl
  25. Carl

    hide mc

    Tweens don't nest. you can nest multiple movieclips inside a parent movieclip and tween each child independently. TweenLite.to(parent_mc, 1, {y:200}); TweenLite.to(parent_mc.mc2, 1, {scaleX:2, scaleY:2, delay:1});
×