A Flash Developer Resource Site

Results 1 to 20 of 40

Thread: [CS3] Help With my code!

Hybrid View

  1. #1
    Member
    Join Date
    Aug 2008
    Posts
    39
    hi ive been trying to duplicate your code for some text with static backgrounds

    so there is a bakground colour and the text fades on top of it

    i thought i changed all the names right but i must of missed of left something out

    heres the code, it prioduces no errors, just doesnt work

    Code:
    import fl.transitions.Tween;
    import fl.transitions.TweenEvent;
    import fl.transitions.easing.*;
    var text1Tween:Tween = new Tween (text_mc.text1_mc, "alpha", None.easeInOut, 0 , 1 , 2 , true );
    text1Tween.stop();
    text1Tween.addEventListener(TweenEvent.MOTION_FINISH,fadeOutText);
    var text2Tween:Tween = new Tween (text_mc.text2_mc, "alpha", None.easeInOut, 0 , 1 , 2 , true );
    text2Tween.stop();
    var text3Tween:Tween = new Tween (text_mc.text3_mc, "alpha", None.easeInOut, 0 , 1 , 2 , true);
    text3Tween.stop();
    
    text_mc.text1_mc.nextTween = text2Tween;
    text_mc.text2_mc.nextTween = text3Tween;
    text_mc.text3_mc.nextTween = text1Tween;
    
    text1Tween.start();
    
    function fadeOutText(event:TweenEvent) {
    event.target.removeEventListener(TweenEvent.MOTION_FINISH, fadeOutText);
    event.target.addEventListener(TweenEvent.MOTION_FINISH, 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.obj.nextTween.addEventListener(TweenEvent.MOTION_FINISH, fadeOutText);
    event.target.obj.nextTween.begin = 0;
    event.target.obj.nextTween.finish = 1;
    event.target.obj.nextTween.start();
    }
    and the fla so you can see what ive done easier

    thanks for any help
    Attached Files Attached Files

  2. #2
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    Quote Originally Posted by awilderbeast
    hi ive been trying to duplicate your code for some text with static backgrounds

    so there is a bakground colour and the text fades on top of it

    i thought i changed all the names right but i must of missed of left something out

    heres the code, it prioduces no errors, just doesnt work

    Code:
    import fl.transitions.Tween;
    import fl.transitions.TweenEvent;
    import fl.transitions.easing.*;
    var text1Tween:Tween = new Tween (text_mc.text1_mc, "alpha", None.easeInOut, 0 , 1 , 2 , true );
    text1Tween.stop();
    text1Tween.addEventListener(TweenEvent.MOTION_FINISH,fadeOutText);
    var text2Tween:Tween = new Tween (text_mc.text2_mc, "alpha", None.easeInOut, 0 , 1 , 2 , true );
    text2Tween.stop();
    var text3Tween:Tween = new Tween (text_mc.text3_mc, "alpha", None.easeInOut, 0 , 1 , 2 , true);
    text3Tween.stop();
    
    text_mc.text1_mc.nextTween = text2Tween;
    text_mc.text2_mc.nextTween = text3Tween;
    text_mc.text3_mc.nextTween = text1Tween;
    
    text1Tween.start();
    
    function fadeOutText(event:TweenEvent) {
    event.target.removeEventListener(TweenEvent.MOTION_FINISH, fadeOutText);
    event.target.addEventListener(TweenEvent.MOTION_FINISH, 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.obj.nextTween.addEventListener(TweenEvent.MOTION_FINISH, fadeOutText);
    event.target.obj.nextTween.begin = 0;
    event.target.obj.nextTween.finish = 1;
    event.target.obj.nextTween.start();
    }
    and the fla so you can see what ive done easier

    thanks for any help
    Tweening text is always a pain in the ***. Most of the time you have to embed your fonts. I would try that first.
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  3. #3
    Member
    Join Date
    Aug 2008
    Posts
    39
    that worked

    now i have a problem with my backgrounds

    what i was doing was

    background 1 in the text1mc does not fade
    then text1 fades in and out
    then i want background 2 to appaer
    then text2 fades and so on if you get me

    if you see my fla you will be able to tell what i mean

    thanks for your help ,really appreciate it
    Attached Files Attached Files

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