A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: oop - fade color - multiple

  1. #1
    Senior Member
    Join Date
    May 2001

    oop - fade color - multiple

    so i have developed some simple objects with simple methods to help my flash development.
    one of the things my objects can do is change colors dynamically.
    i tested it and it does work, until...

    i used these things to create buttons, and then on roll over i say goToColor over or on roll out goToColor out.

    the problem i am having is when i quickly go from one button to another, they fade a little and then stop and keep looping, cause the fading is done through the onEnterFrame event.

    if it didnt change at all, i would think one thing, but it changes a little, and then doesnt complete.

    can give code samples if needed, dont know what to think about why it would stop.

    i have trace statements all around it and it says its applying the change, but it doesnt.

    i dont know

  2. #2
    Senior Member
    Join Date
    Feb 2001
    On the fifth floor.
    I hope this example will help you. If not, then give
    me your code and I'll try to do something.
    Attached Files Attached Files

  3. #3
    Senior Member
    Join Date
    May 2001
    thanks, but thats not really what i am asking for

    here is my fading code

    var curRGB = myColor.getRGB();
    tempCur = curRGB.toString(16);
    goToRGB = goToNewColor.toString(16);
    intDiff = 0;
    newRGB = "";

    for(chars = 0 ; chars < 3 ; chars++ )
    tempCurChar = tempCur.substr((chars * 2), 2);
    tempGoToChar = goToRGB.substr((chars * 2), 2);
    tempDiff = parseInt(tempCurChar, 16) - parseInt(tempGoToChar, 16);
    tempChange = tempDiff / speed; // calculating change
    if(Math.abs(tempChange ) >= .5 ) intDiff += 1;
    tempNew = parseInt(tempCurChar, 16) - tempChange; // applying change

    tempNew = tempNew.toString(16); // reconvert to hex
    if(tempNew.length == 1) tempNew = "0" + tempNew;

    if( intDiff > 0 )
    setColor(parseInt(newRGB, 16));
    coloring = false;

    so i ioop through the hex value as a string 3 times , for r g and b
    i get the difference and reconvert to rgb, and set my color

    it works on a single box, but with multiple buttons, they get stuck, just getting halfway there, but not finishing

  4. #4
    Senior Member
    Join Date
    May 2001

  5. #5
    Senior Member
    Join Date
    May 2001
    WOW, when did i become a SENIOR member?
    what type of benefits do i receive?

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