Picture to illustrate my problem (probably simple)
I didn't have any luck with my last thread so I've tried to make my question clearer and give more info.
I'm trying to dynamically change the text of something on my swf.
It's a 'tab'. If you look at my first attachment you'll see the tab with dynamic text labelled as 'caption'. I want to be able to set the colour of that text.
I've had an attempt at what I thought would work in the actionscript (again, I've attached a picture showing the script that I thought might work).
I must mention that I'm a complete newbie to Flash and Actionscript so the answer to this question may be really really simple but I've tried to look it up on the net and only got as far as the script I've posted. I'd really like some help with this if you know what I'm doing wrong.
I really didn't understand your problem, but to use setRGB, you need to target a movieclip, not a text field or its text! Another way would be to convert your text to html and then use the html tag to change color, example:
Actionscript Code:
my_txt.html = true; my_txt.htmlText = "<font color='#FF0000'>THIS TEXT IS RED</font>";
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
The 'tab' has the word "caption" on it but when I run the swf it actually shows the text from the top of that actionscript I posted ie.
Code:
var tabArray:Array = new Array("Memorial", "Slideshow");
tabContainer.createEmptyMovieclip("tabArea");
If the script is somehow changing the actual text in the 'movieclip' then it there not a way to change the colour as well?
Many thanks for your continued help with this, it is much appreciated (and also thank you for your patience!)
Cheers
John ;-)
PS. What about something like this....
Code:
var tabArray:Array = new Array("Memorial", "Slideshow");
tabContainer.createEmptyMovieclip("tabArea");
for (i=0; i<tabArray.length; i++) {
var myTab = tabContainer.attachMovie("tabClip", "tabClip"+i, tabContainer.getNextHighestDepth(), {_x:i*112});
// IF THE LINE BELOW SETS THE TEXT ON THE TAB - CAN I NOT SET THE COLOUR OF "myTab.caption" ?? SEE FURTHER DOWN
myTab.caption = tabArray[i];
myTab.onRollOver = function() {
//this.nextFrame();
};
myTab.onRollOut = function() {
//this.prevFrame();
};
myTab.onRelease = function() {
//this.prevFrame();
this.enabled = false;
render_tabs(this);
_root.close_all();
switch (this.caption) {
case "Memorial" :
_root.render_rotator();
break;
case "Slideshow" :
_root.gallery_swf.open_gallery();
break;
}
};
// WHAT ABOUT SETTING THE CAPTION COLOUR LIKE THIS (IT DOESN'T WORK BTW BUT IS THERE SOMETHING SIMILAR THAT WOULD) ??
var tabTextColor = new Color(myTab.caption);
tabTextColor.setRGB(_root.background_swf.colourArray[2]);
Sorry for my ignorance but I'm not 100% sure whether myTab.caption is a "Dynamic Text fields variable name".
Please see the attached piccy. This is what I get when I look at "tab_mc"
In the timeline it shows:
actions
text
white_line
shape
If I click 'text' it draws a blue selection box around the text that says "caption". It's this text that gets changed by the tabArray and it's this text that I want to be able to change the colour of.
Will your solution of making another movieclip to have 'caption' as a dynamic text field etc still work or is there a simpler way?
I really hope there's a simpler way as I'm not sure how to implement your suggestion.
myTab.caption refers to the text field in tabClip/tab_mc, which is definitely the Var(iable) name of that dynamic text field! Click on your caption text field, press F8 and convert it to a Movieclip, give the movieclip an instance name of caption_mc (click movieclip, open Properties Panel, type that in the Instance field), and then, change your code to this:
Actionscript Code:
var tabArray:Array = newArray("Memorial", "Slideshow");
tabContainer.createEmptyMovieclip("tabArea");
for(i=0; i<tabArray.length; i++){ var myTab = tabContainer.attachMovie("tabClip", "tabClip"+i, tabContainer.getNextHighestDepth(), {_x:i*112});
// IF THE LINE BELOW SETS THE TEXT ON THE TAB - CAN I NOT SET THE COLOUR OF "myTab.caption" ?? SEE FURTHER DOWN
I've tried your suggestion but it doesn't seem to be working. The 'tabs' now just have the word "caption" written on them (as oppose to Memorial and Slideshow) and the colour hasn't changed.
Does the caption text field have a variable name? Is it a Static Text or a Dynamic Text, if so, what is its variable/instance name? Did you give your newly created movieclip the instance name of caption_mc? If none these work, send FLA file of only the tab_mc
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
No problem, happy to hear that your problem is solved
As for the .text part, you have to include that if you give your Dynamic Text field an Instance name, but if you give it a Variable name, then you have to write without .text
Hope it makes sense
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
Are you kidding? You won't be lol, I think there are TOO few posts everyday (I check everyday for new topics to help people), so if you'd ask questions occasionally, you'd liven up this forum
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS