Jump to content
Search Community

Carl last won the day on December 24 2023

Carl had the most liked content!

Carl

Moderators
  • Posts

    9,825
  • Joined

  • Last visited

  • Days Won

    546

Everything posted by Carl

  1. thank you for posting the example swf. it made it very clear what you want to do. take a look at what I came up with: http://www.snorkl.tv/dev/upAndUp/ here is the code: import com.greensock.*; var numBars:int = 6; var initY:int = 250; var initX:int = 10; var even:Object = {onScreen:6, offScreen:-208}; var odd:Object = {onScreen:110, offScreen:-204}; var bars:Array = []; var currentSection:int = 0; //0, 2, 4 var speed:Number = .5; function createBars() { for (var i:int = 0; i trace("make a bar"); var bar:Bar = new Bar(); bar.y = initY; bar.x = initX; bar.label_txt.text = String(i); addChild(bar); bars.push(bar); } //start the first 2 bars where they should be bars[0].y = even.onScreen; bars[1].y = odd.onScreen; addChild(black); addChild(next_btn); } function nextSection(e:MouseEvent):void{ //currentSection out TweenLite.to(bars[currentSection], speed, {y:even.offScreen}); TweenLite.to(bars[currentSection+1], speed, {y:odd.offScreen}); //new section in currentSection = (currentSection+2) % bars.length; trace(currentSection); TweenMax.fromTo(bars[currentSection], speed, {y:initY}, {y:even.onScreen}); TweenMax.fromTo(bars[currentSection+1], speed, {y:initY}, {y:odd.onScreen}); } next_btn.addEventListener(MouseEvent.CLICK, nextSection); createBars(); this should give you an idea of one way to approach this. of course nextSection could be called with a Timer. upAndup.zip
  2. Carl

    Rotation

    i don't see how the rotation would be anything other than a quick rotation tween. something like: var tl:TimelineLite = new TimelineLite(); tl.append(TweenLite.to(bag, .2, {y:100, ease:Back.easeOut})); tl.append(TweenLite.to(bag, .2, {rotation:720, ease:Circ.easeOut}), -.05); tl.append(TweenLite.to(bag, .2, {y:360}), -.05) I didn't go crazy trying to match the timing and easing, but it should give you the general idea. and yes, transformAroundCenter (Really Green Membership) makes it VERY easy to rotate around the center. there is a video on the Learning Resources page http://www.greensock.com/learning/ titled TransformAroundCenter Plugin Explained if you want to see it in action before purchasing. if you are loading your images with a LoaderMax ImageLoader there is also a centerRegistration property that you can use and it is free.
  3. sorry but I really can't visualize what your code is doing. the only thing I can suggest is maybe using tweenMax.fromTo() which allows you to set a start and end position of each tween. based on your description I think you could pass each pair of objects into a function that returns a TimelineLite for that pair. Then append each group's timeline into a master timeline and set the timeline to repeat.
  4. Hi sorry to hear you are having problems. We will need more info to troubleshoot the problem. have you read the SWFLoader documentation that addresses common security issues? http://www.greensock.com/as/docs/tween/ ... oader.html It would really help if you could provide a bit more information. what does "in an online mode" really mean? are both swfs hosted somewhere? are they on the same server? if not, do you have a crossdomain.xml policy file? after googling the error code, what similarities does your project have with the other projects that have experienced the same error? The more information you provide (including the full text of the error message) the better suited we will be to help. Unfortunately swf security errors are a bit of a hassle and very difficult to troubleshoot without more info. SWFLoader has features to avoid the most common security hassles but there are still situations where you have to take certain measures. If you can create extremely simplified versions of your files with the least amount of code and functionality to exhibit the problem that would be a big help.
  5. keep in mind what you are doing isn't really a tween. A tween typically has a duration, start value and end value. the motion you are creating has a duration that is virtually infinite (depending on how long the user is moving the mouse) and the end values can change many times. I would suggest starting with just a few simple tweens and find the easing equation that suits your needs. TweenMax.to(boxContainer, .5, {rotationX:destRotationX, rotationY:destRotationY, ease:Quint.easeOut})
  6. Hi, the reason for the stacking is because you are using the same loader multiple times with the same container. nothing wrong with that. you can use SWFLoader's unload() or load() methods to flush out previously loaded content. try loader.load(true) // load and flush previously loaded content More info on SWFLoader methods here: http://www.greensock.com/as/docs/tween/ ... hodSummary
  7. Hi, You also need to activate the plugin. From the documentation: import com.greensock.*; import com.greensock.plugins.*; TweenPlugin.activate([MotionBlurPlugin]); //only do this once in your SWF to activate the plugin TweenMax.to(mc, 2, {x:400, y:300, motionBlur:{strength:1.5, fastMode:true, padding:15}}); //or to use the default values, you can simply pass in the Boolean "true" instead: TweenMax.to(mc, 2, {x:400, y:300, motionBlur:true}); http://www.greensock.com/as/docs/tween/ ... lugin.html MotionBlurPlugin is a bonus plugin available to Club GreenSock members http://www.greensock.com/club/
  8. glad you have made progress and that my tutorials and Mr. GreenSock's help have gone a long way. when you set the x/y values in the xml they get applied to the ContentDisplay sprite that contains the image. you can target this object through the content property of an ImageLoader. the problem you are having is you are grabbing the rawContent which technically lives inside the content. the rawContent always has x/y coordinates of 0/0. to target the content you can either do someLoader.content; //or LoaderMax.getContent("someLoaderNameOrUrl"); in your example either will work fine: var image2:ContentDisplay = LoaderMax.getLoader("arrows").content; //or var image2:ContentDisplay = LoaderMax.getContent("arrows"); or if for some reason you really really need the Bitmap var image2:Bitmap = LoaderMax.getLoader("arrows").rawContent; image2.x = LoaderMax.getContent("arrows").x; image2.y = LoaderMax.getContent("arrows").y;
  9. did you try proportionalOutside? "proportionalOutside" - The image will be scaled proportionally to completely fill the area, allowing portions of it to exceed the bounds defined by the width/height. I think that is what you are trying to achieve
  10. i looked at the swf. It really didn't appear jerky to me, in fact it was quite buttery.
  11. like this: http://www.snorkl.tv/2010/09/how-to-twe ... tweenlite/ ?
  12. it may be because you are are constantly creating new tweens with new end values that are drastically different than the previous tweens (fast mouse movement). you also didn't mention how many objects are in your array. i couldn't open your file. something like this (with better math) might do what you want: http://www.snorkl.tv/dev/cheapParallax/ move mouse left to right (but not too far right, it bugs out when you move off stage in some browsers) import com.greensock.*; import flash.events.MouseEvent; addEventListener(Event.ENTER_FRAME, moveIt); function moveIt(e:Event):void{ //small box in background box1.x +=( mouseX - box1.x) * .05 //large box if foreground box2.x +=( mouseX - box2.x) * .1 } files attached
  13. wow. glad to hear it worked. i really had no idea.
  14. I've never seen it but google makes it seems like its happened to plenty of people before. can you compile the app without using the SWFLoader and see if the error is still there? have you tried downloading a new version of the greensock files? from what I read on google it appears to be that its not really a bug in any code but something to do with corrupt / damaged files or a compiler bug. one post mentioned something about a loaded swf using a different version of a class than is used in the parent swf.
  15. very difficult to visualize without knowing how your fla is set up. is the title_show clip always on the stage? do you have blank key frames that would cause it to be added and removed? doest telling your loaded swf to gotoAndPlay(1) work better than just play?
  16. there have been a few parallax engines over the years. I can't seem to find the one I was looking for, but this one might be worth looking into: http://www.lextalkington.com/blog/2009/ ... em-engine/ dig up a few more, you will probably find some commonality among them. pick out the good parts;)
  17. if you want a seamless cross-fade effect, you might want to use a LoaderMax containing multiple MP3Loaders to pre-load all the songs, then its just a matter of telling the requested loader to playSound() (and tween the volume) and tell the current loader to fade out. so you need to keep track of the current mp3 that is playing and configure your combobox to fire a CHANGE event that will handle the song switching. you could use the selected label of the combobox to find the proper MP3Loader in your LoaderMax and then tell it to play. something like: myLoaderMax.getLoader(whateverTheLabelIsThatWasJustSelected).playSound() From your code it looks like you have only added a comboBox to my tutorial (which is great) but you should probably get some of the bare bones functionality in there for triggering an action when the user selects something new from the comboBox. maybe just start by dynamically creating a single MP3Loader based on the selected item. Keep us posted on your progress. -carl
  18. thanks for clarifying your file setup. good to know that you have things well-optimized. You make a strong case for there being an issue with that particular version of the Flash plugin.
  19. cool, just a note don't be turned off by the fact that the videos use as3 all the properties, methods and basic theory is exactly the same as the AS2 version.
  20. wow that is really strange. thanks so much for postings your findings. could be a big help to folks in the future.
  21. doh! that's what i meant. mis-copied from the reference post. thanks!
  22. loader.scaleMode = "proportionalInside" viewtopic.php?f=6&t=5944&p=22833&hilit=change+scalemode#p22833
  23. please zip your mp3 before posting. thanks. keep in mind that if any native as3 property is being reported inaccurately it is going to impact the accuracy of MP3Loader
  24. yes, the way to pause between tweens is to add delays (as you have) or offset values (as X10's method uses) to the tweens. You are already using delays so I assume that you are referring to the time that elapses before the timeline repeats? if so, give this a try: function done(){ //wait 4 seconds before the timeline's restart method is called TweenLite.delayedCall( 4, tl.restart); } -carl ps. X10, thanks for the support!
  25. it appears you are loading 10 images that are 1280x640. that is approximately 8 million pixels that flash has to redraw on every frame of every tween. if you are moving all the images as a giant strip I'm not the slightest bit surprised flash is choking. I have no idea how your file is constructed, but I would strongly urge you to experiment with a BlitMask if in fact it is one container clip that you are tweening. http://www.greensock.com/blitmask. since it appears you only have "next / previous" navigation you could also just tween the current item off the stage and the requested item onto the stage. much less pixel-pushing involved.
×
×
  • Create New...