flash actionscript:
create 2 textformats and set their colors and apply setTextFormat() to your textfield. for example: tfor1 = new TextFormat(); tfor1.color = 0xff0000; tfor2 = new TextFormat(); tfor2.color = 0x000000; /* when your text is moving to the front apply: */ yourTextField.setTextFormat(tfor1); /* and when your text is moving to the back apply: */ yourTextField.setTextFormat(tfor2);
Hi All, I am breaking my head on a big big problem (for non-actionscript people) - (small problem for expert actionscripters). I have attached a rotating menu which fades the textboxes in a carousel like loop. What i want is that when the text is coming up to the front, that the color changes to RED and when the text fades away to back, it fades to black as well..... I have no idea how this can be done as i am quite a beginner at the whole actionscripting bizz. The rotating menu is a sample that i got somewhere... :) http://www.topinvest.nl/temp/rotatingmenu.fla Hope someone can help ?? BIG thanks in advance
no, it's sure not. the code you listed is not going to work, at all. the code on the right side of the equal sign looks like it should be used to assign the textfield's _y property. is it? if so, it can be used if your carousel is vertical. is it? if yes and yes to the above, then you can use a conditional-statement checking the _y properties' of your textfields to assign the correct textformat(). if you don't understand that, show your code that assigns _x and/or _y properties to the textfields.
First of all, thank you for you reply and help :) I tried to implement your code inside my videoclip and am using this line...... _root["text" + textNum].setTextFormat = (tfor1 - tfor2) / 2 * cosYpos + (tfor1 - tfor2) / 2 + tfor1; but somehow it does nothing and i want to check if this is the correct way to use your given answer ?
Okay.....this is the code in full ActionScript: onClipEvent (load) { pos = new Object(); a = 0; speedMax = 0.5; ctrlSpeed = 0.5; centre = 190.5; offset = 185; heightMax = 12; heightMin = 6; widthMax = 220; widthMin = 40; alphaMin = 30; 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; } // End of the function for (i = 0; i < maxTextNum + 1; i++) { move(i, i - 1); } // end of for }
nothing can be done to change the color of the text because those are true buttons and you can't control a button's timeline. to remedy you must redo that setup. for maximum control you should be using movieclips that contain a textfield.
Maybe it's better if you download the example. This moviecliip has the AS and all the textfields.... hope this helps
here's your menu with red to black fade. all the scripting is in the a.s. layer on frame 1 (the only frame) of your _root timeline. the movieclip buttons are pressable and can have additional handlers assigned. http://www.gladstien.com/new/rotatingmenu.fla
WOW ! 8-D Thank you ALOT !! I don't think i could've ever script like that from scratch can't thank you enough..... really helped me out !!
But what if i were to change all the 'buttons' to movieclips ? I don't really care if they are to be pressable or not, i just want a carousel effect and have that color changed.....that's it :) Here is the changed version where all buttons are MC's http://www.topinvest.nl/temp/rotatingmenu.fla again, i want to thank you for your help and time :)
you're welcome. your file's basic structure is much more conducive to epansion, now. you can add more movieclip buttons, more handlers and you can do much more than fade the color from red to black.
Ah yes, it seems i have more control now on the rotating menu/banner indeed I was able to test it today and found out something very strange, If i want to rotate longer lines instead of words it will display only the first character instead of the whole word ? When i change back the value to its initial one, then it still displays the word incorrectly ??? Very strange, i changed the max and min size width without any effect I also changed the width of the text boxes and this had no effect as well Do you know where the problem could be ? Thanks again :D
on the movieclip's timeline that contains the textfield, each keyframe contains code setting the textfield's autoSize property to "center" (so text is centered and the textfield resizes to fit your text) AND if you check the properties panel for each textfield you'll find that the font is embedded for uppercase letters. you must embed your font in a textfield that moves. because you were only using uppercase in the file i edited, that's all i embedded. if you want numbers, characters, lower case or other things to appear in your textfields, you must embed those things using actionscript or by editing the settings in the properties panel (in all keyframes) on that timeline.
MASter ! :D Very good , have total control i did slighty change the 'center' so i can move the center rotation around if you need any css answers just ask ;)
kglad > where are you ? :) i need your help again... altough everything in the mc works perfectly, i was wondering if it's possible to add 1 or more textfields into the clip and having the rotation display this correctly i already addes some extra txtfield and renamed them tfmc8 and tfmc9 , but it displays it incorrectly i also tried to change some values in the AS , hoping it would sort out, but it didn't :( is the above possible with simple AS edits or is the code made to do just 1 thing and with only 6 txt fields ? Thank you very much again in advance !
i don't remember how your file is set-up and i deleted the one i sent to you. i do remember that offset is the diameter of you rotating wheel, so you'll need to adjust that and possibly your stage height to fit your textfields. if that's not enough help, you'll need to post a link to your fla.
the offset doesn't seem to make much difference as it somehow loops the last textbox under/over the current loop tried playing with the values , but i somehow can't break the current 'loop' Here is the file http://www.topinvest.nl/temp/rotatingmenu.fla
Again, i have to thank you for everything !!!!
Don't see what you're looking for? Try a search.
|