View Full Version : Creating Text Field

03-06-2009, 09:37 PM
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:

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;


var currentThumb_txt = student_menu.menu_items.menu_text.createEmptyMovieClip("text_mc"+i,i);
currentThumb_txt._y = currentThumb_mc._y + 100;

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_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.name_text.text = this.firstname+" "+this.lastname;

// 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

03-07-2009, 10:59 PM
AHA!!! I searched and investigated some more! I didn't know that by just placing embedFonts = true there you weren't actually embedding fonts! So since I didn't already have a textfield for this I went into another text field that was using the same font, Arial, and selected the characters that I wanted embedded!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum