View Single Post
  #1 (permalink)  
Old Oct 12th, 2006, 10:06
DrGonzo DrGonzo is offline
New Member
Join Date: Oct 2006
Location: Hemel Hempstead
Age: 25
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Retaining comboBox label on exitFrame

Hello all!
I'm building an application that uses combo boxes to choose (and change) the colour if the text in a dynamic text field. The only problem is, that when you leave the frame and then come back to it, the text has returned to it's default colour?
I am using this code for the colour change (colourBox is the combo box name lineOne_txt is the text field name):


Code: Select all
//sets a listener for lineOne text colour
objComboListener = new Object();
objComboListener.change = function(eventObj){

//sets the swith fuction for lineOne colour
    var nIndex = Number(colourBox.selectedIndex);
switch (nIndex){
    case 0: break;
    case 1: lineOne_fmt = new TextFormat();
lineOne_fmt.color = 0x000000;
lineOne_txt.setNewTextFormat(lineOne_fmt);break;
    case 2: lineOne_fmt = new TextFormat();
lineOne_fmt.color = 0xFFFFFF;
lineOne_txt.setNewTextFormat(lineOne_fmt);break;
    case 3: lineOne_fmt = new TextFormat();
lineOne_fmt.color = 0x3399FF;
lineOne_txt.setNewTextFormat(lineOne_fmt);break;
    case 4: lineOne_fmt = new TextFormat();
lineOne_fmt.color = 0x0000CC;
lineOne_txt.setNewTextFormat(lineOne_fmt);break;
}
}

//applies changes
colourBox.addEventListener("change", objComboListener);
I also had the same problem with the text itself (the dynamic field text, is created by the user, entering text into an input text field) with the text dissappearing when you re-entered the frame, but I fixed this by giving the input fields variable names. I'm not really sure why this fixed it - but it did!!

(I am very new to this!).

If anyone knows what I can do - it would be most appreciated.

Thanks,

DrGonzo.
Reply With Quote