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. that's a lot of code to digest. are you talking about the onComplete listeners not working or your buttons? have you tried putting traces in your listener functions to verify that they are being fired? also, if your timeline's simply aren't playing when you click buttons you could try restart().
  2. of it is working and you understand it, I'd say stick with it. whenever you have multiple functions that do pretty much the same thing addChild start playing a video remove eventListeners there are always ways of optimizing further. you could make a function like: function playVideo(videoToPlay):void{ videoCont_mc.addChild( videoToPlay.content ); videoToPlay.gotoVideoTime(0, true); monitorFlyOut.removeEventListener(VideoLoader.VIDEO_COMPLETE, done); } your button code would look like this: function boardroomOut(event:MouseEvent):void { playVideo(boardRoomFlyIn) } function serverRoomOut(event:MouseEvent):void { playVideo(serverRoonFlyIn); } ... all this does is minimize the repetition of similar code and also makes it easier if you want to add functionality to every video when it plays. perhaps you want the volume to be set at .5. You could just adjust the playVideo() function in one place to have some volume code then all videos would have the same starting volume.
  3. Tweening a variable is no different than tweening the x property of a movie clip. I understand how the concept can sound weird at first. I have a tutorial and source files here: http://www.snorkl.tv/2010/09/how-to-twe ... tweenlite/ an important thing to note is that while you are tweening the variable, you most likely want to display it somehow. by using an onUpdate callback you can run a trace or update a textfield. here is some sample code: import com.greensock.*; import com.greensock.easing.*; var score:Number = 0; var targetScore:Number = 20; TweenLite.to(this, 1, {score:targetScore, onUpdate:showScore, ease:Linear.easeNone}); function showScore(){ trace(score); score_mc.score_txt.text = int(score); }
  4. here is an example fla with mov. it will stop looping as soon as you press "stop looping" button. here is the code: import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import flash.events.MouseEvent; output_txt.text = "video will loop until you hit stop looping button"; var video:VideoLoader = new VideoLoader("angrybirds.mov", {container:this}); video.addEventListener(VideoLoader.VIDEO_COMPLETE, done); function done(e:LoaderEvent):void{ video.gotoVideoTime(0, true); } stop_btn.addEventListener(MouseEvent.CLICK, stopLoop); function stopLoop(e:MouseEvent):void{ video.removeEventListener(VideoLoader.VIDEO_COMPLETE, done); output_txt.text = "looping off"; } video.load(); i think your problem is that you define your VideoLoader var inside a function. When you do that, the variables that you create inside a function can not be accessed outside the function. declare your VideoLoader var outside any functions like in my example.
  5. you are welcome. glad you got it working. I'm confident flash isn't going away, but there may be a slight shift in what it's used for. As far as online advertising / banners go... I don't think the big companies are anywhere near ditching Flash. its a proven solution that works great and the user-base that has "up to date browsers that support the emerging standards" is way too small. What's happening now with Flash / Air for game development on mobile devices is also very exciting. --- I'm happy to help people that are eager to learn. Best, Carl
  6. you need to create a LoaderMax before you can append things to it. LoaderMax is most useful when loading multiple images. you need to do: var queue:LoaderMax = new LoaderMax() somewhere before you use queue.append. you also need to tell your queue to load() if it is only 1 swf you are loading just do: var mySwf:SWFLoader = new SWFLoader("SlideBar.swf", {width:300, height:100, container:this, onComplete:completeHandler}) ); mySwf.load(); function completeHandler(event:LoaderEvent):void { TweenMax.to(event.target.content, 1, {x:-10, y:530, repeat:-1, yoyo:true}); }
  7. you're welcome. let me know if it works for you. carl
  8. I've attached a basic example here is the code: import com.greensock.*; import flash.events.MouseEvent; window.alpha = 0; var windowShowing:Boolean = false; var windowTween:TweenLite = TweenLite.to(window,.5,{alpha:1,paused:true}); toggle_btn.addEventListener(MouseEvent.CLICK, toggleWindow); function toggleWindow(e:MouseEvent):void { //this makes windowShowing the opposite of what it is, if true then switches to false //if false then switches to true windowShowing = ! windowShowing; if (windowShowing) { //do something to show your window windowTween.play(); } else { //do something to hide the window windowTween.reverse(); } }
  9. for the first error add this import import com.greensock.events.LoaderEvent; your other 2 warnings are probably related to other code that you have.
  10. In cases like this, it is likely that TweenLite isn't doing what you expect because you are asking it to tween something that doesn't exist, not that it can't tween a bitmap. right above your TweenLite tween add: trace("tempScore.bitmap = " + tempScore.bitmap); if you get null or undefined than you have to find out why. ------- after looking through your code, inside a function you have: var tempScore:Score = new Score(5, 1315, 5, 995); by putting var in there that means that the variable is only accessible in the scope of that function. try tempScore = new Score(5, 1315, 5, 995);
  11. inside the activate function the term btn refers to the btn you clicked. you should be able to use btn.nav_titles_txt.text to target the text.
  12. if billboard_mc is displayed with a TweenLite tween you could do something like: TweenLite.to(billboard_mc, .5, {alpha:1, delay:30, onComplete:playVideo); function playVideo(){ //tell the video to play } without knowing how you embedded the video, what its called or exactly what you are doing there isn't too much we can do to help. your best option is to upload a zip of your files with a VERY VERY small sample video in place of the video you are using.
  13. quite a bit. here is a simplified as2 approach. file attached import com.greensock.*; import com.greensock.easing.*; import com.greensock.plugins.*; TweenPlugin.activate([TintPlugin]); //create reference to the currently active button var currentButton:MovieClip; b1.onRelease = function(){ activate(this); } b2.onRelease = function(){ activate(this); } b3.onRelease = function(){ activate(this); } function activate(btn){ //de-activate currentButton if there is one if(currentButton){ TweenLite.to(currentButton, .5, {tint:0x0000}) } //activate the button that was clicked TweenLite.to(btn, .5, {tint:0xff6600}); currentButton = btn; }
  14. Hi Scott, I created a tutorial that deals with activating / de-activating buttons http://www.snorkl.tv/2010/11/create-a-s ... y-clicked/ let me know if you have any trouble Carl
  15. yeah, i think the way you have things structured isn't exactly like the tutorial. and I would suggest putting your code on Frame 1 of the main timeline instead of putting it inside movie clips.
  16. this is the line that is throwing the error: navBar_mc.setChildIndex(event.target as MovieClip, 1); if you trace event.target.name it is myWorkHit i'm guessing myWorkHit can not get shifted around by navBar_mc.setChildIndex(); ----- do this: function myWorkOver (event:MouseEvent): void { trace(event.target.name); // displays myWorkHit TweenLite.to(navBar_mc.myWork_mc.myWorkBtn, .2, {y:-4, ease:Back.easeOut}); TweenMax.to(navBar_mc.myWork_mc.myWorkBtn.orangeMyWorkBtn, .2, {colorTransform:{tint:0xffff66, tintAmount:.4}}); //navBar_mc.setChildIndex(event.target as MovieClip, 1); dropMenu_mc.gotoAndStop(event.target.name); } and then inside dropdown_mc, change the frame label to myWorkHit the drop down will at least show up when you rollOver work.
  17. sequencing tweens can get a little hairy without TimelineLite. the trick is to keep track of the start time (delay) of all the tweens and keep a tally of the duration and delays of all the previous tweens. that's what I'm doing with "newDelay" below. I put together a little demo of 3 panels that perform a simple slide sequence that runs 3 times. after the third time, slogan comes in and the banner stops. the code looks like this: import com.greensock.*; //http://www.greensock.com/overwritemanager/ OverwriteManager.init(2); //where everything starts var startX:int = -300; var startY:int = 0; //where everything tweens to var onX:int = 0; var offX:int = 300; var duration:Number = .5; var delay:Number = 1; //keeps track of how much time has elapsed in all previous tweens including all durations and delays var newDelay:Number = 0; //how many times the sequence has played and needs to play var playCount:Number = 0; var maxPlayCount:Number = 3; //reset starting values of all clips function init(){ slogan.x = startX; slogan.y = startY; message1.x = startX; message1.y = startY; message2.x = startX; message2.y = startY; playSequence(); } function playSequence(){ //bring slogan in TweenLite.to(slogan, duration, {x:onX}); newDelay = duration + delay; //push slogan out and bring message1 in TweenLite.to(slogan, duration, {x:offX, delay:newDelay}); TweenLite.to(message1, duration, {x:onX, delay:newDelay}); newDelay += duration + delay; //push message 1 out and bring message 2 in //when message 2 is in, check to see if the sequence should restart from beginning TweenLite.to(message1, duration, {x:offX, delay:newDelay}); TweenLite.to(message2, duration, {x:onX, delay:newDelay, onComplete:checkSequence}); } function checkSequence(){ playCount++; if(playCount //restart the whole thing over TweenLite.delayedCall(delay, init); }else{ trace("end"); //custom end sequence to push message2 out and bring slogan in TweenLite.to(message2, duration, {x:offX, delay:delay}); slogan.x = startX; TweenLite.to(slogan, duration, {x:onX, delay:delay}); } } init(); it would probably be a bit easier to put all your panels into 1 movieclip and just move that movie clip around, but that wouldn't work so well with fading in/out
  18. Hello Orbik, It seems the majority of your troubles is coming from responding to a given video being done playing. you can set up an event listener for VIDEO_COMPLETE and then trigger whatever function you like. the basic setup is like this: import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; var viewer:VideoLoader=LoaderMax.getLoader("assets/hole1reverse.f4v"); viewer.addEventListener(VideoLoader.VIDEO_COMPLETE, done); //this function will run when hole1reverse.f4v is done playing. function done(e:LoaderEvent):void{ trace("done"); //tell another video to play } see if that helps get things working how you would like. the code you posted is a bit long to easily digest.
  19. Hi Craig, For non-linear motion have a look at the bezier and bezierThrough plugins in the plugin explorer. http://www.tweenmax.com enjoy carl
  20. TweenMax can be used just fine in external .as files. make sure: you are using the AS3 version of GreenSock your com folder is in the same folder as your fla if you want to post a simplified version of the files that are giving you a problem we could try to trouble shoot it more.
  21. I'm having a difficult time visualizing this. can you post a very simple fla that just has 1) this button that moves when you rollover it and that moves off stage when you click 2) a button that will bring the previously mentioned button back on stage. it would be much easier if we could see the exact animation that is taking place. what you are describing doesn't really seem like one linear timeline and I don't know if there is going to be an easy way to play a timeline backwards with different values. you may need to have multiple timelines to make it work
  22. I haven't done this myself, but if you start with GreenSock's response here: viewtopic.php?f=1&t=5706&p=22071&hilit=tween+matrix3d#p22071 you should have a good starting point. I highly recommend reading the AS3 docs on Matrix3D that he links to.
  23. you can draw one with the graphics drawing API import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; var myImage:ImageLoader = new ImageLoader("car.jpg",{container:this,x:10,y:10,onComplete:drawStroke}); myImage.load(); function drawStroke(e:LoaderEvent):void { var img:Sprite = e.target.content; img.graphics.lineStyle(2, 0xff0000, 1, false, LineScaleMode.VERTICAL, CapsStyle.SQUARE, JointStyle.MITER); img.graphics.drawRect(0,0,img.width,img.height); }
  24. its late so I don't have time to test this but give your queue an onChildComplete handler like: var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler, maxConnections:1, onChildComplete:imageLoaded}); and then: function imageLoaded(e:LoaderEvent):void{ TweenLite.to(e.target.content, 1, {alpha:1}); } each image will fade in as soon as it loads. since your maxConnections is 1 they should all fade in in sequence. /////// if you want to wait til they all are loaded, you can tweak your completeHandler(). to get an array of all the loaders: var allMyLoaders = queue.getChildren(); then you could loop the through the array of loaders and do a TweenLite on each loader and increment the delay the first option should work fine for you.
  25. when people use "..." it just means "put your own code" here the only thing you could do is possibly build your timeline with a loop: var john:TimelineMax = new TimelineMax({repeat:-1}); for(var i:int = 1; i john.append(TweenMax.to(this["b" + i], 1, {scaleX:1, scaleY:1, rotation:360})); john.append(TweenMax.to(this["b" + i], 1, {scaleX:.8, scaleY:.8, rotation:360})); } but with only 4 items that are being tweened it is by no means necessary
×
×
  • Create New...