Jump to content
Search Community

Carl last won the day on December 24 2023

Carl had the most liked content!

Carl

Moderators
  • Posts

    9,827
  • Joined

  • Last visited

  • Days Won

    546

Posts posted by Carl

  1. the following will fade a sound in over 1 second after a 3 second delay. you can call myFunction however you like, for the onComplete of a TimelineMax, TweenMax, delayedCall... whatever

     

    var sound:Crunches = new Crunches();
    var chompSound:SoundChannel;
    
    TweenLite.delayedCall(3, myFunction)
    
    function myFunction(){
    chompSound = sound.play();
    TweenMax.fromTo(chompSound, 1, {volume:0}, {volume:1})
    }

     

    sound.stop() won't work as stop() is a method of SoundTransform, not Sound. could they make this more confusing? :shock:

    this helps a lot: http://www.republicofcode.com/tutorials/flash/as3sound/

  2. hello groovdafied,

     

    from what I can muster I'd start here:

     

    categoryArray.push(catName);

     

    this code is pushing a string into your categoryArray.

     

    allTo() needs an array of display objects, not String values of their .name property. i know, its weird. its more an AS3 thing and not a tweenMax issue.

     

    try this instead

     

    categoryArray.push(B);

     

    this will actually be adding each b (or a reference to each B) to the array.

  3. by default strokes are set to scale proportionally so if you make it very wide it automatically gets thicker.

     

    go inside your line2_mc and select the stroke. in the properties panel go to the stroke menu and select "none"

     

    OR convert your line to a rectangle with a height of 1px

     

    also you want to make sure you spell height right.

  4. When using a TweenMax.to() the properties that you set are target / end / destination properties so setting a property there for the beginning of the tween would be counter-intuitive to the entire TweenMax/Lite model.

     

    the following should suit your situation

     

    box.visible = false;
    TweenMax.fromTo(box, 1, {visible:true}, {x:300, delay:2});

     

    the box will start invisible

    after 2 seconds it will appear and tween its x.

     

    thanks for bringing this up, I never used the visible plugin before and it I can see it can come in quite handy!

  5. yo attaboy!

     

    great job of integrating the mask effect with an externally loaded image!

    it seems it is all working except the variable transparency of the mask.

     

    your code looks really good. the only thing I would suggest as a fix is this:

     

    bars.cacheAsBitmap=true;

    holder.cacheAsBitmap=true;

    holder.mask=bars;

    addChild(holder);

     

    the problem may be that you are setting the holder.mask = bars BEFORE it is added to the stage. try moving it up above bars.cacheAsBitmap = true;

     

    that is only a guess.

     

    if that doesn't fix it, zip up all your files and post them here. I'll take a look at it tomorrow. let me know if you get it working.

     

    Carl

     

    ps. if other snorkl.tv files give you trouble feel free to post in the comments over there. I do my best to address each comment.

  6. yeah just a little adjustment is necessary:

     

    TweenMax.to(myLabel, 0.5, {glowFilter:{color:0x000000, alpha:0.75, blurX:15, blurY:15, yoyo:true, repeat:1}});

     

    should be

     

    TweenMax.to(myLabel, 0.5, {glowFilter:{color:0x000000, alpha:0.75, blurX:15, blurY:15}, yoyo:true, repeat:1});

     

    it gets tricky with all the {}, but you had the yoyo included as part of the glowFilter props.

     

    enjoy.

  7. there are a few ways of doing this probably.

     

     

    using a tweenMax frame tween you could try something like

     

    timeline.append(TweenMax.to(countdown_mc, 6, {frame:3, ease:Linear.easeNone, delay:1}))

     

    the next tween in the timeline may have to be delayed as well so that the last frame of the countdown_mc has time to be read

     

    you may have to play around with the timing to get it to work exactly like you want.

    i added the delay as without it the first frame didn't seem to show as long as the second frame.

    also, you may need to have a stop() action in frame 1 of the countdown MovieClip.

  8. hmmm, i used your code exactly as is except I had different instance names on my buttons and it worked fine.

     

    try putting

     

    trace(e.target.name);

     

    right before the switch statement like so

     

    function overBtn(e:Event):void{
    
    trace(e.target.name);
    switch(e.target.name){
    
    case"btn1":
    buttonTween1.play();
    break;
    case"btn2":
    buttonTween2.play();
    break;
    
    }
    }

     

    make sure it is tracing btn1 or btn2

     

    unless there is a good reason to use MOUSE_OVER... I would suggest ROLL_OVER instead.

  9. cool thanks! here you Go!

     

    function fl_ClickToGoToWebPageS(event:MouseEvent):void
    {
           yourTimeline.currentProgress = 0.9;
    }
    

    should be

     

    function fl_ClickToGoToWebPageS(event:MouseEvent):void

    {

    yourtimeline.currentProgress = 0.9;

    }

     

    the T should be t in yourtimeline!

     

     

    Carl

  10. hello timaging. I am having difficulty understanding your problem.

     

    I am confused by

     

    the code I have in the function now works fine, but it's not where the client wants to go:

     

    navigateToURL(new URLRequest("rules.html"), "_self");

     

    also:

     

    I am trying to figure out how to get a button to go to the end of a timeline, around 66 sections.

     

    also please post the error.

    from what I can tell, your code:

     

    buttonSkipOff.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPageS);
    
    function fl_ClickToGoToWebPageS(event:MouseEvent):void
    {
      yourTimeline.currentProgress = 0.9;
    }

     

    appears to be correct.

     

    Perhaps if you rephrase the question with just the elements that are not working I can be of better assistance

     

    also if you want yourTimeline to stop when it gets to .9 be sure to add

     

    yourTimeline.stop();

     

    to the button code.

    Carl

  11. i'm glad you got this resolved and updated the post, although it is puzzling that TimelineMax somehow fixed it.

    I also don't see how the screenshot proved the existence of a scene that was supposedly missing and causing an error.

    very strange. I wonder, is stateOutline something that is even capable of having a "scene"?

     

    i'm happy that you got it working!

  12. try this:

     

    TweenMax.to(stateOutline, .5, {alpha:0, delay:14.5, onComplete:goNextScene});
    
    function goNextScene(){
         stateOutline.gotoAndPlay(1, "Nav01intro")
    }

     

    for the onComplete property it is best to pass in the name of a function and not try to define a function there.

     

    -Carl

  13. using TimelineMax you can adjust playback rate / timeScale so you can speed up or slow down a single tween or an entire sequence of tweens.

    http://www.greensock.com/timelinemax/ view the interactive example and adjust the timeScale property.

     

    I believe that once a TweenLite/Max instance is created its duration and all properties are set for the lifespan of the Tween. the dynamicProps plugin will allow the end values of the properties to change mid-tween. see the plugin explorer.

     

    using TweenLite or TweenMax you can dynamically set a duration upon the tweens creation by calculating the distance needed to travel and the desired speed of movement.

     

    If you have a specific scenario you need a solution for perhaps someone can provide more detailed help.

     

    I think you will find that the many features of greensock can enhance anything you would do with normal ActionScript.

  14. Hello FelipeSAMA,

     

    I had a hard time understanding what your question is.

    I looked at your zip but you only included a swf which didn't help much. The animation is very nice.

     

    TimelineLite/Max can basically replace anything you can do on the maintimeline in Flash and much more

    Being that it is code-based you have tremendous flexibility to adjust the speed of your animation and sequence hundreds or thousands of tweens.

     

    please watch these videos

    http://www.greensock.com/timeline-basics/

    http://www.snorkl.tv/?s=timelinemax

     

    If after watching the videos you have a specific question about implementing any of the features, someone here will be glad to help you.

     

    it is always best to start learning this stuff by experimenting with a very small goal in mind. Trying to learn it while trying to integrate into a complex project may prove frustrating.

     

    Carl

  15. the gs.easing folder is an old version.

     

    your code should be:

    import com.greensock.TweenLite;

    import com.greensock.easing.*;

     

    if for some reason that doesn't work and you have old mixed up files....

    get rid of the com and gs folders

    download the most recent version from www.greensock.com

    extract the zip

     

    place only the com folder (pertinent to your actionscript version AS3/AS2) next to your fla

     

    try again.

     

    good luck!

     

    Carl

  16. Damian,

     

    Glad to help. Yeah, your final code is great and I like the switch on the navClick.

     

    As for best practices and classes v timeline code. It can be a divisive issue. The way things are going I would encourage you to experiment more with breaking things into classes as that is the way things are going and you will learn good habits that will pay off as your skills increase and the scope of your projects increase.

     

    I find with my audience and the style of tutorials I do it is just easier to keep everything in one file and focus on very basic concepts. Also I'm no master of the class-based approach as I am still learning and sorting it all out. There is a time and a place for everything. There is plenty of cool stuff you can do on frame 1 of a timeline but it can get messy fast. The main problem is that most people (with no programming experience) struggle just to understand how to "click the button and go to a url"... when you throw in... create a new AS file... import these 12 classes... make this a private function... this protected... extend that... I feel it is a huge barrier to people who just want to make a circle bounce and change color every 5 seconds;)

     

    If you are just starting out, continue to read as much about OOP as you can... it will pay off! You should be very pleased with yourself for getting your project to work as you did. If you can get that far you have what it takes to keep learning more and it will get progressively easier.

     

    Carl

  17. Hey iceKomo,

     

    I'm flying a bit blind here but what I'll take a stab.

     

    what happens if you remove

     

    this.mouseChildren = false.

     

    does this class define the behavior of a menu that contains individual buttons or does it define the behavior of an individual button?

     

    the best thing to do is run a trace(event.target.name) in your mouse event handler functions. I'm thinking that killing the mouseChildren is preventing subclips from being the target of mouse events.

     

    Carl

  18. Hello,

     

    First, off congratulations on getting your buttons to work and your effort to implement the greensock classes. There are so many cool things to play with. There are many ways to get things done with AS3 in general and greensock.

     

    As for the efficiency aspect of your code. I don't see that there is much benefit to using TimelineLite in your particular case as TweenLite on its own can handle the simple fade. TimelineLite comes into play more when you are dealing with sequencing tweens. I notice you are using the timeScale property which is cool, but if you just have one tween, changing the duration is just as easy as setting a timeScale.

     

    your event handler functions code could simply be:

     

    function navBtnRollOver(evt:MouseEvent):void
    {
    TweenLite.to(this.deco_mc, .4, {alpha:1, ease:Sine.easeIn});
    }
    function navBtnRollOut(evt:MouseEvent):void
    {
    TweenLite.to(this.deco_mc, .4, {alpha:0, ease:Sine.easeOut});
    }

     

    I guess having timelineLites built could help for extending the animation effects in the future, but for a fade-in it is a bit overkill.

     

    Below are a few video tutorials I made that show a few different ways of efficiently having multiple MovieClip buttons share similar functionality. They are not class-based but pretty much hammer home the concepts of using target vs currentTarget properties of event objects. If anything download the sample files and take a look at them. They may serve as a good starting point for projects in the future.

     

    http://www.snorkl.tv/2010/08/assign-eve ... enttarget/

    http://www.snorkl.tv/2010/11/create-a-s ... y-clicked/

    http://www.snorkl.tv/2010/11/part-1-bui ... flash-as3/

    http://www.snorkl.tv/2010/09/tweenmax-t ... wn-by-now/

     

    of greater importance:

    http://www.greensock.com/tweening-tips/

    read the api docs often!

    spend time reading through the posts on this forum. there is so much good stuff hidden in here.

     

    enjoy

     

    Carl

×
×
  • Create New...