A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 40 of 40

Thread: [CS3] Help With my code!

Hybrid View

  1. #1
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    As for timings, you change that here:
    new Tween (pics_mc.yellow_mc, "alpha", None.easeInOut, 0 , 1 , 2 , true );
    Since the last parameter is true, you are measuring in seconds. so the 2 indicates the tween should take 2 seconds. However, the easing function None.easeInOut will make is slower at the beginning and end the way you have it set up.

    As for the other part, I will see if I have time to explain this. It may have to be modified slighly based on what you are saying about the text. I am not entirely sure what you are trying to do with the background colors. I get that you want the color to change and then the text to fade in, but how should the color change? Is there any transition at all, or does it just jump from one color to the next?
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  2. #2
    Member
    Join Date
    Aug 2008
    Posts
    39
    can no one except kortex tell me where to put

    this
    Code:
    var timelinePause:Timer = new Timer(3000, 1);
    timelinePause.addEventListener(TimerEvent.TIMER, timerHandler);timelinePause.start();
    function timerHandler(evt:Object):void {this.play();}
    in here
    Code:
    import fl.transitions.Tween;
    import fl.transitions.TweenEvent;
    import fl.transitions.easing.*;
    var Pic1Tween:Tween = new Tween (pics_mc.pic1_mc, "alpha", None.easeInOut, 0 , 1 , 2 , true );
    Pic1Tween.stop();
    Pic1Tween.addEventListener(TweenEvent.MOTION_FINISH,fadeOut);
    var Pic2Tween:Tween = new Tween (pics_mc.pic2_mc, "alpha", None.easeInOut, 0 , 1 , 2 , true );
    Pic2Tween.stop();
    var Pic3Tween:Tween = new Tween (pics_mc.pic3_mc, "alpha", None.easeInOut, 0 , 1 , 2 , true);
    Pic3Tween.stop();
    
    pics_mc.pic1_mc.nextTween = Pic2Tween;
    pics_mc.pic2_mc.nextTween = Pic3Tween;
    pics_mc.pic3_mc.nextTween = Pic1Tween;
    
    Pic1Tween.start();
    function fadeOut(event:TweenEvent) {
    event.target.removeEventListener(TweenEvent.MOTION_FINISH, fadeOut);
    event.target.addEventListener(TweenEvent.MOTION_FINISH, startNext);
    event.target.begin = 1;
    event.target.finish = 0;
    event.target.start();
    }
    function startNext(event:TweenEvent) {
    event.target.removeEventListener(TweenEvent.MOTION_FINISH, startNext);
    event.target.obj.nextTween.addEventListener(TweenEvent.MOTION_FINISH, fadeOut);
    event.target.obj.nextTween.begin = 0;
    event.target.obj.nextTween.finish = 1;
    event.target.obj.nextTween.start();
    }
    so the pics will pause for a bit before fading out?

    THankyou

  3. #3
    Member
    Join Date
    Aug 2008
    Posts
    39
    hey again, adn thanks for the response

    what do the other numbers stand for?
    how do i start the texts 1 second after the pictures?

    yes no transation for the background colours
    the squares behind the text just change then text fades ontop

    Thankyou again for helping me

  4. #4
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    Basic tween structure is:
    new Tween (object being tweened, property being tweened, easing function, start value for property being tweened, end value for property being tweened, how long the tween should take in frames or seconds based on the final parameter, whether to use seconds or frames as the unit of measure true means use seconds false means use frames)
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  5. #5
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    This is starting to be a little more dependent upon movie structure, than I like, but if you replace the text code with:

    import fl.transitions.Tween;
    import fl.transitions.TweenEvent;
    import fl.transitions.easing.*;
    var text1Tween:Tween = new Tween (text_mc.text_1.text_mc, "alpha", None.easeInOut, 0 , 1 , 2 , true );
    text1Tween.stop();
    text1Tween.addEventListener(TweenEvent.MOTION_FINI SH,fadeOutText);
    if (text_mc.numChildren > 1) {
    for (var t:int = text_mc.numChildren-1; t>=0; t--) {
    var tclip:Object = text_mc.getChildAt(t);
    tclip.alpha = 0;
    if (t > 0){
    tclip.nextClip = text_mc.getChildAt(t-1);
    }else{
    tclip.nextClip = text_mc.getChildAt(text_mc.numChildren-1);
    }
    }
    text_mc.getChildAt(text_mc.numChildren-1).alpha = 1;
    }
    text1Tween.start();

    function fadeOutText(event:TweenEvent) {
    event.target.removeEventListener(TweenEvent.MOTION _FINISH, fadeOutText);
    event.target.addEventListener(TweenEvent.MOTION_FI NISH, startNextText);
    event.target.begin = 1;
    event.target.finish = 0;
    event.target.start();
    }
    function startNextText(event:TweenEvent) {

    event.target.removeEventListener(TweenEvent.MOTION _FINISH, startNextText);
    event.target.addEventListener(TweenEvent.MOTION_FI NISH, fadeOutText);
    event.target.obj.parent.alpha = 0
    event.target.obj = event.target.obj.parent.nextClip.text_mc;
    event.target.obj.parent.alpha = 1
    event.target.begin = 0;
    event.target.finish = 1;
    event.target.start();
    }
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  6. #6
    Member
    Join Date
    Aug 2008
    Posts
    39
    it gives me this error

    TypeError: Error #1010: A term is undefined and has no properties.
    at test_fla::MainTimeline/frame1()

  7. #7
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    Are you using the fla I posted?
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  8. #8
    Member
    Join Date
    Aug 2008
    Posts
    39
    Absoultley super!
    thankyou so much

    all i need to know now is how to make the clips pause for a given ammount of time before continuing onto the next fade

    could you show me how?

    thanks for everything

  9. #9
    Member
    Join Date
    Aug 2008
    Posts
    39
    Hi
    i found this script and am having trouble as where to put it in the code we already have

    Code:
    var timelinePause:Timer = new Timer(3000, 1);
    timelinePause.addEventListener(TimerEvent.TIMER, timerHandler);timelinePause.start();
    function timerHandler(evt:Object):void {this.play();}

  10. #10
    Member
    Join Date
    Aug 2008
    Posts
    39
    help me? anyone?

  11. #11
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    Would you be ok with using a custom class I created?
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  12. #12
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    Actually this may work for you and is simpler.

    function fadeOut(event:TweenEvent) {
    event.target.removeEventListener(TweenEvent.MOTION _FINISH, fadeOut);
    event.target.addEventListener(TweenEvent.MOTION_FI NISH, startNext);
    event.target.begin = 1;
    event.target.finish = 0;
    setTimeout (event.target.start, 3000);
    }
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  13. #13
    Member
    Join Date
    Aug 2008
    Posts
    39
    hi and thanks for come back to help me, really apprecitate it

    what it does now is the first pic it fades in fades out waits 3 seconds then fades out again then no others fade in

    Thanks

  14. #14
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    Is working on mine. All three fade in and out as expected.
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  15. #15
    Member
    Join Date
    Aug 2008
    Posts
    39
    oops i edited the wrong bit, it does work, it works perfectly

    i cant begin to thankyou enough for all your patience and help

    thankyou so much


  16. #16
    Member
    Join Date
    Aug 2008
    Posts
    39
    oo one more thing, how can i do it so there is pause time before the fade in starts

  17. #17
    Member
    Join Date
    Aug 2008
    Posts
    39
    i figured that one out

    really, thankyou so much

  18. #18
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    Well if you are just trying to add some time at the beginning and end of the animation, you can do all that with the easing function. I would try playing with the easing function and the duration of the tween:
    var yellowTween:Tween = new Tween (pics_mc.yellow_mc, "alpha", Strong.easeInOut, 0 , 1 , 5 , true );

    An easing function slows the transition. since you have it set to easeInOut, it will be applied to the beginning and the end of the tween which is directly related to its length.

    so remove the time out thing from the last post and change the easing to what I have in bold above and then play with the length value until you get the effect you are looking for.
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  19. #19
    Member
    Join Date
    Aug 2008
    Posts
    39
    ooo again one more lol

    just wondering if you knew how to cross fade?
    i need to do another thing amlost the same with a crossfade on teh backgrounds

    Thankyou

  20. #20
    Member
    Join Date
    Aug 2008
    Posts
    39
    google is so sparse on actionscript 3 help, theres practically nothing anywhere, googling actionscript 3 crossfade brings up absolutley nothing

    is crossfading harder on as3? no one done it yet?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center