Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




[F8] CreateTextField



I have been creating text fields using

createTextField

I notice that it doesn't go "Blue" indicating I think that its an allowed phrase (if that's the correct word...). The help files say use this.createTextField or put it within a movie clip?

But it seems to work fine without a movie clip to contain it, and without the "this"

So, what should I do? Do I always have to put the text within a mc (I need no interactivity at this point, just text that will be of varying length)

Apprecaite any comments

Edward



FlashKit > Flash Help > Flash ActionScript
Posted on: 06-09-2008, 06:36 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

CreateTextfield And For
Hi,
my problem is that only the last button is displayed on the screen.
count is 6!

for (i=1; i<=count; i++){
_root.createTextField("button"+i,1,30,30+(i*20),80 ,50);
_root["button"+i].text = "Button" +i;
trace(i);
}

any idea?

CreateTextField
Hi there,

1. I am going to use the action to createTextField in the MC of navMC
2. loop 5 times and postion the textField down 50pix

Can u pls help me to check the code below?

Cheers


PHP Code:



_root.createEmptyMovieClip("navMC", 1);
for (i=0; i<5; i++) {
    _root.navMC.createTextField("navText", i+1, 100, 100, 500, 100);
    with (_root.navMC.navText) {
        _y += 50;
        multiline = false;
        selectable = false;
        wordWrap = false;
        border = false;
        myformat = new TextFormat();
        myformat.color = 0xff0000;
        //myformat.font = "Verdana";
        myformat.bullet = false;
        myformat.underline = false;
        text = "this is line" + " " + i
        mytext.setTextFormat(myformat);
    }
}

CreateTextField In AS2
Does anyone know how to use createTextField within a method

I have tried, and searched but am unable to.

CreateTextField
Why is this not working. The xml file is loading ok. The problem is with the creatTextField(). It does create it because I can select it when it is published but the text is not showing up. Even if I try to place text directly like
t.htmlText ="testing text";


Code:
XML.prototype.ignoreWhite = true;
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "Univers 55";
function loadXML(url, target) {
main_xml = new XML();
main_xml.load(url);
var t = target.createTextField("_text", target.getNextHighestDepth(), 0, -100, 200, 300);
t.html = true;
t.autoSize = true;
t.multiline = true;
t.type = "dynamic";
t.wordWrap = true;
t.selectable=true;
main_xml.onLoad = function(success) {
if (success) {
//t.styleSheet = myCSS;
t.htmlText =main_xml;
t.setTextFormat(my_fmt);
}
};
}

CreateTextField()
I am trying to create a textField at runtime and format it. I am using the following code:


Code:
_root.createTextField("imageDesc", 3, 0, 0, 300, 50);
imageDesc.font = "Trebuchet MS";
imageDesc.size = 14;
imageDesc.textColor = 0xFF0000;
imageDesc.multiline = true;
imageDesc.wordWrap = true;
It all works except it isn't taking the font size or the font type. Can anyone tell me why that is?

Thanks

Help With CreateTextField
I am trying to create a empty movieclip with actionscript then use createTextfield. This movieclip will then animate across the screen. Everything works, but I am trying to get the text to a bigger font and having no luck. Here is the code I am using

this.createEmptyMovieClip("myText_mc", 0);
myText_mc.createTextField("word_txt",0,20,100,100, 100);
myText_mc.word_txt.text = " Hi Britni";
myText_mc.onEnterFrame = function() {
this._x += 5;
};
If I set the width to a higher number the text stil does not get bigger.

CreateTextField
I am creating dynamically the following text filed (see script). I want flash to embed the font but it is not doing it. When I set the "embedFonts" command to TRUE the text doesn't come up when I rollover the buttons that send dynamically the text variable to the text field.

Right now it works but the font that comes up it is arial and it is too big and doen't brake toa third line, in other words: the user can't see the total label of some products.

What can I do to make flash embed the fonts I want?

Thanks a lot.

createTextField("paintingLabel_txt",10,53,380,160,44);
with(paintingLabel_txt){
background = false;
html = true;
multiline = false;
selectable = false;
type = "dynamic";
wordWrap = true;
restrict = null;
embedFonts = false;
}
var labelStyle:TextFormat = new TextFormat();
with(labelStyle){
font = "Univers LightUltraCondensed";
size = 15;
color = 0x989289;
}
paintingLabel_txt.setNewTextFormat(labelStyle);

[F8] Help With CreateTextField
I have no clue why this isn't working. This is really frustrating me, and there is nothing more really that I can explain, so I'll just post the code.

Code:
_root.createEmptyMovieClip("box_mc", _root.getNextHighestDepth());
box_mc.beginFill(0xFF0000);
box_mc.lineStyle(3, 0x000000, 100, true, "none", "none");
box_mc.moveTo(0, 0);
box_mc.lineTo(200, 0);
box_mc.lineStyle(2, 0x000000, 100, true, "none", "square");
box_mc.lineTo(200, 100);
box_mc.lineTo(0, 100);
box_mc.lineStyle(3, 0x000000, 100, true, "none", "none");
box_mc.lineTo(0, 0);
box_mc.endFill();
xx = 0;
yy = 0;
thewidth = 100;
theheight = 100;
box_mc.createTextField("mytext_box",
_root.getNextHighestDepth(), xx, yy, thewidth, theheight);
mytext_box.multiline = true;
mytext_box.selectable = false;
mytext_box.border = true;
mytext_box.wordWrap = true;
var fmt:TextFormat = new TextFormat();
fmt.color = 0x000000;
mytext_box.text = "Work you!";
mytext_box.setTextFormat(fmt);





box_mc.onEnterFrame = function():Void {
this._x = _root._xmouse;
this._y = _root._ymouse;
};
When it runs, it creates the red box and it follows the mouse just like I want, but there is NO TEXT BOX! Grrrrrrrrr, help please! Thanks in advance.

[F8] More Fun With CreateTextField
I am trying to create 7 text boxes named ITEM that will run vertical 45 pixels apart. I have tried a bunch of stuff, but nothing seems to work. here was my final idea.


PHP Code:



for (var i = 0; i<7; i++){
        var myItem = ['ITEM'+i+'_txt'];
        this.createTextField(myItem, i, 205, (215 + (i*45)), 165, 30);
        myItem.autoSize   = 'left';
        myItem.wordWrap   = true;
        myItem.selectable = false;
        myItem.embedFonts = bIsLatin;
        myItem.html       = true;
        myItem.htmlText   = rootNode.childNodes[1].childNodes[i].attributes.ITEM;
        myItem.setTextFormat(selectionText);
    }




anybody have any thoughts on this, or seee what I am doing wrong.

IMS

CreateTextField Help
Hi,

I am trying to create a dynamic text field that will control the number of lives a player will have in a simple game I am attempting to make.

I want the text field to be create dynamically. Could anyone point out where I am going wrong with the code below (actionscript 2). Nothing appears on screen.



Code:
this.createTextField("lives",9,10,10,100,50);
lives=6;
lives.txt = "lives" + lives;
lives.border = true;

CreateTextField Help
Hey All, does anyone have a snippit of code that will allow me to create a multiline textField (250x100) that I can:

1. set the text
2. render at HTML
3. set text color
4. embed linked font (verdana)
5. make scrollable - this one is pretty easy but I figure I would thorw it in for good measure.

Thanks Much, I have been fighting with the Flash text Beast for years now. Hopefuly this will put an end to that fight. Thanks, Dvl

CreateTextField
Hello,

I am creating a title using createTextField. Then I want to align some stuff to the bottom of the title, so I use:

var txtField:TextField = this.createTextField("txtField", this.getNextHighestDepth(), 0, 0, 200, 50);
txtField.text = 'My Title';

// this to the y
var yPos:Number = txtField.textHeight;

When I use this code and place my next mc at this Y position, it displays over the bottom of the text. It seems to align to the bottom of a 'x' but over right the dangly bit of a 'q' or 'g'

Does the createTextField have padding in it? Or is there a way to measure the pixel position of the bottom of the text?

Many thanks,

monk.e.boy

CreateTextField
I am working on project as under:

on first step ( screen) there are 2 text fields
user inserts text in a field and on the second text field same text appear as he types.

he clicks on a button to go to step 2

On the second step he has the written text from previous screen and buttons to change font, colors and position of the text box.

Thats it.

Can anybody help me how to do this or provide link.
I would appreciate your help

Thanks

CreateTextField Pb
Why isn't this working? I trace "myNews", it loads ok but the field myfield is undefined and i don't understand why.. can anyone help me?


ActionScript Code:
onClipEvent (load) {    loadText = new LoadVars();    loadText.load("TEXT.txt");    loadText.onLoad = function() {        _root.MCtexte.createTextField("myfield", 500, 15, 8, 387, 460);        //trace(_root.MCtexte.myfield);        _root.MCtexte.myfield.html = true;        _root.MCtexte.myfield.htmlText = this.myNews;        _root.MCtexte.myfield.condenseWhite = true;        _root.MCtexte.myfield.multiline = true;        _root.MCtexte.myfield.wordWrap = true;        //trace(this.myNews)    };}

CreateTextField
I'm using createTextField to make some tooltips. The AS dictionary says:

Quote:




A text field created with createTextField receives the following default TextFormat object:
font = "Times New Roman"




How or where can I change this font?

CreateTextField()
hi.

i'm looking for the most efficient way to program this:


Code:
for (var i:Number=0; i <= 7; i++){
// create 7 text fields

// place them in 7 equal columns across the stage
i thought i might need these variables to do it:


Code:
var stageWidth:Number = _width;
var numCols:Number = 7;
var indivColWidth = stageWidth/7;
but i am unsure how to go about writing this best.

any suggestions?

thanks. fumeng.

CreateTextField
I tried everything, it works perfectly without the loop but when I try to put it in a loop it displays nothing.
I figured out it has something to do with the naming of mytext, It seems it needs to be quoted I colored red where I think the fault is.

Code:
xwaarde = 20;
for(i=0;i<3;i++){
mytext = "mytext"+i;
_root.createTextField(mytext, i, xwaarde, 100, 50, 100);
mytext.multiline = true;
mytext.wordWrap = true;
mytext.border = true;
mytext.text = "this is my first test field object text";
xwaarde = xwaarde+80;
}
the following works perfectly :

Code:
xwaarde = 20;
_root.createTextField("mytext", 0, xwaarde, 100, 50, 100);
mytext.multiline = true;
mytext.wordWrap = true;
mytext.border = true;
mytext.text = "this is my first test field object text";
thanks

Help With CreateTextField
Trying to learn actionscript and I do not understand why I can not make the text width and height bigger but I can make it smaller. Here is the code I am using

this.createEmptyMovieClip("myText_mc", 0);
myText_mc.createTextField("word_txt",0,20,100,100, 100);
myText_mc.word_txt.text = " Hi Britni";
myText_mc.onEnterFrame = function() {
this._x += 5;
};

Help On Mc.createTextField
Quote:




Hi,
I'm trying to create multiple textfields, to load images onto them via html+loadvariables.


Code:
//frame 1
var i:Number = 1;

//frame 2-3-
if(i <= 10){
//instanceName, depth, x, y, width, height
this.createTextField("img_load"+i,+1,0,0,60,60)
// How do I change the other properties (aside from width/height, x & y) on the
// newly created text field? (the var value most importantly)
// doing img_load+i.class wont work, since all the text fields generated
// dynamically
i++;
}
Thanks in advance




edit- found http://www.actionscript.org/forums/s...d.php3?t=73115
for the solution.

Please delete this thread. Thanks

I Need Some Help With MC.createTextField
I'm working with a flash program that dynamically creates a user-specified amount of text fields in an MC using the createTextField function. However, it seems only one of the text fields will show up.

I've done some testing, and I found that when you create multiple text fields in an MC using this method, only the most recent one shows up. Is there any way to avoid this?

CreateTextField Pb
Why isn't this working? I trace "myNews", it loads ok but the field myfield is undefined and i don't understand why.. can anyone help me?


ActionScript Code:
onClipEvent (load) {    loadText = new LoadVars();    loadText.load("TEXT.txt");    loadText.onLoad = function() {        _root.MCtexte.createTextField("myfield", 500, 15, 8, 387, 460);        //trace(_root.MCtexte.myfield);        _root.MCtexte.myfield.html = true;        _root.MCtexte.myfield.htmlText = this.myNews;        _root.MCtexte.myfield.condenseWhite = true;        _root.MCtexte.myfield.multiline = true;        _root.MCtexte.myfield.wordWrap = true;        //trace(this.myNews)    };}

CreateTextField
I'm using createTextField to make some tooltips. The AS dictionary says:

Quote:




A text field created with createTextField receives the following default TextFormat object:
font = "Times New Roman"




How or where can I change this font?

CreateTextField()
hi.

i'm looking for the most efficient way to program this:


Code:
for (var i:Number=0; i <= 7; i++){
// create 7 text fields

// place them in 7 equal columns across the stage
i thought i might need these variables to do it:


Code:
var stageWidth:Number = _width;
var numCols:Number = 7;
var indivColWidth = stageWidth/7;
but i am unsure how to go about writing this best.

any suggestions?

thanks. fumeng.

CreateTextField
I tried everything, it works perfectly without the loop but when I try to put it in a loop it displays nothing.
I figured out it has something to do with the naming of mytext, It seems it needs to be quoted I colored red where I think the fault is.

Code:
xwaarde = 20;
for(i=0;i<3;i++){
mytext = "mytext"+i;
_root.createTextField(mytext, i, xwaarde, 100, 50, 100);
mytext.multiline = true;
mytext.wordWrap = true;
mytext.border = true;
mytext.text = "this is my first test field object text";
xwaarde = xwaarde+80;
}
the following works perfectly :

Code:
xwaarde = 20;
_root.createTextField("mytext", 0, xwaarde, 100, 50, 100);
mytext.multiline = true;
mytext.wordWrap = true;
mytext.border = true;
mytext.text = "this is my first test field object text";
thanks

CreateTextField
Have a question, is there a way to change the variable name of a dynamic text box that gets created via a createTextField?? I tried this:

text_box.variable = "box2";

but it doesn't work because it continues to pull in the original variable from the loadVariables("info.txt", "box") that I have in frame 1

I basically want it to change variables at different frames so it can cycle through

Sample Text file:

box=Here you are at the box&box2=Yes at box 2&box3=Final box&done=1

thanks for all your help!!!

CreateTextField()
is there any reason anyone can see why this text field I'm creating isn't displaying any text.....it will show the cursor change to a hand indicating that the <a> tag is working, however, the text physically isn't there...

can anyone help me?

_root.main.createTextField("newText", 10, 672, 23, 100, 15);
_root.main.newText.multiline = true;
_root.main.newText.wordWrap = true;
_root.main.newText.autoSize = true;
_root.main.newText.border = false;
_root.main.newText.font = "Arial";
_root.main.newText.size = 8;
_root.main.newText.textColor = 0x333333;
_root.main.newText.bold = false;
_root.main.newText.align = "left";
_root.main.newText.leftMargin = 0;
_root.main.newText.rightMargin = 0;
_root.main.newText.indent = 0;
_root.main.newText.leading = 0;
_root.main.newText.html = true;
_root.main.newText.htmlText = "<a href="asfunction:TestFunction,movie01">Testing</a>";

CSS/createTextField
Hey,

Has anyone encountered problems with dynamically created textfields and style sheets?

I'm building a textfield as follows:



ActionScript Code:
this.createTextField("dateField", this.getNextHighestDepth(), 0, 0, 160, 20);
this.dateField.wordWrap = true;
this.dateField.multiline = true;
this.dateField.autoSize = "left";
this.dateField.selectable = false;
this.dateField.condenseWhite = true;
this.dateField.html = true;
this.dateField.styleSheet = dateCSS;
this.dateField._y = this.stackHeight;
this.dateField.htmlText = dateVar;


dateCSS is properly loading, and has a class called dateTxt:

ActionScript Code:
.dateTxt{
    color: #666666;
    font-style : italic;
    font-family: Verdana,sans-serif;
    font-size: 12px;
}


And the htmlText for the dateField reads, "<span class="dateTxt">2/24/2005</span>"

So here's the issue-- I can control everything but the italics. Those simply get ignored.

Is this an embedded font issue? The documentation I've found on embedding fonts is spotty at best. (And, if so, how do I embed the font and link it to the dynamic textField and still invoke the classes in the CSS?)

Any advice/solutions are greatly appreciated.

Thanks!

CreateTextField
Hi guys,

I need to create several TextFields one under each other.

The fields need to be of a fixed width (250px), but depending on the content they will need varying heights - any help would be appretiated I can only seem to manually set the height!

Also on how to position the following field would be cool - thanks!

CreateTextField();
Hi,

Problem with myTextField.multiline = 1;

Just create a new text field via createTextField();

The multiline property did not work at all.

Please help

Thanks

exemple:

// Create a new text field
this.createTextField("myTextField", 1, 0, 0, 0, 0);
// Property
myTextField.type = "dynamic";
myTextField.autoSize = "left";
myTextField.multiline = 1;
// Create text format
myTextFormat = new TextFormat();
myTextFormat.embedFonts = 1;
myTextFormat.size = 8;
myTextFormat.color = 0x000000;
myTextFormat.font = "ceriph 07_55";
myTextFormat.align = "left";
// Set text format
myTextField.setNewTextFormat(myTextFormat);
//
stop();

CreateTextField? I Want More
Hi,

i'm see the method createTextField, but I wanna to create radio, checksan combos in a dynamic form, with actionscript. Have one chance? I thought in create a movieClip for each one and attach in my Scene?

Thanks

CreateTextfield With Loop
my problem is that my script is only makeing 12 new textfields: massage1,massage2 etc. it seems to overwrite:name and email.
Please take a look!

on (press) {

for (i=1; i<=12; i++) {

name = "name"+i;
email="email"+i
message="massage"+i

_root.createTextField(name, i, 125, 0,200,20);
_root.createTextField(email, i, 125, 20, 200,20);
_root.createTextField(message, i, 125, 40, 200, 20)

_root[name].type = "dynamic";
_root[email].type = "dynamic";
_root[message].type = "dynamic";

_root[name].border = true;
_root[email].border = true;
_root[message].border = true;

_root[name].text = eval("name" add i);
_root[email].text = eval("email" add i);
_root[message].text = eval("mess" add i);

_root[name]._y = 0+i*40
_root[email]._y = 20+i*40
_root[message]._y = 40+i*40


}
}

Rollover In A CreateTextfield?
This is (stripped) what I have now:

for (i=0; i<amount; i++) {
MasterPhotoHolder.createTextField("mytext" + i,i+3,10,i*25,100,50);
MasterPhotoHolder["mytext" + i].html = true;
MasterPhotoHolder["mytext" + i].htmlText = "<font color='#FFFFFC' ><u><a href="asfunction:_root.jump,Scene1">" + _level0.NAMEarray[i] + "</a></u></font>";
}

So the viewer sees a list of hyperlinked names.

What I want is a rollover behavior of the text. So that when the mouse goes over the text, BUD THE HYPERLINK IS NOT CLICKED, I call a function. (this function will show the photo of the person)

Can I give a textfield created like this a rollover behavior or not?

Thanks

Major Bug? CreateTextField
OK, so I made a work around to Flash not being able to pass object variables between loaded SWF, but now I find createTextField is screwing up.

This is the situation, I am dynamically building a menu. The menu file works under the following situations:
1. On its own in any situation.
2. When loaded into another movie in IE.

But, when loaded into another movie in Flash, or in the projector, the createTextField() method fails and I have blank menus with no labels.

I have done traces on all the targetpath()s and tried multiple methods of referencing the MC. The createTextField line is the only line that doesn't work.

Is there a maximum number of MC you can nest?

Is there a bug in createTextField?

Is there a bug in the player?

CreateTextField Question
Hi,

I want to create a textfield with the following script:

myformat = new TextFormat();
myformat.font = "Arial";
myformat.size = "12";
myformat.color = 0x54534B;
myformat.bullet = false;
myformat.align = "Right";

_root.createEmptyMovieClip("item"+1, 1);
with ("item"+1) {
createTextField("mytext"+1, 1, 50, 10, 250, 250);
eval("mytext"+1).embedFonts = true;
eval("mytext"+1).selectable = false;
eval("mytext"+1).multiline = true;
eval("mytext"+1).wordWrap = true;
eval("mytext"+1).border = false;
eval("mytext"+1).html = true;
eval("mytext"+1).htmlText = "<B>test</B><i>test</i>test";
eval("mytext"+1).setTextFormat(myformat);
}

I've embedded the font Arial in the library and Linked it for actionsctipt with the linkage name: "Arial"

But when I use HTML tags like: <B>test</B><i>test</i>test

....the text is not bold or italic...?

What am I doing wrong here? Please help!!

CreateTextField Help? My Code:
I am trying to make a flash movie for my client that will dynamically show a match record for his gaming team, and I cannot seem to figure out why I can't get it to work. It could be that the createTextField depths arent random and they need to be for them all to show up.


Code:
stop();
matches_xml = new XML();
matches_xml.load("scripts/matches.xml");
matches_xml.onLoad = startMatches;
matches_xml.ignoreWhite = true;


function startMatches(success) {
if (success == true) {
rootNode = matches_xml.firstChild;
firstMatchNode = rootNode.firstChild;
currentMatchNode = firstMatchNode;
totalMatches = rootNode.childNodes.length;
currentMatch = 1;
startTextFields(firstMatchNode);
}//if
}//function
//
function startTextFields(newMatchNode) {
matchDate = newMatchNode.attributes.matchDate;
matchFoe = newMatchNode.attributes.matchFoe;
matchType = newMatchNode.attributes.matchType;
matchMap = newMatchNode.attributes.matchMap;
matchFinal = newMatchNode.attributes.matchFinal;
matchStatus = newImageNode.firstChild.nodeValue;
makeTextFields1();
}//startTextFields
//
//
function finishTextFields() {
for(i=1; i<totalMatches; i++) {
currentY=currentY+15;
currentMatch=nextSibling;
makeTextFields1();
}
}
currentY=15;
function makeTextFields1() {
//DATE
this.createTextField("date_"+currentMatch, 1, 158, currentY, 50, 20) ;
this["date_"+currentMatch].text=matchDate;
this["date_"+currentMatch].textColor=0x96F0FF;
this["date_"+currentMatch].embedFonts=true;
myTextFormat = new TextFormat();
myTextFormat.font = "1FFFharmony";
myTextFormat.size = 8;
this["date_"+currentMatch].setTextFormat(myTextFormat);
//FOE
this.createTextField("foe_"+currentMatch, 2, 211, currentY, 50, 20) ;
this["foe_"+currentMatch].text=matchFoe;
this["foe_"+currentMatch].textColor=0x96F0FF;
this["foe_"+currentMatch].embedFonts=true;
myTextFormat = new TextFormat();
myTextFormat.font = "1FFFharmony";
myTextFormat.size = 8;
this["foe_"+currentMatch].setTextFormat(myTextFormat);
//TYPE
this.createTextField("type_"+currentMatch, 3, 242, currentY, 50, 20) ;
this["type_"+currentMatch].text=matchType;
this["type_"+currentMatch].textColor=0x96F0FF;
this["type_"+currentMatch].embedFonts=true;
myTextFormat = new TextFormat();
myTextFormat.font = "1FFFharmony";
myTextFormat.size = 8;
this["type_"+currentMatch].setTextFormat(myTextFormat);
//MAP
this.createTextField("map_"+currentMatch, 4, 281, currentY, 90, 20) ;
this["map_"+currentMatch].text=matchMap;
this["map_"+currentMatch].textColor=0x96F0FF;
this["map_"+currentMatch].embedFonts=true;
myTextFormat = new TextFormat();
myTextFormat.font = "1FFFharmony";
myTextFormat.size = 8;
this["map_"+currentMatch].setTextFormat(myTextFormat);
//FINAL
this.createTextField("final_"+currentMatch, 5, 372, currentY, 90, 20) ;
this["final_"+currentMatch].text=matchFinal;
this["final_"+currentMatch].textColor=0x96F0FF;
this["final_"+currentMatch].embedFonts=true;
myTextFormat = new TextFormat();
myTextFormat.font = "1FFFharmony";
myTextFormat.size = 8;
this["final_"+currentMatch].setTextFormat(myTextFormat);
//
}//makeTextFields1
finishTextFields();



I attached a sample of the xml file, and the flash. Please check it out and enlighten me. Else I might take forever in trying to make this work, and that would be bad for my client.

note: the data is going to be displayed in a table-like format, and the goal here, is to dynamically list as many nodes/matches that are in the XML file.

Thanks! =D

CreateTextField _x Position
Hi All

I've been working on something similar to what can be found here
http://www.macromedia.com/support/fl...textfields.htm

One thing that I can't figure out is how to position the text field in the scrollpane.

_root.myscroll.createTextField(mytextfield,i,30,my y,88,18);

I've made the scrollpane bigger and I've tried changing the x pos (30 in the example above).
But the text boxes still line up flush against the left hand side.
What I ultimately want to do is create another list of text boxes in the same scrollpane.

Any ideas?

thanks

CreateTextField And _level1
Does anyone know why createTextField in _level1 doesn't seem to work?
I have 2 movies. 1 is the main timeline and the other movie is loaded in level1. If I play the movie with the createTextField by itself it's fine, but when I load the movie with createTextField in level1 the createTextField doesn't work.

CreateTextField And New TextFormat();
Hello,

I am having trouble identifying the error(s) in my code. I have created a text box and myTextFormat function doesn't seem to operate correctly. I can embed the font, make the box non-selectable and set the variable, but I cannot change the font nor adjust it's size in actionscript. Can someone help?


Code:
this.createTextField ("time_tx",1,385,275,160,20);
time_tx.variable = "dateTime";
time_tx.embedFonts = true;
time_tx.selectable = false;
myTextFormat = new TextFormat();
myTextFormat.bold = true;
myTextFormat.font = "Arial";
myTextFormat.size = 14;
time_tx.setTextFormat(myTextFormat);

Alignment And CreateTextField
I'm using a createTextField, and really it works great.
Except, if it's an input type, and I have the alignment set to anything but "left", then a person types inside it it still left justifys unless you "recreate" the mc using the text data after they typed it.
Here's my code:
code:
function bk_txt_text(comp) {
if (beenbkfont == "1") {
$bktxtfont = (_root.db_fontb.getSelectedItem().data);
} else {
$bktxtfont = "AntiqueOliT";
}
if (bktxt_place == "1") {
$bktxtx = $bktxtx;
$bktxty = $bktxty;
} else {
$bktxtx = "345";
$bktxty = "320";
}
if (_level0.btbeenalign != "1") {
_level0.back_txt_align = "center";
}
if (beenbktxttext == "1") {
$bk_txt_txt = _level0.bktxt;
} else {
$bk_txt_txt = "Your text here";
}
if (beentxtsizeb == "1") {
_level0.bts = _level0.btsx;
} else {
_level0.bts = 10;
}
//$bk_txt_txt = "Your text here";
_root.createTextField("bk_txt", 324, $bktxtx, $bktxty, 120, 70); // depth, x, y, width, height
txt_bk_myformat = new TextFormat();
txt_bk_myformat.size = _level0.bts;
txt_bk_myformat.color = 0x000000;
txt_bk_myformat.align = _level0.back_txt_align;
txt_bk_myformat.font = $bktxtfont;
txt_bk_myformat.bold = true;
txt_bk_myformat.bullet = false;
txt_bk_myformat.underline = false;
txt_bk_myformat.variable = "var_bk_txt";
bk_txt.embedFonts = true;
bk_txt.multiline = true;
bk_txt.wordWrap = true;
bk_txt.border = false;
bk_txt.type = "input";
bk_txt.text = $bk_txt_txt;
bk_txt.setTextFormat(txt_bk_myformat);
//
if (bktxtswitch == "1") {
setProperty("_root.bk_txt", _visible, "100");
} else {
setProperty("_root.bk_txt", _visible, "0");
}
//
bk_txt.onKillFocus = function() {
_level0.bktxt = bk_txt.text;
};
bk_txt.onSetFocus = function() {
_global.beenbktxttext = "1";
};

txt_bts_txt.text = _level0.bts;
//$btt = bk_txt.htmlText;
}

Yeah, I know it's kind of clumsy, but it's my 1st AS project.
And of course some of the variables are defined "off screen". Like level0.back_txt_align is defined using a radio button set with the options "left" "center" and "right".

Anyway my question is, is there a way when the centering is set to center or right, that the justify can BE that while it's clicked in and being typed in?

Thanks for any suggestions!!
Liam

Alignment And CreateTextField
(If this is a duplicate entry, my apologies. My browser crashed as I posted it the 1st time.)
I'm using a createTextField, and really it works great.
Except, if it's an input type, and I have the alignment set to anything but "left", then a person types inside it it still left justifys unless you "recreate" the mc using the text data after they typed it.
Here's my code:
code:
function bk_txt_text(comp) {
if (beenbkfont == "1") {
$bktxtfont = (_root.db_fontb.getSelectedItem().data);
} else {
$bktxtfont = "AntiqueOliT";
}
if (bktxt_place == "1") {
$bktxtx = $bktxtx;
$bktxty = $bktxty;
} else {
$bktxtx = "345";
$bktxty = "320";
}
if (_level0.btbeenalign != "1") {
_level0.back_txt_align = "center";
}
if (beenbktxttext == "1") {
$bk_txt_txt = _level0.bktxt;
} else {
$bk_txt_txt = "Your text here";
}
if (beentxtsizeb == "1") {
_level0.bts = _level0.btsx;
} else {
_level0.bts = 10;
}
//$bk_txt_txt = "Your text here";
_root.createTextField("bk_txt", 324, $bktxtx, $bktxty, 120, 70); // depth, x, y, width, height
txt_bk_myformat = new TextFormat();
txt_bk_myformat.size = _level0.bts;
txt_bk_myformat.color = 0x000000;
txt_bk_myformat.align = _level0.back_txt_align;
txt_bk_myformat.font = $bktxtfont;
txt_bk_myformat.bold = true;
txt_bk_myformat.bullet = false;
txt_bk_myformat.underline = false;
txt_bk_myformat.variable = "var_bk_txt";
bk_txt.embedFonts = true;
bk_txt.multiline = true;
bk_txt.wordWrap = true;
bk_txt.border = false;
bk_txt.type = "input";
bk_txt.text = $bk_txt_txt;
bk_txt.setTextFormat(txt_bk_myformat);
//
if (bktxtswitch == "1") {
setProperty("_root.bk_txt", _visible, "100");
} else {
setProperty("_root.bk_txt", _visible, "0");
}
//
bk_txt.onKillFocus = function() {
_level0.bktxt = bk_txt.text;
};
bk_txt.onSetFocus = function() {
_global.beenbktxttext = "1";
};

txt_bts_txt.text = _level0.bts;
//$btt = bk_txt.htmlText;
}

Yeah, I know it's kind of clumsy, but it's my 1st AS project.
And of course some of the variables are defined "off screen". Like level0.back_txt_align is defined using a radio button set with the options "left" "center" and "right".

Anyway my question is, is there a way when the centering is set to center or right, that the justify can BE that while it's clicked in and being typed in?

Thanks for any suggestions!!
Liam

Alignment And CreateTextField
I'm using a createTextField, and really it works great.
Except, if it's an input type, and I have the alignment set to anything but "left", then a person types inside it it still left justifys unless you "recreate" the mc using the text data after they typed it.
Here's my code:
code:
function bk_txt_text(comp) {
if (beenbkfont == "1") {
$bktxtfont = (_root.db_fontb.getSelectedItem().data);
} else {
$bktxtfont = "AntiqueOliT";
}
if (bktxt_place == "1") {
$bktxtx = $bktxtx;
$bktxty = $bktxty;
} else {
$bktxtx = "345";
$bktxty = "320";
}
if (_level0.btbeenalign != "1") {
_level0.back_txt_align = "center";
}
if (beenbktxttext == "1") {
$bk_txt_txt = _level0.bktxt;
} else {
$bk_txt_txt = "Your text here";
}
if (beentxtsizeb == "1") {
_level0.bts = _level0.btsx;
} else {
_level0.bts = 10;
}
//$bk_txt_txt = "Your text here";
_root.createTextField("bk_txt", 324, $bktxtx, $bktxty, 120, 70); // depth, x, y, width, height
txt_bk_myformat = new TextFormat();
txt_bk_myformat.size = _level0.bts;
txt_bk_myformat.color = 0x000000;
txt_bk_myformat.align = _level0.back_txt_align;
txt_bk_myformat.font = $bktxtfont;
txt_bk_myformat.bold = true;
txt_bk_myformat.bullet = false;
txt_bk_myformat.underline = false;
txt_bk_myformat.variable = "var_bk_txt";
bk_txt.embedFonts = true;
bk_txt.multiline = true;
bk_txt.wordWrap = true;
bk_txt.border = false;
bk_txt.type = "input";
bk_txt.text = $bk_txt_txt;
bk_txt.setTextFormat(txt_bk_myformat);
//
if (bktxtswitch == "1") {
setProperty("_root.bk_txt", _visible, "100");
} else {
setProperty("_root.bk_txt", _visible, "0");
}
//
bk_txt.onKillFocus = function() {
_level0.bktxt = bk_txt.text;
};
bk_txt.onSetFocus = function() {
_global.beenbktxttext = "1";
};

txt_bts_txt.text = _level0.bts;
//$btt = bk_txt.htmlText;
}

Yeah, I know it's kind of clumsy, but it's my 1st AS project.
And of course some of the variables are defined "off screen". Like level0.back_txt_align is defined using a radio button set with the options "left" "center" and "right".

Anyway my question is, is there a way when the centering is set to center or right, that the justify can BE that while it's clicked in and being typed in?

Thanks for any suggestions!!
Liam

Css And CreateTextField In Fmx04
hi,

if I use the new feature css in fmxo4 it works fine until I try do
create a textfield with createTextField() it doesnt display anymore my css style. by the way I load my text from a xml file.

here my code:


//---------------------------------------------------------------

var newStyle = new TextField.StyleSheet();
var css_url = "firstStyle.css";
newStyle.load(css_url);
newStyle.onLoad = function(ok) {
if (ok) {
this.createTextField("meinText", 1, 100, 100, 300, 100);
meinText.multiline = true;
meinText.wordWrap = true;
meinText.styleSheet = newStyle;
meinText.text = myXML["info"].childNodes[0].nodeValue;
}
};




what is wrong?



the same code without createTextField() works fine.

CreateTextField & Maxscroll
Hi there,

I'm playing around with createTextField for the first time, and there is one thing I just don't understand.
all of the code below works but one thing. I cant get a proper result from maxscroll!! Its driving me nuts really.
I tried _root["testValue"+i].maxscroll, but its return is always 1.
when I try the same in a createdTextField without a forloop, I get a normal result.....what am I doing wrong????


PHP Code:




for(i=0;i<names.length;i++){
_root.createTextField("testField"+i,i,50,(100+(i*13)),100,13);
_root.createTextField("testValue"+i,(i+names.length),150,(100+(i*13)),200,13);
    //add text from arrays
    _root["testField"+i].text = names[i];
    _root["testValue"+i].text = value[i];
    //format field
    with(_root["testField"+i]){
        border = true;
    }
    with(_root["testValue"+i]){
        multiline = true;
        wordWrap = true;
        border = true;
    }
}







thanks a lot

[MX]createEmptyMovieClip & CreateTextField
In frame 2 of my movie I have used actionscript to create an empty movie clip and a text field.

When I go back to frame 1 of my movie, the MC and the text field I've created remain on the stage on top of the objects that are in frame 1. How can I get rid of mc and the text field?

CreateTextField In Another Movieclip
i'm making a gallery
i'm telling it to make bunch of movieclips with
_root.createEmptyMovieClip(i, i)
so it makes me bunch of MCs (_root[2], _root[23] etc)
now i load pictures into it with _root[i].loadMovie(k)
that works fine too, but now i want to put PICTURE NAMES under the pictures and that's where i'm stuck.
I'm trying to make a textfield into every MC. I use
_root[i].createTextField(i, 2, 0, 120, 500, 50),
but it just plain doesn't work. If i make ONE MC and put ONE textfield in it, then it works, but not with the for loops...
Please help me!

Createtextfield And Add Contents
Hi I have a question:

I have created a textfield using the code below:

counter=5;
for (i=0; i<counter; i++) {

help = "t_txt"+i;
here.createTextField(help, 1, 100, 100, 1, 1);
here.t_txt0.autoSize = true;
here.t_txt0.text += "blablabla";

}

This works except for the contents. I would like to change the value of t_txt0 in this line:

here.t_txt0.text += "blablabla";

to t_txt1, t_txt2, etc. I tried several options but I can't get it to work. Does anyone know what code to use to solve this?

CreateTextField How To Remove?
Aye Amigos,

how are the tricks playing on you?

I just started learning flash and actionscript, and I have a little problem with a dynamic textfield.

The first thing I`ve done, is that I created a textfield via:

this.test_btn.onRelease = function() {
createTextField("test");

and so on. I think you know what I mean.

My problem now is, that when I change the scene via a link button, the textfield don't disappear.

At the moment I am helping myself, by writing into every single scene, the following script:

test._visible = false;

After this the textfield disappears when I click on a button, but this cannot be the solution. Is there a way, to tell Flash to kill the textfield, after I change the scene? I think there is a comamnd called removeTextField, but I dunno how to use it, or if it is the right command.

Thanks for helping me guys and ladies,

Domian *sosad*

Help Needed With CreateTextField()
Hi can any one explain to me where i have gone wrong in my script and how to embed fonts as for some reason i can get the font im using to show up
Here is the script i used to create the textfields::confused

//--------------------------------------------- textfields------------------
var sGreenFormat:TextFormat = new TextFormat("kroeger 06_56", 8, 0x7FDC09);
var sWhiteFormat:TextFormat = new TextFormat("kroeger 06_56", 8, 0xFFFFFF);
var sGreyFormat:TextFormat = new TextFormat("kroeger 06_56", 8, 0x9A9A9A);

MovieClip.prototype.create_text = function(sTextName, newDepth,TFormat, SizeMC, nX, nY, nWidth, nHeight) {
TFormat = (TFormat == undefined) ? tfFormatter : TFormat;
SizeMC = (SizeMC == undefined) ? mcDisplayBackground : SizeMC;
newDepth = (newDepth == undefined) ? 0 : newDepth;
nX = (nX == undefined) ? 3 : nX;
nY = (nY == undefined) ? -1.5 : nY;
nWidth = (nWidth == undefined) ? SizeMC._width: nWidth;
nHeight = (nHeight == undefined) ? SizeMC._height+1 : nHeight;
trace("Creating new text: tData"+newDepth+", "+nX+", "+nY+", "+nWidth+", "+nHeight);
this.createTextField("tData"+newDepth, newDepth, nX, nY, nWidth, nHeight);
this["tData"+newDepth].text = sTextName;
this["tData"+newDepth].selectable = false;
this["tData"+newDepth].multiline = false;
this["tData"+newDepth].wordWrap = false;
this["tData"+newDepth].setTextFormat(TFormat);
};
this.create_text("Interactive Portfolio", 0, sGreenFormat ,mcDisplayBackground, mcDisplayBackground._x+3, mcDisplayBackground._y-1);
mcMenu.create_text("Menu", 1, sGreenFormat, mytest, undefined, -2);
stop();

//------------------------------------------------------------------
as you can see from the image i have put up with the fonts active on my system e.g font_on the text is ok but with the fonts turned of e.g fonts_off i get a different text even thou the fonts are addressed in my script.

any help would be welcome on this

CreateTextField And Destroy
Hi,

I create a text field with the method createTextField.
How can I destroy this text field

Thanks
David

Copyright © 2005-08 www.BigResource.com, All rights reserved