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. Hey jack, That file is fabulous. Its a big help. Thanks for building it AND for commenting the code so clearly. Beyond the whole FrameSequence class I really like seeing how LoaderMax does so much with so little. Carl
  2. Hello Patrick, Thank you for posting the code, it makes things much more clear. What you are trying to accomplish is a cool and practical effect. From what I know the greensock family of tweening tools doesn't provide anything built in to achieve this goal as what you are doing isn't really a tween. What you are doing is using a tweening platforms events / methods / features to drive a series of functions that produce your desired end result (which isn't necessarily a bad thing). Your implementation does work and its a fairly clever approach. I just don't know enough about your project to assess why you are using TimelineLite for this functionality. Do you need to reverse this sequence or change its timescale at some point? I'm curious if your approach holds up it the tween is reversed. What I'm getting at, is that unless its not 100% necessary that features of TimelineLite are being used, there are definitely simpler ways of getting a sequence of images to display. If you really want the GreenSock platform to drive this sequence of images check out GreenSock's response and sample fla in this thread: viewtopic.php?f=1&t=4226 He mentions tweening a custom property of an object using a TweenLite/max. as that property's value changes it drives the positioning of a series of clips. I believe you could create your own "PNGSequence" object and tween something like its currentImageIndex property. currentImageIndex may be an index of your image in your xml object / loaderMax queue... whatever. as the currentImageIndex property changes... you can hide all images that don't have the same index value as currentImageIndex. I think this type of approach will allow to add your animated sequence into a timelineLite as a single TweenLite and you will be able to benefit from all the features of the platform. From looking at your code which illustrates your familiarity of loaderMax and everything else, I think you will really enjoy looking at the files in the link above and implementing something similar. Carl
  3. hello. can you please be more specific about exactly what you want to accomplish? "arrange a sequence of pngs which plays" isn't clear to me. do you want multiple images to be animated? are you trying to simulate a keyframed animation? thx Carl
  4. it makes sense to me! controlling tweens independently of their parent timeline seems like it could be a real bear to manage for the reasons you provided. -Carl
  5. Hello Chrisatflash, the short answer is no, there is no special listener as each tween has no idea that is part of a loop or what its position is in the loop. inside the loop you could test to see if the value of i has reached a certain value and then create your last tween with an onComplete. the great news is you don't need the loop and what you want to do is entirely possible. Since your tiles are already in an array just use TweenMax.allTo() like so TweenMax.allTo(tileArray, 5, {rotation:50, ease:Quad.easeOut, onCompleteAll:finishedWithAllItems}, .02); the line of code above can replace your entire loop. the .02 value at the end is the "stagger" amount which does the same thing as your previous delay:i*.02. enjoy Carl
  6. ugh. completely ignore what I said earlier. When I was "testing" what I thought was a fixed approach... I was reversing the tween while the timeline was still playing. my whole move the timeline declaration out thing was completely wrong as I was testing it wrong. attached is a file that illustrates the problem. when timeline completes (box2 fades out) box1's tween will not reverse but it's properties can be referenced as the original poster mentioned. click on the stage to reverse the tween. if timeline is playing, tween can be reversed, if timeline is finished it won't reverse. Carl
  7. taking the timeline out of the function a scope will make this work: import com.greensock.*; var t:TweenMax = TweenMax.to(do, 1, {x:100}); var tl:TimelineLite = new TimelineLite(); //in a local function function a():void{ tl.insertMultiple([ t, TweenMax.to(otherDo, 2, {y:12}) ]) } a(); stage.addEventListener(MouseEvent.CLICK, reverseT) function reverseT(e:MouseEvent):void{ trace(t.currentProgress); t.reverse(); } i don't know the exact why or how of this. like you said it is sort of confusing that with the timeline declared in the function, t.currentProgress works but not t.reverse(). I'm sure there is a good reason. Carl
  8. gee whiz that thing is neat. i know I wouldn't have thought of that approach.
  9. i enjoyed fixing this. its really cool that you took something pretty small and were able to incorporate it into something much bigger. great job.
  10. i think i got it. one of the issues was holder.mask was set before holder.cacheAsBitmap. i put the timeline creation in its own function so it is only created once. check it out: package { import com.greensock.*; import com.greensock.easing.*; import flash.display.*; import flash.utils.*; import flash.events.*; import flash.net.*; public class Slideshow1219 extends Sprite { var bars:Bars = new Bars(); var n:int = 0; var intCurrentSlide:int; var req:URLRequest; var holder:Sprite = new Sprite(); var loader:Loader; var rand:int; var nxtNum:int; var picNum:String; var slideCount:int; var xmlLoader:URLLoader; // slideshow xml loader var xmlSlideshow:XML; // slideshow xml var strXMLPath:String = "slideshow-data.xml"; var slideName:String; var history:Array = new Array(); var duration:Number=.5; var prevSlide:String; var timeline:TimelineMax; public function Slideshow1219(){ nxtNum = rand + 10000; picNum = intCurrentSlide.toString(); xmlLoader = new URLLoader(); xmlLoader.addEventListener(Event.COMPLETE, onXMLLoadComplete); xmlLoader.load(new URLRequest(strXMLPath)); createTimeline(); } private function onXMLLoadComplete(e:Event):void { xmlLoader.removeEventListener(Event.COMPLETE, onXMLLoadComplete); xmlSlideshow = new XML(e.target.data); // create new xml with the received data slideCount = xmlSlideshow..image.length(); // get total slide count trace("slideCount "+slideCount); loadSlide(); } private function loadSlide():void { prevSlide=history[history.length-1]; rand = Math.ceil(Math.random()* slideCount - 1); loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, displaySlide); slideName = xmlSlideshow..@src[rand].toString(); trace("slideName "+slideName); if(slideName != prevSlide){ history.push(slideName); loader.load(new URLRequest(xmlSlideshow..@src[rand])); }else{ loadSlide(); } } private function createTimeline():void{ timeline =new TimelineMax({repeat:1,repeatDelay:2,yoyo:true,onComplete:loadSlide, paused:true}); for (var count:int = 1; count var mc:MovieClip=bars["bar"+count]; trace("doing it"); timeline.append(TweenMax.from(mc, duration, {x:"64", alpha:0, ease:Cubic.easeOut}), -.4); } } private function displaySlide(e:Event = null):void { holder.addChild(loader); bars.cacheAsBitmap=true; holder.cacheAsBitmap=true; holder.mask=bars; addChild(holder); addChild(bars); timeline.restart(); var duration:Number=.5; loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, displaySlide); addChildAt(holder, 0); if(holder.numChildren > 1){holder.removeChildAt(0);} bars.width = holder.width; bars.height = holder.height; // timeline.insert(TweenMax.from(mc, 2, {alpha:0, ease:Cubic.easeOut})); } } }
  11. you're welcome. and check out loaderMax http://www.greensock.com/loadermax/ it will save a lot of headache.
  12. it seems your problem is not being explained accurately. the swf that contains the phone does infact work fine in a browser: http://www.oromamedia.com/msecenter.com ... header.swf the problem is that your swf is not working when loaded into another swf when you are using AS2 with externally loaded assets _root refers to the parent swf that is doing the loading. once header.swf gets loaded into preloader.swf... _root mentioned in header refers to the root of your preloader. to prevent this add this._lockroot = true; to the first frame of your msecenter-header.swf OR in header.swf use relative paths from the buttons to the phone
  13. hello jemmon, there are a number of things that are messing up here: the biggest problems are in here: var arry:Array = new Array(holder_mc.numChildren); trace(arry.length); for(var n:int = 0; n TweenMax.allTo(arry[n], 1, {alpha:1}, 0.3); } the whole point of allTo is so that you don't need to manually loop through an array... you just tell allTo what array to loop through. i have a video here on allFrom which works in a similar fashion: http://bit.ly/f5qWol so either kill the for loop, or just use the loop to call a bunch of TweenMax.to()s next your arry Array doesn't have anything in it. in your loop add trace(arry[n]) I don't think anything will trace. what you want to do is define your arry Array outside of any functions. in the init function add each b to arry via arry.push( this will put each b into arry so that TweenMax.allTo(arry, 1, {alpha:1}) will work inside animateChildren() lastly the init function is calling animateChildren 28 times because it is inside a loop furthermore animateChildren is hoping to also loop through all the items in holder_mc. So 28 times you are calling a function that is trying to animate everything in holder_mc. so inside the init() function make sure animateChildren doesn't run until all objects are on the stage by moving animateChildren() outside the init() loop. also, each b needs to have it's alpha set to 0 initially so that your tween bringing the alpha to 1 actually has something to do. ultimately your code should look something like this (i can't guarantee it will work) var arry:Array = new Array(); function init():void { for(var i:int = 0; i var b:MovieClip = new box_mc(); b.x = (i % 7) * 49; b.y = int(i / 7) * 49; //make each b alpha 0 b.alpha = 0; holder_mc.alpha = 0; holder_mc.addChild(; // add each b to the arry Array arry.push(; b.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver); b.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut); b.buttonMode = true; b.mouseChildren = false; } //call animateChildren() outside the loop animateChildren(); } function animateChildren():void { //clean up animateChildren by using a single allTo() : no need for a loop // oh an make sure the holder can be seen holder_mc.alpha = 1 TweenMax.allTo(arry, 1, {alpha:1}, 0.3); } } you were very close! hopefully this explanation brings you closer to making something sweet. Carl
  14. does it loop more than once? if you don't want it to repeat at all, remove {repeat:1} if your code you show is the only thing in your movie, and nothing else is forcing that code to execute a second time such as the flash IDE timeline looping... your TA will play only once.
  15. from looking at your code nothing is jumping out at me. as you said the loadSlide, displaySlide, loadSlide, displaySide sequence appears to be working, so that means that the timeline is in fact playing as the onComplete is firing. Its just that you are not "seeing the tween". what I would do is try to figure out what is working and not working. For instance... is the tween playing, but masking isn't working? is the tween playing but you can't see it cause it is on a level/depth beneath the holder? I would probably start by getting rid of the masking and just trying to see if I can see solid bars moving. Once I can see the bars, then I'd try to figure out why the masking isn't working. the fact that it works for the first time makes me thinks things are "pretty right" and its gotta be something small that is getting in the way. if you feel like posting a zip with just this functionality in place I'd take a look at it for you. Carl
  16. try changing var timeline:TimelineMax=new TimelineMax({repeat:1,repeatDelay:1,yoyo:true,onComplete:loadSlide()}); to var timeline:TimelineMax=new TimelineMax({repeat:1,repeatDelay:1,yoyo:true,onComplete:loadSlide}); no parenthesiseeses after loadSlide
  17. hey Dave, glad to help. I've found that just reading the AsDocs and going through old posts on this forum is a great way to learn. http://www.greensock.com/as/docs/tween/ ... layedCall() when I come across something in the docs that sounds cool, but I don't really understand I force myself to try to implement it somehow. Carl
  18. the following will fade a sound in over 1 second after a 3 second delay. you can call myFunction however you like, for the onComplete of a TimelineMax, TweenMax, delayedCall... whatever var sound:Crunches = new Crunches(); var chompSound:SoundChannel; TweenLite.delayedCall(3, myFunction) function myFunction(){ chompSound = sound.play(); TweenMax.fromTo(chompSound, 1, {volume:0}, {volume:1}) } sound.stop() won't work as stop() is a method of SoundTransform, not Sound. could they make this more confusing? this helps a lot: http://www.republicofcode.com/tutorials/flash/as3sound/
  19. hello groovdafied, from what I can muster I'd start here: categoryArray.push(catName); this code is pushing a string into your categoryArray. allTo() needs an array of display objects, not String values of their .name property. i know, its weird. its more an AS3 thing and not a tweenMax issue. try this instead categoryArray.push(; this will actually be adding each b (or a reference to each to the array.
  20. by default strokes are set to scale proportionally so if you make it very wide it automatically gets thicker. go inside your line2_mc and select the stroke. in the properties panel go to the stroke menu and select "none" OR convert your line to a rectangle with a height of 1px also you want to make sure you spell height right.
  21. When using a TweenMax.to() the properties that you set are target / end / destination properties so setting a property there for the beginning of the tween would be counter-intuitive to the entire TweenMax/Lite model. the following should suit your situation box.visible = false; TweenMax.fromTo(box, 1, {visible:true}, {x:300, delay:2}); the box will start invisible after 2 seconds it will appear and tween its x. thanks for bringing this up, I never used the visible plugin before and it I can see it can come in quite handy!
  22. yo attaboy! great job of integrating the mask effect with an externally loaded image! it seems it is all working except the variable transparency of the mask. your code looks really good. the only thing I would suggest as a fix is this: bars.cacheAsBitmap=true; holder.cacheAsBitmap=true; holder.mask=bars; addChild(holder); the problem may be that you are setting the holder.mask = bars BEFORE it is added to the stage. try moving it up above bars.cacheAsBitmap = true; that is only a guess. if that doesn't fix it, zip up all your files and post them here. I'll take a look at it tomorrow. let me know if you get it working. Carl ps. if other snorkl.tv files give you trouble feel free to post in the comments over there. I do my best to address each comment.
×