Jump to content
Search Community

Carl last won the day on December 24 2023

Carl had the most liked content!

Carl

Moderators
  • Posts

    9,824
  • Joined

  • Last visited

  • Days Won

    546

Everything posted by Carl

  1. here is a tutoria, interactive demo, and source files for generating tweens with constant speed regardless of distance travelled: http://www.snorkl.tv/2010/11/tweenlite- ... -traveled/ to start at center stage, tween all the way left and then start again all the way to the right, it might be easier just to have 2 tweens and repeat the second 1. or with 1 tween only you could do this: import com.greensock.*; import com.greensock.easing.*; //set the mc all the way to the right mc._x = Stage.width; //create a tween that tweens from left to right var tween:TweenMax = TweenMax.to(mc, 4, {_x:0, repeat:-1, ease:Linear.easeNone}); //start the tween in the middle tween.currentProgress = .5
  2. normally I wouldn't rewrite someone's project so extensively, but you had an interesting problem that could benefit from a cleaner solution. I may even be able to tutorialize this some day. i haven't tested it extensively but it seems to work pretty well in that it allows you to: have a relatively small amount of code in one place that will allow you to tween to the next or previous frameLabel in any timeline. instead of having similar code on every frame with a label, you can just put this in the first frame: import com.greensock.TimelineMax; import com.greensock.TweenMax; import com.greensock.easing.*; //this creates an array of all the labels in your main timeline var labels:Array = this.currentLabels; //this keeps track of the index of the current frame var currentFrameIndex = 0; stage.addEventListener(KeyboardEvent.KEY_DOWN, nextTween); function nextTween(evt:KeyboardEvent):void { var validKey:Boolean = false; //go left if (evt.keyCode == 37) { if (currentFrameIndex - 1 >= 0) { validKey = true; currentFrameIndex--; } } //go right else if (evt.keyCode == 39 || evt.keyCode == 32) { if (currentFrameIndex { validKey = true; currentFrameIndex++; } } //only create a tween if one of the required keys was pressed AND there is somewhere to tween to. if (validKey) { //get duration between currentFrame and frame you want to go to var duration:Number = getDuration(this.currentFrame, labels[currentFrameIndex].frame); trace("duration: " + duration); TweenMax.to(this, duration, {frameLabel:labels[currentFrameIndex].name, ease:Linear.easeNone}); } } //generate duration of tween between 2 frames function getDuration(f1, f2):Number { trace(f1 + " " + f2); return Math.abs(f1 - f2) / stage.frameRate; } stop(); cs5 fla attached
  3. can't open your file. you will have better chance at getting help if you save your file in a format that is available to a larger audience. try a flash cs4 or cs5 fla (not that xfl stuff). being that I couldn't open your file, I'm not really sure of what you are asking right now. Tweens do not have individual framerates, they have durations. if you have a bunch of assets moving around varying distances and want them all to move at the same speed, you may be interested in my tutorial on creating tweens with constant speed http://www.snorkl.tv/2010/11/tweenlite- ... -traveled/ i'll look at your updated file later and let you know if there is anything I can suggest. We have to keep our advice focussed on GreenSock related matters though. Carl
  4. try addChild(imagesArray[1].content) also you may want to consider using an onChildComplete event listener so every time an asset loads, a function will run that can display and position your assets as needed. I have a tutorial covering some XMLLoader basics, the approach is a little different than yours as mine is set up to auto load all the loaders in the xml. The way the onChildComplete handler works could be beneficial to you: http://www.snorkl.tv/2011/08/loading-im ... xmlloader/ to add CHILD_COMPLETE event to your set up you could do: queue.addEventListener(LoaderEvent.CHILD_COMPLETE, completeHandler) *don't forget to add import com.greensock.events.LoaderEvent up top.
  5. thanks for posting your solution. just as a note, you should always make sure the contents of the object you are scaling have an x of 0 when scaling horizontally. items will scale from the registration point. if you went into the Flash IDE > create a move clip called bar > draw a rectangle in side of bar with an x of 20, width of 100, height of 10 go back to scene 1 and scale bar left to right. the same offset will appear as you scale. as the object gets bigger, the distance between the rectangle and registration point is going to get bigger too. make sense? the IDE steps outlined are virtually the same as what happens when you draw to the graphic layer of a displayObject.
  6. BAD: TweenMax.to(bullet01, 1, {glowfilter:{color:0x66ffff, autoAlpha:1, blurX:10, blurY:10}, delay:11}); GOOD: TweenMax.to(bullet01, 1, {glowFilter:{color:0x66ffff, alpha:1, blurX:10, blurY:10}, delay:11}); cap F in glowFilter alpha instead of autoAlpha
  7. pauseAll() is intended to pause all tweens as the name implies. I've found no evidence to support this claim. It appears to me that TweenMax has no code that creates its own masterList.
  8. Great Mosk! I'm sure you will have a lot of fun with GreenSock and AS3.
  9. Collision detection is not part of the GreenSock Tweening Platform. There are a variety of ways to detect when 2 objects collide. AS3 display objects have hitTestObject() and hitTestPoint(). some people have created their own code for even more advanced pixel perfect collision detection. Try googling "as3 collision detection" there is much out there. I would start here: http://www.foundation-flash.com/tutoria ... ittesting/ using their example simply add your tween code where "ouch" is displayed if (circle.hitTestObject(square)) { hittext.text = "Ouch!"; //do a TweenLite tween here } else { hittext.text = ""; }
  10. TweenMax tweens have a repeat property: TweenMax.to(mc, 1, {x:100, repeat:-1, yoyo:true}); if mc has a starting x of 0 it will tween from 0 to 100 and back to 0 indefinitely. from http://www.greensock.com/tweenmax
  11. sure just use the FrameLabelPlugin here is an example of the FramePlugin, which works virtually the same way: http://www.snorkl.tv/2010/10/overview-o ... backwards/ import com.greensock.*; import com.greensock.easing.*; //tween myClip to frame middle and back to beginning indefinitely TweenMax.to(myClip, 1, {frameLabel:"middle", repeat:-1, yoyo:true, ease:Linear.easeNone}) //or try //tween myClip from end to middle to end to middle indefinitely //TweenMax.fromTo(myClip, 1, {frameLabel:"end"}, {frameLabel:"middle", ease:Linear.easeNone, repeat:-1, yoyo:true}) based on your framerate you may have to adjust the duration: frames/frameRate = duration 100frames / 25fps = duration of 4 seconds. -- also in your tween you can set useFrames:true and just pass in the number of frames for the duration please read the getting started guide: http://www.greensock.com/get-started-tweening/
  12. I don't know exactly what you are asking, that code looks pretty solid. you should feel a great sense of achievement. if you don't want to wait for people to click on the thumbs I suppose when you are parsing all the loaders for the thumbnails you could also generate a LoaderMax of all the large SWFLoaders. when the thumbs are all loaded tell the large LoaderMax to start loading you use the term image a lot in your comments but it looks like they are all SWFLoaders. for (var i:int = 0; i { var iLoad:SWFLoader = new SWFLoader("thumbs/"+xImgList[i].@url, new SWFLoaderVars() .name(xImgList[i].@name) .width(nImgWidth) .height(nImgHeight) .container(thumbHolder) .x((i % nMaxCols) * (nImgWidth + colSpace)) .prop("index", i) .prop("url", xImgList[i].@url) .alpha(0) ) thumbLoader.append(iLoad); //do basically the same as above for the large images or swfs or whatever //add loaders to an loadermax that is created outside this function } there's a hundred or so lines of code you are working with. I really can't go through it all and guess about how it should look exactly. hopefully the general suggestion is enough. again, don't get overwhelmed. if its working as is, you should be very happy with it.
  13. I'm not really sure I'm understanding this fully. You could create a LoaderMax that would contain all the ImageLoaders for when you click on your thumbs. This LoaderMax could have it's own "onChildProgress" event. When ever you load an item from this LoaderMax list/queue you will be able to track the load progress
  14. you're welcome. thanks for posting the file I enjoyed seeing it work.
  15. cool. glad it worked. thanks for the update.
  16. try looping through mcArr and getting all the x values. I don't know why one x value isn't updating. its too difficult for me to visualize what may be happening in your file. I imagine this is actually a pretty cool effect you have created. good job at getting it to follow the general format I suggested. it appears much neater. just so you know, you can use relative values by putting quotes around your values. TweenLite.to(mc, 1, {x:mc.x-40}) is the same as TweenLite.to(mc, 1, {x:"-40"})
  17. in your file slide1 doesn't have an instance name, that's why you couldn't target timeline inside of it from your button. in frame 1, select slide1 clip, go to properties panel. give it instance name slide1 in your button2 code use: on (release) { if (_root.link != a) { this._parent["btn"+_root.link].gotoAndPlay("Out"); _root.link = a; } // end if trace("slide2"); _root.slide1.timeline.stop(); _root.gotoAndStop(2); }
  18. I have many nested timelines not directly, but using getChildren() and getLabelTime() you can make it work. yes use getChildren to find the child timeline that contains the label you want to tween to. use getLabelTime() to find the time that the label occurs in the child timeline. add the previous time to the time that the child timeline starts in the root timeline. the use parentTimeline.tweenTo(theTimeYouJustCalculated) so if cow timeline is added to the farm timeline at 3 seconds and cow has a moo label at 2 seconds... moo will happen at 5 seconds in the farm timeline. attached is an example. there are 4 timelines that have a frame label "middle" in them. each timeline is added to a master timeline the master timeline will play (making all 4 timelines play in sequence) pressing the button will make the master timeline go to the point in time that the second timeline's "middle" frame occurs. this is fairly complex, please read up on getChildren() and getLabelTime() there may be other ways, feel free to experiement. this is just one possible way.
  19. you want to adjust the offset parameter http://www.greensock.com/as/docs/tween/ ... dMultiple() timeline.appendMultiple([ TweenLite.to(breathe_mc, 1, {alpha:1,y:117,ease:CustomEase.byName("myCustomEase2")}), TweenLite.to(live_mc, 1, {alpha:1,y:117, y:37, ease:CustomEase.byName("myCustomEase2")}), TweenLite.to(sleep_mc, 1, {alpha:1,y:77, ease:CustomEase.byName("myCustomEase2")}), TweenLite.to(feel_mc, 1, {alpha:1,y:77, ease:CustomEase.byName("myCustomEase2")})],5,TweenAlign.START, .2); there will be a 5 second delay before the first tween starts.
  20. you may be interested in the addCallback method http://www.greensock.com/as/docs/tween/ ... dCallback()
  21. there is perhaps something else calling it. i just created a moveclip called slide. inside of it i have a simple timelinemax: import com.greensock.* var tl:TimelineMax = new TimelineMax(); tl.append(TweenMax.to(mc, 10, {_x:500})); on the main timeline a i have this code btn.onRelease = function(){ gotoAndStop(2); trace("hello") _root.slide.tl.stop(); } stop(); it works fine in targeting the timelinemax inside of slide. perhaps you have something else going on. feel free to zip up a simple demo. c
  22. is the jerk because it slows down and then speeds up again? try using Linear.easeNone as your ease import com.greensock.easing*; timeline.append( TweenLite.from(mc,1, {y:Expected_Position,onComplete:Bounding, ease:Linear.easeNone}) ); ---- I would think bounds() is not necessary as when the timeline repeats it automatically sets everything back to the starting position. guess its there for a reason.
  23. When using ImageLoader, bitmap smoothing is set to true by default which provides that best results when scaling up. by deformation, do you mean blurriness or is the aspect ration off? Can you attach a screenshot. What are the dimensions of your image? For me, fullscreen means 2560 x 1440 and that would require that the image that you load be pretty darn big in order to scale well even with smoothing. if you can provide an example fla of just the code and assets (image, swf, html) you are using to go fullscreen it would be helpful.
  24. I've looked over the code you have supplied and nothing jumps out at me for being the cause of the problem. sorry. It would be a worthwhile endeavor for you to take the time to re-build this functionality in a separate fla file that only has a few buttons in it. They don't need to contain the production artwork. You already have the code written. This exercise will help you isolate the issue and perhaps something will jump out at you in the process. Furthermore, the people trying to help you will have a working example that they can add traces to and be able to to better visualize what is happening.
×
×
  • Create New...