View Single Post
Old 03-06-2009, 09:37 PM   PM User | #1
jfreak53
Regular Coder

 
jfreak53's Avatar
 
Join Date: May 2004
Location: Guatemala
Posts: 477
Thanks: 19
Thanked 10 Times in 10 Posts
jfreak53 is an unknown quantity at this point
Creating Text Field

I have this movie that pulls data from an XML file and creates a small menu of pictures. It works just fine, it will create the pictures just perfectly and the consequent click function works fine too. My problem is I'm trying to create a text field underneath each picture to hold a little bit of text, I can get it to create, it even has a surrounding box. I can even select the text and copy and paste it into another program just fine. The problem is that the text is invisible. What am I doing wrong here? Here is my code:

Code:
var thumb_spacing = 154;
var thumb2_spacing = 104;

// load variables object to handle loading of text
var description_lv = new LoadVars();
description_lv.onData = function(raw_text){
	s = "";
	if ( raw_text.indexOf( "\r" ) ) s = raw_text.split("\r").join("");
	_root.student_page.student_txt.text = s;
}

function GeneratePortfolio(portfolio_xml){
	var portfolioPictures = portfolio_xml.firstChild.childNodes;
	for (var i = 0; i < portfolioPictures.length; i++){
		var currentPicture = portfolioPictures[i];
		
		var currentThumb_mc = student_menu.menu_items.menu_pics.createEmptyMovieClip("thumbnail_mc"+i,i);
		currentThumb_mc._y = i * thumb_spacing;
		
		currentThumb_mc.createEmptyMovieClip("thumb_container",0);
		currentThumb_mc.thumb_container.loadMovie(currentPicture.attributes.image);
		
		var currentThumb_txt = student_menu.menu_items.menu_text.createEmptyMovieClip("text_mc"+i,i);
		currentThumb_txt._y = currentThumb_mc._y + 100;
		currentThumb_txt.createTextField("text_container",0,0,0,80,40);
		
		currentThumb_txt.text_container.multiline = true;
		currentThumb_txt.text_container.type = "dynamic";
//		currentThumb_txt.text_container.selectable = false;
		currentThumb_txt.text_container.embedFonts = true;
		currentThumb_txt.text_container.wordWrap = true;
		currentThumb_txt.text_container.border = true;

		text_container_format = new TextFormat();
		text_container_format.color = 0xff0000;
		text_container_format.font = "Arial";
		text_container_format.size = 12;
		text_container_format.bold = true;

		currentThumb_txt.text_container.text = currentPicture.attributes.firstname+"\r"+currentPicture.attributes.lastname;
		currentThumb_txt.text_container.setTextFormat(text_container_format);
		
		currentThumb_mc.firstname = currentPicture.attributes.firstname;
		currentThumb_mc.lastname = currentPicture.attributes.lastname;
		currentThumb_mc.image = currentPicture.attributes.image;
		currentThumb_mc.description = currentPicture.attributes.description;
		
		
		//currentThumb_mc.onRollOver = currentThumb_mc.onDragOver = function(){
		//	info_txt.text = this.title;
		//}
		//currentThumb_mc.onRollOut = currentThumb_mc.onDragOut = function(){
		//	info_txt.text = "";
		//}
		currentThumb_mc.onRelease = function(){
			_root.student_page.student_image.loadMovie(this.image);
			_root.student_page.name_text.text = this.firstname+" "+this.lastname;
			description_lv.load(this.description);
		}
	}
}

// xml object for xml content (defines sources for selections)
var portfolio_xml = new XML();
portfolio_xml.ignoreWhite = true;
portfolio_xml.onLoad = function(success){
	if (success) GeneratePortfolio(this);
	else trace("Error loading XML file"); // no success?  trace error (wont be seen on web)
}
// load
portfolio_xml.load("5to.xml");
jfreak53 is offline   Reply With Quote