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. I don't believe there is any single method that is going to give you all that data. You have access to all the child tweens and timelines of any timeline via getChildren() http://www.greensock.com/as/docs/tween/ ... tChildren() Definitely read up on the arguments for this method as they can drastically change what and how many tweens and or timelines it returns. You have access to a tween's target, duration and vars as well. It's very possible you could loop through all the tweens in a timeline and get a good deal of info on each tween. here is something to start with: //build a basic timeline var masterTimeline:TimelineMax = new TimelineMax(); masterTimeline.insert(TweenLite.to(mc, 1, {alpha:1, x:300, y:400, scaleX:2})); masterTimeline.insert(TweenLite.to(mc2, 1, {alpha:.5, x:350, y:410, scaleX:2})); var allTweens:Array = masterTimeline.getChildren(true, true, false); var numTweens:int = allTweens.length; //loop through all child tweens in masterTimeline for(var n:int = 0; n //pass each tween into the getTweenData function getTweenData(allTweens[n]); } function getTweenData(tween):void { trace("\ntween target " + tween.target); trace("tween target name " + tween.target.name); trace("duration " + tween.duration); for (var i in tween.vars) { trace("\t" + i + ":" + tween.vars[i]); } }
  2. me too! I know I have a file laying around somewhere that I used for experiments. If I find it i'll try to make something helpful out of it. -c
  3. don't use a layer mask, use an actionscript mask. get rid of your mask layer. make sure your circle is a movie clip with instance name circle alter your code to include the following: var mySwf1:SWFLoader = new SWFLoader("Clock.swf", {width:200, height:200, x:-300, y:-300, container:this, onComplete:completeHandler1}); //ADD THIS mySwf1.content.mask = circle mySwf1.load();
  4. I had a tough time understanding all of your description. can you post an fla that demonstrates only this type of behavior? at the very least it would help to see some actual code. it doesn't need to be your full app. just something that will show us how you are generating your sprites or what the following means. the user does 1 thing to start the animation and then 10 more things to fade out the sprite? I created a small example that allows you to click a button to create an animation sequence that gets appended to a TimelineMax: view here: http://snorkl.tv/dev/single-timeline/ import com.greensock.*; import flash.events.MouseEvent; var clickCount:Number = 0; var tl:TimelineMax = new TimelineMax() btn.addEventListener(MouseEvent.CLICK, addSequence) function addSequence(e:MouseEvent):void{ clickCount++; //display the number of clicks output_txt.text = String(clickCount); var b:Ball = new Ball(); //give each ball its own number b.label_txt.text = String(clickCount); addChild(; tl.append(TweenLite.to(b, 1, {x:300})); tl.append(TweenLite.to(b, 1, {y:100, alpha:0})); tl.play(); } if you click 1, 2 or 20 times all the animations will play one after another. zip attached I'm pretty sure you are doing something more complicated than this. your best bet may be to have an individual TimelineLite/Max for each sprite. keep in mind the OverwriteManager only comes into play when you are using multiple tweens on the same object and there is a conflict that needs to be resolved as far as which tween should take priority over another at a given time. It doesn't change the order in which they run.
  5. Carl

    Array error

    it could be because: you haven't activated the tint plugin: import com.greensock.plugins.*; TweenPlugin.activate([TintPlugin]); ----- also try tracing out what is object you are targeting in your roll overs: function onOver(evt:MouseEvent):void { evt.currentTarget.info.textColor=0xA52121; trace("my target is " + evt.currentTarget.bg) TweenLite.to(evt.currentTarget.bg,1,{tint:0xA52121,scaleY:2}); }
  6. modify my file to use this: function playSound(e:MouseEvent):void { if (soundChannel.position == lastPos) { //only play if the soundChannel position is the same as when it was paused soundChannel = sound.play(lastPos); } }
  7. the SelfLoader documentation has sample code for loading Self and other assets: http://www.greensock.com/as/docs/tween/ ... oader.html
  8. try this in the previous file i sent import flash.media.Sound; import flash.media.SoundChannel; var sound:SampleSound = new SampleSound(); var soundChannel:SoundChannel = new SoundChannel(); var lastPos:Number = 0; // ***************** BEGIN NEW STUFF ************** // START PLAYING THE SOUND IMMEDIATELY soundChannel = sound.play(lastPos); // ***************** END NEW STUFF ************** play_btn.addEventListener(MouseEvent.CLICK, playSound) function playSound(e:MouseEvent):void{ soundChannel = sound.play(lastPos); } pause_btn.addEventListener(MouseEvent.CLICK, pauseSound) function pauseSound(e:MouseEvent):void{ trace(soundChannel.position); lastPos = soundChannel.position; soundChannel.stop(); }
  9. Hey X10, nice to see you around. glad you solved it and thanks for posting your solution. scrollRect is great, but I've found that it naturally only allows the direction of the reveal to work in specific ways. changing the reg point was a clever approach.
  10. here is how you can pause and play a sound from the library: import flash.media.Sound; import flash.media.SoundChannel; var sound:SampleSound = new SampleSound(); var soundChannel:SoundChannel = new SoundChannel(); var lastPos:Number = 0; play_btn.addEventListener(MouseEvent.CLICK, playSound) function playSound(e:MouseEvent):void{ soundChannel = sound.play(lastPos); } pause_btn.addEventListener(MouseEvent.CLICK, pauseSound) function pauseSound(e:MouseEvent):void{ trace(soundChannel.position); lastPos = soundChannel.position; soundChannel.stop(); } file attached I used this tutorial which I recommend: http://www.republicofcode.com/tutorials/flash/as3sound/ yes, sound in AS3 is kind of a hassle. that's why I greatly prefer letting the MP3Loader handle it all.
  11. i'm having trouble following this. it seems like you are mixing up a few different techniques. MP3Loader needs to load an external sound. you can't pass in this to the constructor BAD var sound:MP3Loader = new MP3Loader(this, {name:"SoH", autoPlay:true, repeat:0}); GOOD var sound:MP3Loader = new MP3Loader("mySoundFile.mp3", {name:"SoH", autoPlay:true, repeat:0}); ... also tweening the volume of a sound to 0 does not stop it from playing. stoppring all the tweens in your movie isn't going to stop the sound from playing. once you settle on a way of using your sound: -loaded with MP3Loader -placed on a timeline frame -instantiated from the library it will be much easier to offer a solution. the MP3Loader route will probably give you the easiest route with the most versatility
  12. if the sound is on a frame in the timeline that your code resides in then this is the object who's sound you are transforming try TweenLite.to(this, 1, {soundTransform:{volume:0, pan:1}}); If you want to use the linkage, you have to instantiate the sound and create a sound channel as shown in this thread viewtopic.php?f=1&t=4176
  13. Hi Peter, The best way to sequence tweens would be to use TimelineLite/Max. http://www.greensock.com/timelinemax the code would look like this: var myTween1:TweenMax = new TweenMax(path1, 5, {progress:1, repeat:-1, ease:Linear.easeNone}); var myTween2:TweenMax = new TweenMax(path2, 5, {progress:1, repeat:-1, ease:Linear.easeNone}); var myTween3:TweenMax = new TweenMax(path3, 10, {progress:1, repeat:-1, ease:Linear.easeNone}) //create a TimelineLite and pause it. var tl:TimelineLite = new TimelineLite({paused:true}) tl.append(myTween1); tl.append(myTween2, 1) // 1 second delay after myTween1 finishes tl.append(myTween3, 1) // 1 second delay after myTween2 finishes //you could also use appendMultiple() but the above syntax is easier to get started with. inside your button function you would tell the sequence to play with tl.play() That being said, the only thing I noticed that looked funny was that your tweens weren't paused, so I wonder why they are not playing immediately when you create them. I was expecting to see: var myTween1:TweenMax = new TweenMax(path1, 5, {progress:1, repeat:-1, ease:Linear.easeNone, paused:true}); also, as a general best practice it would be better not to have your timer function inside the MouseEvent function. all that being said, i really don't see why your code isn't working unless there is something wrong with how your tweens are being constructed. Will your tweens work if you take out all the timer and array code? from what I can tell: your tweens are in the array your timer fires 3 times your code for targeting the tweens in the array and telling them to play looks good if you want to zip up a simple fla, I can take it a look at it.
  14. its definitely strange, but I can only imagine something is happening in the file conversion. I guess we will know for sure when you run on CS5.5 and see if your array traces out, which I imagine it will as the tweens are working. have you saved your file in cs4 as a cs4 file? does that help at all?
  15. so you have a preloader swf that loads main.swf main.swf loads XML XML loads images main.swf also loads a bg swf it is unclear to me what preloader swf is doing. is that where you are tracking the total load of everything? in order to get main.swf sorted try putting _xmlLdr inside _ldrQueue. then _ldrQueue will be able to track the total progress of all the subloaders and report back to preloader.swf
  16. thank you for your diligent report. until you can figure out what is really in that array, the allTo is not going to be able to tween anything... and thus the errors.
  17. strange. make sure in flash cs4 the objects you are tweening have instance names. maybe they are getting lost in the conversion. comment out or remove all the code in your fla, add a simple movie clip to the stage, give it an instance name of mc. try a simple tween import com.greensock.*; TweenLite.to(mc, 1, {scaleX:5}); do you get errors? if yes, then there is something very wrong. if no errors, go to each tween in your file and prior to each tween trace out the target of the tween. trace(mc); TweenLite.to(mc, 1, {scaleX:5}); trace(home_mc); TweenLite.to(home_mc, 1, {scaleX:5}); ---
  18. i'm glad your problem is solved. what you added after that is a bit confusing though. are you loading the swf that contains the code you posted into another swf? requireWithRoot just means that loaders that you create in the current file will be calculated into the load progress of a parent swf. no where do you mention another swf, so I don't know what to advise here. if you need one loader to load after another, make sure the second loader doesn't load until the onComplete of the first loader has fired. you might do something like this function onLoadedBg(e:LoaderEvent):void{ xmlLdr.load(); }
  19. great question. open up the greensock folder. you will see a number of folders such as loading, easing, plugins etc (these are referred to as packages in programming terms) there are also .as files such as TweenLite.as, TweenMax.as, TimelineLite.as etc. (classes) when you do import greensock.*; the asterisk gives you access to all the as class files in the greensock folder. it does not give you access to all the as files inside easing or the other packages. that is why the easing classes have their own import import greensock.easing.*; here the asterisk means everything inside the easing folder or package. ------ if you start using loaderMax you will then need to import everything inside the loading folder import com.greensock.loading*; in short the * just gives you the as files in the folder that precede it.
  20. hmmm, that's very strange. There is no reason why adding more images would make it break. And as you expect that onComplete should only fire after the xml AND all the images are completely loaded. Is there a particular image that consistantly fails to load or do you know where the images stop loading? does the ioError ever fire? Do you only get errors when you try to access images after onComplete fires? Can you verify that the xml is fully loading and it is the version you expect? When testing in browsers sometimes the xml gets cached and you don't always get your recently saved version. Moving forward: First, make sure you are using the latest version of LoaderMax. Second, Find the breaking point. How many images makes it break? What image makes it break? just remove nodes in your xml until it works again. I really doubt the size of your xml/number of images has anything to do with it. Third, if you can't narrow it down any further feel free to post your files or something as simple as possible that we can work with that demonstrates the error seeing what is happening in the onComplete or whatever function that "targets the images that aren't loaded" -carl
  21. yup. the latest version works fine. my broken file got unbroken. thanks!
  22. to test if remove works do this: trace("pTween children before remove()" + parallaxTween.getChildren()); parallaxTween.remove(skyTween); parallaxTween.remove(fieldTween); trace("pTween children after remove() " + parallaxTween.getChildren()); it appears to be working fine. -------- I don't know exactly what you mean by an eventListener for currentProgress, but you can add an onUpdate to the TimelineMax that could test the value of currentProgress. -------- I regret that I don't have the time to troubleshoot and test your file extensively.
  23. do not use your Tween in an ENTER_FRAME handler. that will recreate it over and over and over and it will never have time to play. the only problem in your code is that you put the repeat and yoyo properties in where the glowFilter props are TweenMax.to(map_b, 1.75, { glowFilter:{color:0x990000, alpha:1, blurX:30, blurY:30, strength:2.5, quality:3}, repeat:10, yoyo:true });
  24. yes, that is the expected behavior. if you use a callback to modify an object's properties outside of the TimelineMax, that modification isn't going to undo itself when the TimelineMax plays again or reverses. take the following example: var tl:TimelineMax = new TimelineMax({repeat:5}); tl.append(TweenMax.to(mc, 1, {x:400})); tl.addCallback(fade, tl.duration); tl.append(TweenMax.to(mc, 1, {y:400})); function fade():void{ mc.alpha= .5 } once the fade callback gets fired, the mc will have an alpha of .5 on all subsequent plays. when you restart() your timelinemax you can run your own initialization function that resets all the stuff you modified outside of the TimelineMax. if you are doing things in reverse, it would be possible yet complicated to add callbacks that perform tasks only if the TimelineMax is reversed. [edit] i see you just figured this out for yourself. good job![/edit]
  25. assuming that code is part of a RESIZE event handler function, it could be a scope issue. declaring var:skyTween = new TweenMax... inside a function means that reference to skyTween is only valid inside that function when that function runs. can you trace(skyTween) before you remove it or attempt to delete it? what do you get?
×
×
  • Create New...