Jump to content

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!


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Carl

  1. try currentRiding = this["riding"+[i+1]]; if "this" doesn't work try _root basically it says evaluate the expression and use it to refer to an object with that name what you had before was just generating a String value that was the same as some object's name. its weird to explain.
  2. try removing the quotes in your array ridingArray = new Array (movie1,movie2,movie3); for (i=0;i TweenMax.to(ridingArray, 3, {colorTransform:{tint:0xff0000, tintAmount:0.5}, ease:Elastic.easeOut}); } Also, for an alternate approach you can try TweenMax.allTo which will automatically loop through an array of objects for you This one 1 line of code replaces your loop TweenMax.allTo(ridingArray, 3, {colorTransform:{tint:0xff0000, tintAmount:0.5}, ease:Elastic.easeOut}); notice how you just have to pass in the name of the array that includes all your objects that need to be tweened
  3. in AS3 you need an _ (underscore) before all the properties like _x _y _alpha so the code is simply TweenLite.to(movie1, 1.5, {_x:1000}); If you go to http://www.greensock.com/tweenlite/ and look at the Interactive Demo - Tweening Basics you can toggle between as3 and as2 code previews. The syntax for tween creation / control in the AS2 v AS3 versions is virtually identical except for this little _ issue, which only exists because AS3 removed the _ from all properties. Also, from the top of my head, a majority if not all the code examples on the site here are going to be in AS3 as it is more current. The AS2 version works great though and yes some of us still are required to AS2 for banners and such. welcome aboard Carl
  4. Carl


    I think this is just what the doctor ordered. I never knew about it til I just looked at the docs http://www.greensock.com/as/docs/tween/ ... lugin.html
  5. Glad to hear it worked. I know quite a bit about xml but I've never used LiquidStage. I STRONGLY suggest you check out the GreenSock ImageLoader. It allows you to load an image with one line of code like: //create loader var loader:ImageLoader = new ImageLoader("img/photo1.jpg", {name:"photo1", container:this, x:180, y:100, width:200, height:150", centerRegistration:true, onComplete:onImageLoad}); //begin loading loader.load(); read more here: http://www.greensock.com/as/docs/tween/ ... oader.html Its a lot to read as there are a TON of features, but it is the most painless way to load images AND the images are smoothed by default. for the time it takes to figure out how to load one image it will save you all the reading and hassle of figuring out how to manually create BitMapData thingies, copy pixels, apply smoothing and all that other nonsense. If you have time investigate LoaderMax which allows you to have all your external assets and their properties listed in a very clean XML file. LoaderMax will load the XML and then automatically load all your assets, place them where they need to be, and report the progress of how everything is loading. Furthermore you can prioritize the loading of your assets so if while image2 is loading the user wants to see image10 right away, no problem. LoaderMax jumps in, loads image10 and when its done it goes back to image2. there is a lot to read about and play with, but it is well worth the time investment. I can honestly say that after using LoaderMax on a project once, I will never load another mp3, swf, image or video without it. http://www.greensock.com/loadermax/
  6. wait, all 66 objects are moving? what happened to the business about moving an object from origin to point A back to origin to point B? i can see that I may have misunderstood your original question a bit but your latest post makes things even more confusing to me. in your loop try using insert instead of append. that will make all the tweens happen at once and not one after the other tl.insert(TweenMax.to(vballs[j],.1, {x:Bx[j], y:By[j], z:Bz[j]})); // Array with obj 1 coords if you are just starting to get a hang of AS3, this goal may be a tad ambitious. I'd suggest reading through the TimeliteMax documentation, and perhaps experimenting with some of the basics before tackling an integration with Away3D. even the little stuff is a lot of fun. good luck on your project.
  7. hello un4given, you are exactly right, you were creating the SplitTextField before your comments were loaded and inserted into the proper dynamic TextField. this will work import com.greensock.*; import com.greensock.easing.*; import com.greensock.TweenMax; import com.greensock.text.SplitTextField; //declare videoin outside of any functions var videoin:SplitTextField; var loader:URLLoader = new URLLoader() loader.dataFormat = URLLoaderDataFormat.TEXT loader.addEventListener(Event.COMPLETE, onLoadXML) loader.load(new URLRequest("expert.xml")) function onLoadXML(ev:Event){ try{ //Convert the downloaded text into an XML var myXML:XML = new XML(ev.target.data) var list:XMLList = myXML..title //walks the list and show in textfields for(var i=0; i //trace(list.@name+"-"+list.comments+" - "+list.image) this["Title_txt"+i].text = list.@name this["Comments_txt"+i].text = list.comments //populate videoin AFTER the xml has loaded and Comments_txt0 has its text property set videoin=new SplitTextField(Comments_txt0); var loader:Loader = new Loader() this["holder_mc"+i].addChild(loader) loader.load(new URLRequest(list.image)) } } catch (e:TypeError){ //Could not convert the data, probavlu because //because is not formated correctly trace("Could not parse the XML") trace(e.message) } } good luck with the rest of it. looks neat. Carl
  8. Hi toonzy, you can just loop through your coordinates arrays and append tweens to a TimelineLite/Max. this basic example provides a clear visual illustration of tweening an object from origin -> point a -> origin -> point b -> origin etc. http://www.snorkl.tv/dev/objectGoMultip ... index.html the code looks like this import com.greensock.*; var tl:TimelineMax = new TimelineMax({repeat:-1}); var objectsArray = new Array(red_mc, green_mc, blue_mc, orange_mc, pink_mc); var objectsCount:Number = objectsArray.length; //for every object or coordinate in an array do something: for (var i:int = 0; i //tween to the next object / point tl.append(TweenMax.to(ball_mc, .8, {x:objectsArray[i].x, y:objectsArray[i].y})); //tween back to the origin tl.append(TweenMax.to(ball_mc, .8, {x:origin_mc.x, y:origin_mc.y})); } cs4 source fla attached
  9. Carl

    Timeline Q

    as a followup to my last suggestion look here http://www.snorkl.tv/dev/fakeLoop/fakeLoop.html this approach is going to be the easiest to implement once your container has a duplicate of the first image at the end, the code for this example is simply import com.greensock.*; var tl:TimelineMax = new TimelineMax({repeat:-1, onComplete:reset}); var tweenCount:int = 0; while (tweenCount tl.append(TweenLite.to(container, 1, {x:"-150", delay:.5})); tweenCount++; } function reset(){ trace("complete"); container.x = 500; } cs4 fla attached
  10. Carl

    Timeline Q

    Hi beno, the code is working exactly as expected. your timeline starts out with image 1 on stage (it doesn't tween in) image 2 comes in from the right and pushes 1 off to the left image 3 comes in from the right and pushes 2 off to the left when you repeat... it jumps back to the beginning with image 1 just sitting there on the stage. if you want the first image to tween in from the right as the last image (3) tweens out to the left you have 2 options with your current setup: option 1) create a duplicate of the first image so your sequence will really be 1, 2, 3, 1. When the last image 1 is done tweening... then restart your timeline which will shift everything back to the starting positions option 2) as soon as image 3 is done sliding in (onComplete), reposition image 1 to the right of image 3 while image 3 slides out left also slide in image 1 from the right when that tween is done, tell the timeline to restart this works fine for a small handful of images. suppose you had 100 images you wanted to tween in such a sequence. It would be very difficult (performance wise) to tween them all at the same time. The best way to approach this is really to only tween 2 images at a time 1 - the image currently being displayed 2- the next image that needs to be displayed to see this concept in action take a look at this thing I made ages and ages ago with AS2 http://doyouhaveapen.com/junkyart/dynam ... ORIAL.html CLICK the button that says EXPANDED TUTORIAL MODE and follow the instructions. this little tutorial was built to show that you can literally navigate / scroll through thousands of thumbnails / objects by only moving the ones that need to move. the source file is ancient but the general concepts are quite valid. when I get into situations like this I often try to build my animation on the flash timeline or use a series of post-it notes on my desk so that I can visualize exactly what needs to happen... then I try to communicate what I need to happen with actionscript. The purpose of this forum is to help people understand the workings of the greensock tweening classes. As much as I enjoy helping, it isn't feasible to offer assistance through multiple phases of project development. Hopefully the advice given will be sufficient to allow you to chose a course of action for your next step. As always, I suggest starting with a very simple file (without buttons flying around and changing state) that allows you to tween through a series of just 3 images in a seamless loop. Once you get that hammered down you can integrate it into the larger project. Carl EDIT -since all your images are in 1 container that is being tweened, it will most likely be easiest just to do option1 and add another image 1 after image 3 in the container. you will just need to add 1 more tween to your timeline.
  11. Carl

    Timeline Q

    replace the first 2 functions in test.as with these: public function test() { BackgroundImages(); //getTweenCount(0); } private function BackgroundImages():void { var img_container:Sprite = new Sprite(); for (i; i { var img:Images = new Images(); img.ImagesArray = [bkgnd_imgs, "index.py", 1006,523, 0, 0]; img.x = 1006 * i; img_container.addChild(img); } addChild(img_container); var timeline:TimelineMax = new TimelineMax({repeat:-1}); while (tweenCount { timeline.append(TweenLite.to(img_container, 1, {x:-1006*tweenCount, delay:2, onStart:getTweenCount, onStartParams:[tweenCount]})); tweenCount++ } timeline.play(); } i made the same changes I suggested previously. when the timeline repeats, the first button is light blue when the first image is displayed give it try it should work c
  12. thanks for providing the converted file. it really helped me see what was happening. I appreciate that you stripped out all the non-essentials and made something that was easy to trouble-shoot. first you had code like this: inclick.addEventListener(MouseEvent.CLICK, goin); function goin(evt) { TweenMax.allFrom(videoin.textFields, 1, {y:50,x:300, autoAlpha:0}, 0.05); } outclick.addEventListener(MouseEvent.CLICK, goout); function goout(evt) { TweenMax.allTo(videoin.textFields, 1, {y:50,x:300, autoAlpha:0}, 0.05); } so when you first do a goin() all the characters TWEEN FROM x50, y300, alpha0 TO where they initially are positioned on the stage when the tween is generated. when you do a goout() they all go BACK TO x50, y300, alpha0 (works great) the next time you do goin() they try to TWEEN FROM x50, y300, alpha0 and guess what? they are already there, so there is no where to go and nothing to see. this is a great time to use TimelineLite as it will allow you to create the series of allFrom tweens once and then play() and reverse(); slam this into the file you sent import com.greensock.*; import com.greensock.easing.*; import com.greensock.TweenMax; import com.greensock.text.SplitTextField; var videoin:SplitTextField=new SplitTextField(test); //create a TimelineLite var textAnimation:TimelineLite = new TimelineLite(); //add your allFrom to the TimelineLite textAnimation.appendMultiple(TweenMax.allFrom(videoin.textFields, 1, {y:50,x:300, autoAlpha:0}, 0.05)); inclick.addEventListener(MouseEvent.CLICK, goin); function goin(evt) { //play the timeline forward textAnimation.play(); } outclick.addEventListener(MouseEvent.CLICK, goout); function goout(evt) { //reverse the timeline textAnimation.reverse(); } what is great about this is that you can jam on the in out buttons while the animation is playing in either direction and it switch direction seamlessly. If you have any questions let me know. Carl
  13. i can only view cs4 or lower fla. thx
  14. Carl

    Timeline Q

    Hi Beno, as a note it doesn't do much good if you provide files that can't compile because there are missing classes. the problem is tweenCount is never 0 the code: var tweenCount:int = 0; while (tweenCount++ { trace(tweenCount); } will output 1 2 3 possibly the reason things appear to work the first time around is because you have this public function test() { BackgroundImages(); getTweenCount(0); } which forces getTween to run with an argument of 0 (which probably generates your trace) ... but 0 is never generated in your timeline building loop while (tweenCount++ { timeline.append(TweenLite.to(img_container, 1, {x:-1006*tweenCount, delay:2, onStart:getTweenCount, onStartParams:[tweenCount]})); } timeline.play(); your code is incrementing tweenCount BEFORE the contents of the loop run. you could do var tweenCount:int = 0; while (tweenCount { trace(tweenCount); tweenCount++ } will output 0, 1, 2 give it a shot also to learn more about the post / pre ++ increment operator check out: http://livedocs.adobe.com/flash/9.0/Act ... #increment it helped me quite a bit.
  15. Carl

    Timeline Q

    Beno, thanks for the clear explanation. so it seems the root problem is that your case 0 isn't running on repeat of the timeline. if you go back to my original files that I attached, that example repeats and the proper values trace each time the timeline plays. so there is not anything internally wrong with the greensock files not firing the onStart function or passing in the onStartParams. it is always good to make sure you are using the latest com folder. are you using an old version perhaps. if you want to post a simplified fla file (cs4 or lower) I can try to look at it tonight. you should try to strip down (in a separate file) the timeline to a point where only 1or 2 simple tweens is happening and you can trace tweenCount every time the timeline repeats.
  16. Carl

    Timeline Q

    hi beno i don't really understand the question. what do you mean by "when the tween repeats"? do you mean the timeline? there is a big difference if something special has to happen at the end of the timeline to reset things you could try var timeline:TimelineMax = new TimelineMax({repeat:-1, onComplete:resetStuff}); // or maybe onRepeat:resetStuff function resetStuff(){ //do stuff to make the buttons do the right thing } thinking about it more in your switch statement you should be able to handle what needs to be done in case 0 or case 9 i really don't know what the problem is. The initial question was in regards to determining which tween was playing and now there is a lot more functionality involved with switching buttons around. It would probably help if you explained what exactly you were trying to accomplish. perhaps you can post a swf somewhere and describe what should happen and what is happening that is wrong. much easier than trying to decipher code fragments. Carl
  17. yeah, this is a real pain when dealing with Flash's pseudo 3D stuff. luckily smarter people than I have figure this out: http://www.kirupa.com/forum/showthread.php?t=349258 to apply the concepts from the link above with TweenLite/Max try: var startX:Number = mc.x; var startY:Number = mc.y; TweenLite.to(mc, 2, {rotationY:360, onComplete:kill3D}); function kill3D():void{ mc.transform.matrix3D = null; mc.x = startX mc.y = startY; }
  18. by using addChild() on the back movieclip you will put it on the top of the display list here is a very basic implementation TweenMax.to(front_mc, 2, {y:"100", repeat:-1, yoyo:true}); TweenMax.to(back_mc, 2, {x:"100", repeat:-1, yoyo:true}); front_mc.addEventListener(MouseEvent.CLICK, sendBack); function sendBack(e:MouseEvent):void{ //move the back to the front addChild(back_mc); } you can change the depths of the items being tweened and the tweens don't miss a beat. there are many methods available to re-sort object depths in the display list. read: http://www.republicofcode.com/tutorials ... splaylist/ or just search for "as3 display list change depths"
  19. just downloaded latest. compiles and runs fine : Flash CS4 : Mac
  20. Carl

    Timeline Q

    Thanks for adding those alternate options. I had a feeling there were some better ways. now I know. -c
  21. There isn't much that can be assessed from the code you displayed. are you sure that you are creating the SplitTextField AFTER the xml is loaded AND the textfield that is to be split has been populated with the text from the xml? if so, perhaps you can post more code or a very simplified example fla Carl
  22. Carl

    Timeline Q

    one way you could do it is like so. import com.greensock.*; import com.greensock.easing.*; var tl:TimelineMax = new TimelineMax({repeat:-1}); var tweenCount:int = 0; while (tweenCount++ tl.append(TweenLite.to(mc, 1, {x:tweenCount *50, delay:1, onStart:getTweenCount, onStartParams:[tweenCount]})); } tl.play(); function getTweenCount(currentTween:int):void{ trace(currentTween); //this function could be set to return a value //return currentTween //or set global variable to the value that you need. //tweenCount = currentTween } don't have time to explain but cs4 fla attached (no greensock classes) you might also use addLabel() when each tween is created and then call tl.getLabelBefore() or something similar
  23. Carl

    Timeline Q

    The value of whichPic will only change from 1 to 10 while the while loop is running. the loop will run virtually instantaneously. After the loop runs, the value of whichPic will be 10 for eternity. The playing of the timeline, or tweens in the timeline will have no effect whatsoever on the value of whichPic. make the following adjustments to your code: var timeline:TimelineMax = new TimelineMax(); whichPic=1; while (whichPic timeline.append(TweenLite.to(img_container, .1, {delay:6.5, x:-1006*whichPic}) ); ++whichPic; trace("while " + whichPic); } timeline.repeat=-1; stage.addEventListener(Event.ENTER_FRAME, whatsWhichPic); function whatsWhichPic(e:Event){ trace("enterFrame " + whichPic); } you will see the following output: while 2 while 3 while 4 while 5 while 6 while 7 while 8 while 9 while 10 enterFrame 10 enterFrame 10 enterFrame 10 enterFrame 10 enterFrame 10 enterFrame 10 enterFrame 10 enterFrame 10 enterFrame 10 enterFrame 10 enterFrame 10 enterFrame 10 enterFrame 10 ... in conclusion, the value of whichPic will always be 10. I have a hunch you may have meant to ask "how do i determine which tween is playing" or something similar. If so, please clarify. Carl
  24. hello Tom, to overwrite the default ease and have continuous motion on tweens that repeat try import com.greensock.easing.Linear; TweenMax.to(path, 20, {progress:1, repeat:-1, yoyo:true, ease:Linear.easeNone}); that's all I can help with -carl