Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-30-2005, 01:25 PM   #1
summersun
Registered User
 
Join Date: Jun 2001
Posts: 7
Default [FlashMX] how to change color in tricky situation :)

Hi all,

I have the following question in regard to my rotating banner which simply incorporates buttons with an optical illusion that it rotates in 3d space.
Simply it just scales the size and performs an Alpha when the text is moved to 'the back'

here is the code


ActionScript Code:
onClipEvent (load) {     pos = new Object();     a = 0;     speedMax = 0.07;     ctrlSpeed = 0.170000;     centre = 190.5;     offset = 185;     heightMax = 12;     heightMin = 6;     widthMax = 220;     widthMin = 40;     alphaMin = 30; [COLOR=DarkRed][B]ColorMax = (0xff0000);     ColorMin = (0x0033CC);[/B][/COLOR]     maxTextNum = 7; } onClipEvent (enterFrame) {     function move(textNum, phase)     {         a = a + ctrlSpeed;         sinYpos = Math.sin(phase + (-1 / offset * a + 1 + 1 / offset * centre - offset));         _root["text" + textNum]._y = -offset * sinYpos + centre + offset - -offset * -1;         cosYpos = Math.cos(phase + (-1 / offset * a + 1 + 1 / offset * centre - offset));         _root["text" + textNum]._width = (widthMax - widthMin) / 2 * cosYpos + (widthMax - widthMin) / 2 + widthMin;         _root["text" + textNum]._height = (heightMax - heightMin) / 2 * cosYpos + (heightMax - heightMin) / 2 + heightMin;         _root["text" + textNum]._alpha = (100 - alphaMin) / 2 * cosYpos + (100 - alphaMin) / 2 + alphaMin;         [COLOR=DarkRed][B]_root["text" + textNum].Color = (ColorMax - ColorMin) / 2 * cosYpos + (ColorMax - ColorMin) / 2 + ColorMin;[/B][/COLOR]                                 } // End of the function     for (i = 0; i < maxTextNum + 1; i++)     {         move(i, i - 1);     } // end of for }

As you can see the lines marked in RED are the lnes that i created myself don't laugh ! - i know it doesn't work.....that is why i am here

I tried to set Color.setRGB but this doesn't work.....

Only thing i want is that when the text is moving to the front, that the color changes to red......and when it moves to the back it changes to black.....and that loops and loops......


Maybe some expert here can help me out ??
summersun is offline   Reply With Quote
Old 06-30-2005, 02:18 PM   #2
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,106
Default

use the textFormat object, to change the color of your textfield.
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Old 06-30-2005, 02:31 PM   #3
summersun
Registered User
 
Join Date: Jun 2001
Posts: 7
Default

Could you please write an example for me? or show me how i can get this to work ?


I'm not into this whole scripting thing (let alone programming in any language)

i only know how to rewrite samples
summersun is offline   Reply With Quote
Old 06-30-2005, 03:03 PM   #4
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,106
Default

ActionScript Code:
var minTF=new TextFormat(); var maxTF=new TextFormat(); minTF.color=0xff0000; maxTF.color=0x0000ff;  _root["text" + textNum].setTextFormat(maxTF);

this is not exactly how you want to use it, but it is how to use textformat object.... you may need to change how your manipulate the color of the textformat object (with your calculation) before applying the textformat.
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Old 07-01-2005, 09:12 AM   #5
summersun
Registered User
 
Join Date: Jun 2001
Posts: 7
Default

Maybe it will help if i include the source file


Download source FLA here

Hope you can help

BIG THANKS in advance !



Edit : got the answer

Last edited by summersun; 07-08-2005 at 04:04 PM.
summersun is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:14 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.