Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

Search the Community

Showing results for tags 'as3'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GreenSock Forums
    • GSAP
    • Banner Animation
    • Jobs & Freelance
  • Flash / ActionScript Archive
    • GSAP (Flash)
    • Loading (Flash)
    • TransformManager (Flash)

Product Groups

  • Club GreenSock
  • TransformManager
  • Supercharge

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Personal Website


Twitter


CodePen


Company Website


Location


Interests

  1. I'm trying to check for the existence of an XML file — I'm doing this by doing a bogus load and returning the value of success or failure, thus: public static function RFIDExists($func:Function):void { var filename:String = RFID_READ_FILE; TTUtils.trc(7,"RFIDExists $func", $func); var loader:XMLLoader = new XMLLoader(SERVER_PATH + filename, {onComplete:function() {$func(true)},onIOError:function() {$func(false)}}); loader.load(); } Where $func is a function that will be called and take action based on the result. It works perfectly. My question is that the IDE keeps reporting errors such as Error on XMLLoader 'loader9' (http://localhost/tt/xml/scan.xml): Error #2032: Stream Error. URL: http://localhost/tt/xml/scan.xml Which is understandable, of course, but I don't want the program to 'crash' because I'm trying to load a file that isn't there. Is there a way to 'trap' this error so that it basically disappears? Is there another way (outside of AIR) to check for a file existence than this?
  2. I've been using XMLLoader to write XML files via a php script: private static function sendXML($xml:XML):void { // declaring var xmlcontents String. You should set this first. var xmlcontents:String = $xml.toString(); // declaring var SERVER_PATH String. This is the path for the saving-xml.php. var SERVER_PATH:String = TTConstants.SERVER_PATH + "/php/"; // declaring var foldername String. This is the folder container of the saved XML file var foldername:String = "../xml"; // declaring var dataPass URLVariables var dataPass:URLVariables = new URLVariables(); var previewRequest:URLRequest = new URLRequest(TTConstants.SERVER_PATH + "/php/ttwrite.php"); previewRequest.method = URLRequestMethod.POST; // setting dataPass variables to be passed to PHP dataPass.filename = USER_XML_FILENAME; dataPass.xmlcontents = xmlcontents; dataPass.foldername = foldername; // passing dataPass data PHP previewRequest.data = dataPass; var loader:XMLLoader = new XMLLoader(previewRequest, {onComplete:serverSendComplete,onIOError:onIOError,onSecurityError:onSecError,onError:onError}); // calling the PHP or loading the PHP loader.load(); } I want to call a PHP script to simply delete ("unlink") an xml file on the server. Can I use XMLLoader to do this as well (for ease of complete and error functions -- callbacks instead of adding/removing event listeners)? There's no XML loading involved, so I don't know if it's 'kosher' - var deleteRequest:URLRequest = new URLRequest("http://localhost/tt/php/ttdelete.php"); deleteRequest.method = URLRequestMethod.POST; var loader:XMLLoader = new XMLLoader(deleteRequest, {onComplete:serverDeleteComplete,onIOError:onIOError,onSecurityError:onSecError,onError:onError}); // calling the PHP or loading the PHP loader.load();
  3. I have a bunch of TweenLite stuff working wonderfully by adding the AS3 code on the timeline. Now I am trying to add a MovieClip dynamically with: var blackfadeMC:blackFade = new blackFade(); addChild(blackFadeMC); Inside the blackFade.as class I have some TweenLite stuff going on that works fine if I just drag and drop the MovieClip to the stage, but when I add it dynamically with the code above, I get these errors: TypeError: Error #1009: Cannot access a property or method of a null object reference. at blackFade/fadeOut()[/users/joe/Documents/Work/Kim's Castle/blackFade.as:20] at Function/http://adobe.com/AS3/2006/builtin::apply() at com.greensock.core::TweenCore/complete()[/users/joe/Documents/Work/Kim's Castle/com/greensock/core/TweenCore.as:178] at com.greensock::TweenLite/renderTime()[/users/joe/Documents/Work/Kim's Castle/com/greensock/TweenLite.as:477] at com.greensock.core::SimpleTimeline/renderTime()[/users/joe/Documents/Work/Kim's Castle/com/greensock/core/SimpleTimeline.as:93] at com.greensock::TweenLite$/updateAll()[/users/joe/Documents/Work/Kim's Castle/com/greensock/TweenLite.as:642] I have noticed it's the first line, where I declare the object variable, that is causing the problems. If I comment my two lines of code out then there's no errors, but if I just uncomment that line beginning with "var" then it spazzes out again. New to TweenLite so if it's something obvious I do apologise! Thanks for the help
  4. I'm playing a video loaded through VideoLoader and looping it when it's complete _videoLoader.addEventListener(VideoLoader.VIDEO_COMPLETE,videoCompleteHandler,false,0,true); private function videoCompleteHandler($event:Event):void { _videoLoader.gotoVideoTime(0,true); } I'm getting a slight pause on looping, which I guess is understandable, but it's not pretty. Any suggestions on how to avoid? I know with an FLVPlayback (I believe) one can load a video into different layers and switch them on and off. Can I do something similar here? Grab two copies of the video from the VideoLoader? Or do I simply need to load the video twice, with two VideoLoaders? Or…… Thanks for any advice!
  5. This is almost certainly a bug in my code, but I'm moving some elements forward in z-space (that is low to high z) using TweenMax's in a TimelineMax // pseudo code TLM:TimelineMax = new TimelineMax; for (var i:int = 0; i< someNumber; i++) { var tw:TweenMax = new TweenMax(anAsset,TWEEN_TIME,{onUpdate:doUpdate,onUpdateParams:["{self}"],z:someFinalZ}); TLM.add(tw,TWEEN_Time/i); } private function doUpdate($tw:TweenMax):void { sortElementsOnZPosition(); // sort all the elements display position based on z, using addChild() if (something) { $tw.timeScale(0.5); // slow down } else { $tw.timeScale(1); // set back to normal } } Sometimes I want to slow down the tweened elements' z-motion (and in a separate call I'm moving them on x axis), but when I want to set the tween back to normal speed, they suddenly jump forward in z-space, as if they were suddenly set back to where they'd been if they'd never been slowed. There's a lot going on behind the scenes, including addChild()-ing the elements (based on a z-sort), etc. Surely something in my code, but the tweens are pretty separate from everything else, so I'm wondering if there's something related to timeScale of Tweens in a Timeline that I'm missing. Thanks!
  6. I have a function set up to play a loaded MP3 by name string: protected function playSoundByName($name:String):void { // trace("play sound by name ", $name, LoaderMax); _currentSound = LoaderMax.getContent($name); // trace("current sound is ",_currentSound); if (_currentSoundChannel) _currentSoundChannel.stop(); // trace("the sound is ", _currentSound,_currentSound.length,_currentSound.url); _currentSoundChannel = _currentSound.play(0); _currentSound.addEventListener(Event.SOUND_COMPLETE,soundComplete,false,0,true); } Which works fine when I call it directly, but not when I call it from a callback in a TimelineMax (see below -- the first call works fine, the one from inside the TLM does not). I'm sure I'm missing the obvious, but it's a big problem…Thanks… var introSoundsTL:TimelineMax = new TimelineMax({ease:Linear.easeNone}); playSoundByName("jsTexasSurf"); // works! introSoundsTL.addCallback(playSoundByName,0,["jsTexasSurf"]); // the sound from LoaderMax.getContent() in called function is null! (The loaded xml is in this form: <?xml version="1.0"?> <content> <timelimit limit="45" /> <MP3Loader url="music/jetski/321go.mp3" name="js321Go" autoPlay="false" load="true" /> <MP3Loader url="music/jetski/pg3-300beachs.mp3" name="js300beaches" autoPlay="false" load="true" /> <MP3Loader url="music/jetski/pg5-texassurf.mp3" name="jsTexasSurf" autoPlay="false" load="true" /> </content> )
  7. I have a situation where I want to have a number of objects tweening from different starting points towards a common goal. They are moving in the same direction, and should move at the same pace. I also want to get rid of the object when it reaches its goal, and add a new one (or the same one) at the back of the queue. Picture a line of people moving forward in a queue: they shuffle forward slowly, all at the same speed. We start the queue with a line already formed, that is, we 'open the scene' with the line in place. Is there a way to do this with TimelineMax? I had thought of something like this _mainTimeline.to(_people,TIME,{z:"+=1000"},"+=1"); But they won't all end up at the same end point. If I substitute a fixed end point (i.e. z:1000) then they won't move at the same pace, since they distance they must cover is different. I also need to figure out a way to keep adding and removing from the queue. I suppose the answer might be to maintain an array of TweenMax's, or simply to do old-school ENTER_FRAME +='s, but I very much like the robustness of TimelineMax
  8. I've solved this, but I have no idea how, and I'm trying to understand what happened. I have TImelineMax's set up in a class. One of them is this, super-simple -- I use it to have a person 'escaping' or not escaping -- if they are escaping, they move off screen, if you click, the timeline is reversed and they come back. Instantiations of this class are being moved in z-space forwards, in a timelinemax which contains repeat = -1 tweenmaxes (as per Carl's great help) -- when the person disappears off screen in the distance I reset this timeline to get them not escaping anymore. I was using gotoAndStop(0) but now am using seek(0), pause() -- the reset can happen while the timeline is moving forwards, or reverse. _escapeString = Math.random() > .5 ? "+=" + ESCAPE_DISTANCE : "-=" + ESCAPE_DISTANCE; _escapeTimeline = new TimelineMax({paused:true,onStart:tlStart,onComplete:tlComplete,onReverseComplete:tlReverseComplete,ease:Linear.easeNone}); _escapeTimeline.add(new TweenMax(this,ESCAPE_TIME,{x:_escapeString,ease:Linear.easeNone})); As I said, I solved it, somehow -- but as I don't like unknown unknowns, my question is: apart from kills(), is there anything else that would make the duration() of a timeline == 0, and the progress() == NaN ? That's what was happening. But the timeline itself existed, i.e. != null.
  9. If you have more than one loaded asset with the same name, how does LoaderMax.getContent() resolve that? I have a lot of assets to load -- maybe 70 mp3s, and while I can make sure no names ever duplicate, I'm wondering whether it's not easier to use the instance version of LoaderMax's getContent, rather than the static. What is the best practice? Thanks!
  10. Hi, Probably very simple but i cant seem to get my head around timelineMax. I have a movieclip (spinY_mc) that i want to play backwards when i click a back button (back_mc). back_mc has various conditions and is done as a Click event. Can you help?
  11. I've been trying to work up a 'shaking' effect on elements, using RoughEase. Rotations, x, y all get stuck at the end and don't return to their original spots, as yoyo:true, repeat:1 would seem to indicate they would. (centPoint is stageWidth/2, stageHeight/2) —I'm sure I'm missing something but I was curious whether doing yoyo and repeat with transformAroundPoint and RoughEase was a problem in some way… private function makeNewShakeUpTimeline($objects:Array):TimelineMax { var tl:TimelineMax = new TimelineMax; var centPoint:Point = new Point(TTConstants.FULL_WIDTH/2,TTConstants.FULL_HEIGHT/2); var dirx:String = Math.random() > .5 ? "+=20" : "-=20"; var diry:String = Math.random() > .5 ? "+=20" : "-=20"; tl.add(TweenMax.to($objects,.5,{transformAroundPoint:{point:centPoint},rotation:dirx,yoyo:true,repeat:1,x:dirx,y:diry, ease:RoughEase.ease.config({clamp:false,points:50,strength:3})}),0); dirx= Math.random() > .5 ? "+=10" : "-=10"; diry = Math.random() > .5 ? "+=10" : "-=10"; tl.add(TweenMax.to($objects,.25,{transformAroundPoint:{point:centPoint},rotation:dirx,yoyo:true,repeat:3,x:dirx,y:diry, ease:RoughEase.ease.config({clamp:false,points:40,strength:2})}),.5); dirx= Math.random() > .5 ? "+=5" : "-=5"; diry = Math.random() > .5 ? "+=5" : "-=5"; tl.add(TweenMax.to($objects,.25,{transformAroundPoint:{point:centPoint},rotation:dirx,yoyo:true,repeat:3,x:dirx,y:diry, ease:RoughEase.ease.config({clamp:true,taper:"out",points:30,strength:1})}),.75); return tl; }
  12. As I understand it, a Timeline is set up so that it uses the values of variables at the time the timeline is created. Thus, if n=100 tl.to(mc,1,{x:n}); will move mc to x = 100. What happens if I do var n:int = 100; tl.addCallback(function() {n = 200}); tl.to(mc,1,{x:n}); More importantly, what if I want the timeline to use values that are determined at the time the timeline plays? (Yes, I could do a test of above, but I'm trying to understand this once and for all, conceptually — I'm setting up complex timelines with many moving parts and subcalls, and trying to understand what is called/evaluated now and what is called/evaluated later). Thanks for any insight(s)!
  13. This is another no-brainer that's puzzling me. If someone could show me the error of my ways I'd be grateful. In this code tl.to(startButton,0.25,{autoAlpha:1}, "+=1"); tl.addCallback(waitForStartButtonPush,"+=0.01"); tl.to(startButton,0.25,{autoAlpha:0}, "+=.01"); where "tl" is a timelinemax appended to the main timeline and 'startButton' is a movieclip on stage, followed by private function waitForStartButtonPush():void { _mainTimeline.pause(); startButton.addEventListener(MouseEvent.CLICK,startButtonClick,false,0,true);} the issue I was having is that the startButton was only tweening partway to autoAlpha== 1. I solved this by putting the autoAlpha tween inside waitForStartButtonPush(), before I paused the main timeline, but I was unclear why it wasn't working the first way — why is the call to mainTImeline.pause getting called partway through the tween? It may be something in the way I've ordered my timelines, but I wanted to know if there's a reason I'm missing in the way I'm timing things.
  14. This seems like it should be a no-brainer, but I've searched the API and can't see how to kill a Tween(Max) and force it to complete. I see how to kill ALL tweens and force to complete, or child tweens of a particular object and force them to complete, but for a TweenMax I didn't see the option to force to complete. Could someone point me in the right direction? Thanks!
  15. I've been making good use of TimelineMax's convenience methods: timeline.to(....), etc. As I understand it, these are syntatic sugar for timeline.add(Tweenlite.to(...)), etc Is there a way to change it so that the convenience methods would instead use TweenMax? Ran into an issue where I was trying to use 'yoyo' but wasn't working…and it's because TweenLite doesn't offer 'yoyo', I believe. I offer it as a suggestion for future releases, if it's not currently implemented.
  16. I need to 'spin' a coverflow that will go from the start element to another random element after looping through the entire coverflow list a couple of times. That is, let's say you were spinning a wheel like the wheel of fortune (the game show) -- you have integers on the wheel that range from 0 to 8 (or whatever) -- you are staring at some random place (e.g. 3) and will simulate a random spin to another value (e.g. 6) -- you have different spin directions -- the user can spin left and right. In this case, it's not a wheel, so I can't use rotation — it's a coverflow, and I need to update the coverflow graphics each time an element changes (bring the new one to center, move the other ones to the side). My two questions are: 1) does it make sense to do this with some kind of discontinuous tweening? Perhaps I could use TimelineMax, but trying to make a smooth animation of the several tweens that would be added to the timeline seems a bit awkward. I'd have to calculate the TweenLite times based on where I started and ended. Is there any way to use some kind of rotation tween of the current element number? 2) what's the best way to do a complex graphics update mid tween? Sometime that takes longer than a split second? Perhaps, now that I consider it, a tween might not be the best way to go, or even a timeline — perhaps I simply have to move the index one element at a time, updating the graphics at each turn, and not rely on tweening to do it for me, but I was curious… Thanks for any help.
  17. Is there any built-in functionality to the gs platform to allow the discrete tweening of variables? That is, if I want to tween a var from 0 to n in discrete, integral steps?
  18. Just downloaded the latest 'bonus' AS3 files and am getting strange TimelineMax errors, in particular it doesn't seem to grok 'to' and 'from" -- the funny thing is I haven't touched the code generating the error recently -- It just started when I grabbed the new libraries -- it's happening with TImelineMax .to() and .from() 1061: Call to a possibly undefined method from through a reference with static type com.greensock:TimelineMax. -- and stopped when I put the old libraries back
  19. Today is the day of many Timeline questions — thanks for your help and patience. I'm interested to the extent of which multiple nested timelines are "baked in the cake", that is how much you can change not-yet-played timelines on the fly. Can you update the child timelines and tweens before the parent is played and while it is playing? Also I was experimenting with the ability to play timelines independent of their parents. Apparently it doesn't work. That is, if you have a timeline added to another timeline, you can't seem to play() the child timeline prematurely. Is this true? I then tried removing it from the parent timeline in a callback, but that seemed to make no difference. Only if I created an entirely new child timeline in the callback could I play it immediately. I assume this is all as it should be, but could someone explain why? This, for instance, failed var main:TimelineMax = new TimelineMax({paused:true}); var one:TimelineMax = new TimelineMax; var two:TimelineMax = new TimelineMax; one.to(aSquare,3,{onUpdate:function(){trace('in one')},x:"+=300"}); one.to(aSquare,4,{onUpdate:function(){trace('in one 2')},y:"+=300"}); two.to(aCircle,2,{onUpdate:function(){trace('in two')},y:"-=200"}); main.addCallback(dochange,1); main.append(one,0); main.append(two,3); main.play(); function dochange():void { trace("removing two"); trace(two.timeline); // has a parent main.remove(two); trace(two.timeline); // has no parent two.play(); // won't play nonetheless until already set place in parent. }
  20. Is there any reason one can't TweenMax.updateTo() a TweenMax nested inside a TimelineMax? I'm sure it's me, but it's driving me crazy. I do this (I have an object being tweened from z:500 to z:0 or something like that, but not on x), thus (simplified): _obstacleTimeline.add(TweenMax.to(obstacle,OBSTACLE_SPACING-1,{z:obstacle.finalZ})); and later $tween.updateTo({x:stage.stageWidth,autoAlpha:0,ease:Quint.easeIn},false); and the object that's being tweened does what it's supposed to and then goes _back_ a way in z-space and comes forward again from the left. I'm not restarting the tween (updateTo(...,true)). Again, I'm sure it's me, but have been checking this for 1/2 hour and see no errors on my part…
  21. UPDATE: The question below is still valid — but in the end I'm going to be playing parts of an already established timeline (as detailed in another post) so I believe that simply stopping the main timeline and playing my other one and continuing the main one is the best option, unless there's a way to insert a section of a timeline into another timeline I have a game that runs by playing one grand timeline from start to finish. The variations in game play occur by simply updating some individual tweens if the players hits a target, etc — the main timeline keeps running. I've just been informed that sometimes though something else should happen — a very complex series of things perfectly suited for another timeline. What would be the best way to do this? 1) Pause the main timeline and set up and play my subsidiary timeline? -- OR -- 2) Create my subsidiary timeline and simply insert it into the main one at the current time? "2" seems more elegant to me as I don't have to start/stop the maintimeline and also listen for when the second timeline ends, but I'm not sure how it would work. Could I just (pseudo code) mainTimeline.insert(newTimeline,mainTimeline.currentTime)?
  22. If one has has a long timeline with various 'sections', which one could delineate by labels, what is the best way to know when it has played through a section? Is there a way to 'listen' for a tlmeline passing through labels — or is the best way to add a callback at the end of each section which would dispatch an Event? PSEUDO CODE _timeline.addLabel('start section 1',_timeline.totalDuration()); _timeline.to(...); _timeline.addLabel('end section 1',_timeline.totalDuration()); // can I detect when this passes? _timeline.addCallBack(dispatchAnEvent(finishedSection1),_timeline.totalDuration()); // or is this the only way? Thanks for any help.
  23. SOLVED Forgive me in advance, please, if this is very basic — I'm setting up timelines (TimelineMax'es) and building them with relative offsets, e.g _tutorialTimeline.to(swipeToAvoid,0.25,{autoAlpha:1},"+=.5"); // add 'swipe to avoid'_tutorialTimeline.to(obstacle,4,{autoAlpha:1,z:-500},"+=1"); // move forward I'd like to be able to add labels at particular sections, so I can go back and play sections of the tutorial timeline above later, separately from the rest. From what I can see I have to add labels at particular times, like '3 seconds' -- and of course I could keep a running total of my relative times, but that seems ugly. Is it possible to pass a label in to the ().to method above to add a label with that tween, or would I need to do something else, like get the current length of the timeline in progress and use that as the time? How would I best do that? My second question is related: the tutorial timeline is added (after it's built) to a main timeline, and played as part of that. If later I want to play the tutorial timeline sections separately (as per above), I can just do that, even though it's 'included' as part of a larger timeline, as long as I have a reference to it? If not, do I need to clone it in some fashion? Thanks!
  24. I am trying to create a rough ease by copying the sample code on the site (switching random from 'false' to 'true') but am getting errors. The code var rough:RoughEase = new RoughEase({strength:3, points:50, template:Strong.easeInOut, taper:"both", randomize:true});And the error 1118: Implicit coercion of a value with static type Object to a possibly unrelated type Number. I'm unclear what I'm doing wrong. Any help appreciated. UPDATE: Tried using the default RoughEase.ease easing tl.to($objects[i],TTUtils.getRandomNumber(0.25,.5),{rotationZ:rotationZ,ease:RoughEase.ease}); and got this error: 1119: Access of possibly undefined property ease through a reference with static type Class. I'm including com.greensock.easing.*. Hmmmmm…
  25. I know that when you nest timelines within timelines, you need to have the child-timelines be 'playable', that is not have paused == true. I'm creating complex timeline(maxe)s within separate functions and then adding them to the main timeline. This seems to work, but I feel uneasy — I don't know how the child timelines 'know' to remain paused until they are added to the main timeline. I believe I read here on the forums that a timeline will wait until the next enter-frame to start -- but how do I really know when that is? Thus, in pseudo code, I have something like this _mainTimeline = new TimelineMax({paused:true}); createChildTimelineOne();// not paused createChildTimelineTwo();// not paused _mainTimeline.append(_childTimelineOne); _mainTimeline.append(_childTimelineTwo); /// ... and so on.../// _mainTImeline.play(); Why//how do I know this will always work?
×