Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

+ Reply to Thread
Results 1 to 2 of 2
  1. #1

    Default Fade in feature not working

    This is my first post so be patient please.

    I am a newbie, but I think the scripting forum would be the best for this problem. I am combining script from three different Flash files and have managed to make everything work except for one detail.

    I have four buttons that have fade in time controls and one button doesn't fade in properly. The CytBtn will only take on the fade in property of the TipBtn. The buttons have the right instance names and the code seems correct to me, but I'm obviously missing something.

    The instance names for the buttons are correct and I can turn them on and off just fine.

    Here is the code for anyone willing to look at it. I didn't include everything, just what I think is pertinent. Thanks!

    Code:
    var needTechVideoBtn = true;
    var secondsDelay_techVideo = 1;
    
    var needTechTextBtn = true;
    var secondsDelay_techText = 0;
    
    var needTipBtn = true;
    var secondsDelay = 1;
    //select a teacher image to use
    // teacherOne = African American Woman
    // teacherTwo = Caucasian Male
    // teacherThree = Asian Woman
    tipTextObject.teacherImage.gotoAndPlay("teacherOne");
    
    var needCytBtn = true;
    var secondsDelay_cytBtn = 0;
    //select a teacher image to use
    // teacherOne = African American Woman
    // teacherTwo = Caucasian Male
    // teacherThree = Asian Woman
    cytTextObject.teacherImage.gotoAndPlay("teacherTwo");
    
    function removeTipBtn (){
        if (needTipBtn == false) {
            delete btnFadeIn_tip;
            delete myInterval_tip;
            delete tipBtn;
        }
    }
    removeTipBtn();
    
    tipTextObject._visible = false;
    tipBtn._visible = false;
    
    tipTextObject.textTarget.setTextFormat(tipFormat);
    tipTextObject.textTarget.embedFonts = true;
    
    tipTextObject.textTarget.htmlText = tipText;
    
    function btnFadeIn_tip (){
        tipBtn._visible = true;
        clearInterval(myInterval_tip);
        //tipBtn.play();
    }
    
    var myInterval_tip = setInterval(btnFadeIn_tip,(secondsDelay * 1000));
    
    tipBtn.onPress = function() {
        if (ArtAPI.IsPlaying() == false && tipTextObject._visible == false) {
            wasPlaying = false;
        }
        
        if (wasPlaying == true) {
            if (tipTextObject._visible == false) {
                ArtAPI.Pause();
                tipTextObject._visible = true;
            } else {
                ArtAPI.Play();
                tipTextObject._visible = false;
            }
        } else {
            if (tipTextObject._visible == false) {
                tipTextObject._visible = true;
            } else {
                tipTextObject._visible = false;
            }
        }
    }
    
    tipTextObject.tipsCloseBut.onRelease = function() {
        if (wasPlaying == true) {
            tipTextObject._visible = false;
            ArtAPI.Play();
        } else {
            tipTextObject._visible = false;
        }
    }
    
    
    /******************  Code that makes the CYT BUTTON work begins here  ******************/
    
    
    cytTitleFormat = new TextFormat();
    cytTitleFormat.size = 14;
    cytTitleFormat.font = "Gill Sans"
    cytTitleFormat.color = 0xFFFFFF;
    
    cytFormat = new TextFormat();
    cytFormat.size = 14;
    cytFormat.font = "Gill Sans"
    cytFormat.color = 0x000000;
    
    stop();
    
    function removeCytBtn (){
        if (needCytBtn == false) {
            delete btnFadeIn_cyt;
            delete myInterval_cyt;
            delete cytBtn;
        }
    }
    removeCytBtn();
    
    cytTextObject._visible = false;
    cytBtn._visible = false;
    
    cytTextObject.textTarget.setTextFormat(cytFormat);
    cytTextObject.textTarget.embedFonts = true;
    
    cytTextObject.textTarget.htmlText = cytText;
    
    function btnFadeIn_cyt (){
        cytBtn._visible = true;
        clearInterval(myInterval_cyt);
        //CytBtn.play();
    }
    
    var myInterval_cyt = setInterval(btnFadeIn_cyt,(secondsDelay * 1000));
    
    cytBtn.onPress = function() {
        if (ArtAPI.IsPlaying() == false && cytTextObject._visible == false) {
            wasPlaying = false;
        }
        
        if (wasPlaying == true) {
            if (cytTextObject._visible == false) {
                ArtAPI.Pause();
                cytTextObject._visible = true;
            } else {
                ArtAPI.Play();
                cytTextObject._visible = false;
            }
        } else {
            if (cytTextObject._visible == false) {
                cytTextObject._visible = true;
            } else {
                cytTextObject._visible = false;
            }
        }
    }
    
    
    cytTextObject.cytCloseBut.onRelease = function() {
        if (wasPlaying == true) {
            cytTextObject._visible = false;
            ArtAPI.Play();
        } else {
            cytTextObject._visible = false;
        }
    }
    /*End CYT Button------------------------------*/
    Last edited by Vlykarye; 05-16-2012 at 08:13 PM.

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #2
    Join Date
    Jun 2009
    Location
    Houston, Tx
    Posts
    581

    Default

    To me. You're code looks wrong... But then again, there are probably things I don't know about in AS.
    btnFadeIn_tip is obviously a function - function btnFadeIn_tip(){} - yet you call 'delete' on it as if it were a dynamic variable?
    Why do you do that? Same with btnFadeIn_cyt.

    Also, where is the fade code? I don't see anything that will do the fading. All I see are functions for clicking. Can you explain what your code does?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial