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. Carl

    error problem

    hmmm. If you are using a 3rd party class to create your mapItems, you will have to use whatever object type that class is creating. It appears they are not using MovieClips. you could probably try not casting the mapItem at all: var mapItem:MovieClip = e.target or to find out what mapItem is trace("e.target is a " + e.target) and use whatever object type that tells you. it could be a ShpFeature. don't know.
  2. modify this code here: var i:int = greetingCharacters.textFields.length; var explodeOrigin:Point = new Point(greetingCharacters.width * 0.4, greetingCharacters.height + 100); while (i--) { var angle:Number = Math.atan2(greetingCharacters.textFields[i].y - explodeOrigin.y, greetingCharacters.textFields[i].x - explodeOrigin.x) * 180 / Math.PI; TweenMax.to(greetingCharacters.textFields[i], 2, {physics2D:{angle:angle, velocity:Math.random() * 200 + 150, gravity:400}, scaleX:Math.random() * 4 - 2, scaleY:Math.random() * 4 - 2, rotation:Math.random() * 100 - 50, autoAlpha:0, delay:1 + Math.random()}); } to create a timeline, and then insert that timeline into your other timeline. like: var explode:TimelineLite = new TimelineLite(); var i:int = greetingCharacters.textFields.length; var explodeOrigin:Point = new Point(greetingCharacters.width * 0.4, greetingCharacters.height + 100); while (i--) { var angle:Number = Math.atan2(greetingCharacters.textFields[i].y - explodeOrigin.y, greetingCharacters.textFields[i].x - explodeOrigin.x) * 180 / Math.PI; explode.insert( TweenMax.to(greetingCharacters.textFields[i], 2, {physics2D:{angle:angle, velocity:Math.random() * 200 + 150, gravity:400}, scaleX:Math.random() * 4 - 2, scaleY:Math.random() * 4 - 2, rotation:Math.random() * 100 - 50, autoAlpha:0, delay:1 + Math.random()}) ); } tl.append( explode); just make sure your main timeline has everything in it that you need before adding the explode timeline. be sure to watch this video: http://bit.ly/vnZhh4 it talks about using appendMultiple() and also nesting timelines in other timelines.
  3. Hi Donald, This is one of the more annoying quirks of Flash and one everyone stumbles on to eventually. this article is worth a quick read: http://talsma.tv/post.cfm/inconsistency ... lvplayback
  4. Hey Mr Empty, thanks for the kind words and support. glad you have been enjoying using GreenSock tools and my tutorials. Perhaps something like the Lost ActionScript Weekend series would suit you. It aims to give you that "over-the-shoulder" view of a few actionscript dudes talking through various AS3 OOP concepts in a more "conversational" style. I haven't used it myself so I can't rate it, but there are enough samples available for you to get the feel of it. get a hefty dose of video samples http://my.safaribooksonline.com/9780596801564
  5. I'm having trouble understanding what you want to do. Can you clarify what you mean by a session? Typically this refers to the period of time a user spends interacting with your app before it is closed. once that session ends (the app/browser is closed) your loaded content is flushed (depending on the user's cache settings). Flash typically looks in the browser cache before loading content (so i believe) so if the content is there, it will not have to download again. If you set noCache to true, VideoLoader will always refresh the content (as it loads it with a unique url). once a VideoLoader loads, you can call playVideo() many times without it loading again, unless you flush it by using dispose(true) or unload(). if the video has an error how many times are you going to try to reload it? if you want to attempt to load it multiple times while getting an error you will have to program some logic for this. wouldn't it be best to just move on? LoaderMax has a skipFailed property which will allow you to bypass failed loaders and the next loader will load naturally. If you can clarify your questions I'm sure we will be better suited to provide better answers. In the meantime, please download the source files for this tutorial: http://active.tutsplus.com/tutorials/ac ... e-premium/ it covers virtually all you need to know about effectively loading and managing multiple videos.
  6. I tried testing the swf many times from Flash Pro and in the stand alone player. I could not replicate what you have in your video. very, very strange. I attached my swf just so that you can see if a swf compiled somewhere else performs any differently although I don't understand why that would be or why you are getting that odd behavior. thank you for posting the video.
  7. I downloaded the file, added an onUpdate like greensock suggested and did not see or trace the scaleX/Y at anything other than .5. package { import flash.display.MovieClip; import flash.events.MouseEvent; import com.greensock.TweenMax; public class demo2 extends MovieClip { public function demo2() { btn.addEventListener(MouseEvent.CLICK, onClickBtn); mc1.gotoAndStop(0); mc1.scaleX = .5; mc1.scaleY = .5; mc1.rotationX = -20; } private function onClickBtn(event:MouseEvent):void { TweenMax.to(mc1, 2, { rotationY:-90, scaleX:.5, scaleY:.5, rotationX:-20 , onUpdate:getScale}); } function getScale(){ trace(mc1.scaleX + " : " + mc1.scaleY); } } } I can not reproduce seeing that scaleX/Y being set to 1 at any time.
  8. the rawContent of a SWFLoader is MovieClip. the content is a ContentDisplay (container Sprite) just make sure you are casting your objects as the right type that starling can allow. private var mm:ContentDisplay mm = queue.rawContent //try using content instead
  9. to access the actual swf you need to use the SWFLoader's rawContent LoaderMax.getLoader("pic_"+curNr).rawContent.myFunctionInTheChildMovie() or var MC:MovieClip = LoaderMax.getLoader("pic_" + curNr).rawContent; MC.myFunctionInTheChildMovie(); attached are files that demonstrate a variety of ways of targeting the content and rawContent of a loaded swf.
  10. Ben, If you are still having trouble please start a new thread for each problem (sound, scaling) and provide the simplest files possible to demonstrate the specific problems. For example for the sound issue just provide enough to show that an MP3Loader is playing the sound even though autoPlay is set to false. By creating these small sample files there is a good chance you will discover why you are having a problem in your more complex implementation on your own. Right now this multipage discussion is way too confusing to follow and make any sense of what might be the problem. It happens. Carl
  11. Idans, since you declared myTween inside myClickReaction(), you can't access it inside myOutReaction(). you could try import com.greensock.*; import flash.events.MouseEvent; btn_mc.addEventListener(MouseEvent.MOUSE_OVER, myClickReaction); btn_mc.addEventListener(MouseEvent.MOUSE_OUT, myOutReaction); var myTween:TweenMax; function myClickReaction (e:MouseEvent):void{ myTween = new TweenMax(e.currentTarget, 1, {tint:0x33ff00}); } function myOutReaction (e:MouseEvent):void{ myTween.reverse(); } X10, your code should have been: TweenMax.to(e.currentTarget, 1, {tint:null}) that should work fine, but it will create a new tween and not reverse the existing tween with the same timing.
  12. I really don't have a solution for what you want to do. perhaps you can create functions on each frame that set all the objects back to their "orginal positions / settings" and a function that creates a series of tweens. something like function init(){ TweenMax.killAll(); mc.x = 100; txt.y = 200; } function runTweens(){ TweenMax.to( mc, 1, {x:0}); TweenMax.to( txt, 1, {y:200}); } and then if you want to reset the tweens you just call init(). if you want to replay the tweens call init() and runTweens().
  13. it probably has something to do with the order in which you are activating and de-activating. you are going to get very funky results because when you call activateChars, your timeline is also repeating and is also calling activateWords which is deactivating greetingCharacters. i definitely wouldn't put any of the exploding in the activateChars() function. keep it all in the timeline.
  14. I'm having difficulty visualizing what you want to do or how your file is set up. I think i'm having trouble understanding what frame means. Are you using frames as a tween duration as opposed to seconds with useFrames:true? Do you have a long Flash timeline with tweens on different frames of the timeline? Are you using the frame or frameLabel plugins to tween to a certain frame of a movie clip? TweenMax/lite tweens can easily be reversed with: var someTween:TweenMax = TweenMax.to(mc, 1, {x:200}); //animate in reverse someTween.reverse(); or to jump back to the beginning someTween.currentProgress = 0; so as long as all your tweens are named with var syntax above, you can get them to play backwards or jump to their beginning. also you could use getAllTweens() http://www.greensock.com/as/docs/tween/ ... AllTweens() and loop through all the tweens in your file and perhaps just rewind ones that have a delay greater than a certain value. so you could say "if a tween had a delay of more than 20 seconds... reverse() it" without knowing more about the structure of your document it is difficult to really advise what to do. my gut feeling is that TimelineLite/Max have plenty of basic features that would make something like this much easier. If you are ever sequencing more than 3 tweens, you really should be using them. just my 2 cents. c
  15. if appears that code is trying to convert the loaded content to a bitmap (which can't be done with a swf) change this code //Get the bitmap from the loader var bm:Bitmap = (Bitmap)(loader.content); //Add the bitmap to a movie clip holder var bmHolder:MovieClip = new MovieClip(); bmHolder.addChild(bm); //Add the bitmap holder to the stage addChild(bmHolder); to var bmHolder:MovieClip = new MovieClip(); bmHolder.addChild(loader.content); addChild(bmHolder);
  16. tl.appendMultiple( TweenMax.to(greetingCharacters.textFields[i], 2, {physics2D:{angle:angle, velocity:Math.random() * 200 + 150, gravity:400}, scaleX:Math.random() * 4 - 2, scaleY:Math.random() * 4 - 2, rotation:Math.random() * 100 - 50, autoAlpha:0, delay:1 + Math.random()})); appendMultiple() expects an array of tweens for the first parameter you are passing in a single tween. just use append()
  17. I gather what you're saying is you need to split a single textfield -into words (for what you describe as the text running in) -and then individual characters (for what you describe as exploding) if that is the case please read greensock's explanation of re-using the same textfield for different split types: viewtopic.php?f=5&t=4873&p=19404&hilit=splittextfield#p19404 Then look at my demo that includes a rinse and repeat http://snorkl.tv/dev/splitWordsChars/ Here is the code I used: import com.greensock.*; import com.greensock.easing.*; import com.greensock.text.*; var greetingWords:SplitTextField = new SplitTextField(christmas_txt, "words"); greetingWords.deactivate(); var greetingCharacters:SplitTextField = new SplitTextField(christmas_txt); greetingCharacters.deactivate(); christmas_txt.visible = false; var tl:TimelineMax = new TimelineMax({onStart:activateWords, onRepeat:activateWords, repeat:20, repeatDelay:.5}) //animate each word tl.appendMultiple( TweenMax.allFrom( greetingWords.textFields, .5, {alpha:0, y:"50" } ), 0, "normal", .2 ) tl.addCallback(activateChars, tl.duration); //animate each character tl.appendMultiple( TweenMax.allTo( greetingCharacters.textFields, .3, {alpha:0, y:"-100", scaleY:-1 } ), 1, "normal", .1 ) function activateWords(){ trace("activate words"); greetingCharacters.deactivate(); greetingWords.activate(); } function activateChars(){ trace("deactivate words"); greetingWords.deactivate(); greetingCharacters.activate(); } attached is a flash cs4 fla. no greensock code this was an interesting challenge. I have never done this before. Good thing GreenSock addressed this already.
  18. Hi welcome to the forums and the club. is there any way you can simplify the effect so that it is easier to focus on the core issue? right now your code is very hard to read with all the physics stuff, multiple filters, and Math.random()s in there. I don't know -why there are 2 explode() functions. -or what "and the explode code is" -and "At the moment my project looks like this" means. it seems code is duplicated and I really can't piece it together in short I have no idea where to begin dissecting such a huge mass of unformatted code. perhaps you can build something that fades in a few words and then each letter just fades out and while doing that exercise you it will help you clearly explain exactly what part you need help with. You can even post a simplified zipped Fla for us to test (just don't upload the membership plugins). We would love to help you, but right now what you have provided is simply a bit too cryptic to diagnose. thanks Carl
  19. I tested your code. it worked fine. where you will run into problems is if you click on the object a lot while the tween is in progress. let's simplify it: assume the clip starts with an x of 0. the first time you click a tween is created that tweens from 0 to 400. TweenMax.to(this, 4, {x:400, ease:Linear.easeNone}); wait until the tween finishes. click again and that tween will reverse. if you click again 3 seconds into the reverse, the clip will have an x of 100 and then a new tween will be created that tweens from 100 to 400 and not 0 to 100. ---- the problem is that you are creating a new tween every other time you click. you probably want to create one tween, and simply toggle playing it and reversing it. so declare tween outside of your doAnimate() method. make sense?
  20. Hi X10, I don't know what your errors are about. What are you doing differently than my sample files. The whole setup is built on requiring specific instance names and the timelines being built and ready to be played as soon as the child swfs load. c
  21. It's my understanding that once you apply a TransformMatrix you can't alter the x, y, scaleX, rotation etc. I imagine this applies to rotationX as well. you can directly tween any property of a Matrix3D, perhaps this answer from greensock will help: viewtopic.php?f=1&t=5706
  22. Hi. I don't know what sort of help exactly you are looking for. Is there something in your implementation of TweenLite that you are having trouble with? Unfortunately we don't have the time to explain all the inner workings of something as intricate as how to build an inverted accordion. Perhaps someone on here has one laying around and it won't be a big deal for them to share. We have to dedicate our support to issues dealing directly with code / issues relating to the GreenSock Tweening Platform. For more general scripting advice related to theory and how you should structure your project please try the forums at adobe, kirupa.com or actionscript.org.
  23. try import com.greensock.*; TweenMax.to(_root.Main_MC.cip1, 1, {_x:200}) you should also research using alternatives to set and eval in AS2 you can just use _root.Main_MC.cip1._x = 20 you don't need eval and set unless you are using AS1 i think.
  24. I am confused about how the addCallback()'s are not firing at precise times, but another option would be to use TimelineMax's tweenTo() method in conjunction with labels before each "stage" or "section" of your animation: http://www.greensock.com/as/docs/tween/ ... l#tweenTo() you could even use the getLabelAfter() and getLabel() before methods to dynamically fetch the next label in your sequence i am particularly fond of this discussion on working with labels in TimelineLite/Max http://active.tutsplus.com/tutorials/an ... th-labels/
  25. glad you are making progress. thanks for posting your solution. I regret that I am limited in my ability to imagine how complex mathematical equations perform when just looking at code. TweenMax should most definitely tween your object to the given values. perhaps something is causing a conflict. All I can recommend is to use an onComplete function to trace the values of karta.x when the tween has finished. keep us posted on your progress. c
×
×
  • Create New...