Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

where is the textField?

Status
Not open for further replies.

cruise95

Programmer
Oct 7, 2003
56
US
Hello all,

In my flash program, I have a MovieCoip called display_mc that contains another movieClip called list_mc. List_mc contains several created movieClips called "thisMC0", "thisMC2", ... "thisMC9". Each of these movie clips contain a textField called "myTextField".

i.e. _level0:
display_mc:
list_mc:
thisMC0:
myTextField
thisMC1:
myTextField
...
thisMC9:
myTextField


I can get all of the "thisMC"s to show up, but the textFields will not apppear. Can anyone please tell me why this is so?

Thank you -
Frank


Here is the code for clarity:
Code:
var nextAvailableDepth = 1;

for (var SLIndex=0; SLIndex<10; SLIndex++){
   instanceName = "thisMC"+SLIndex;
   thisMov = display_mc.list_mc.createEmptyMovieClip(instanceName, _root.nextAvailableDepth++);
   with (thisMov) {
      beginFill(0xFFFF59, 40);
      lineTo(100, 0);
      lineTo(100, 20);
      lineTo(0, 20);
      endFill(0, 0);
      _x=10;
      _y=SLIndex*30;
   }

   //create text box
   thisMov.createTextField("myTextField",_root.nextAvailableDepth,1,1,10,10);
   var thisMovTitle = eval(thisMov + ".myTextField");
   trace(thisMovTitle);
   with (thisMovTitle) {
      multiline = false; 
      wordWrap = true;
      border = true;
      borderColor = 0x000000;
   }
   trace(display_mc.list_mc[instanceName]["myTextField"].borderColor);
}  // end for


stop();
 
I can't see that you have assigned any text to myTextField. So what you have is probably a bunch of empty text fields (giving the appearance that you can't see them).

See if this helps:

Code:
   //create text box
   thisMov.createTextField("myTextField",_root.nextAvailableDepth,1,1,10,10);
   var thisMovTitle = eval(thisMov + ".myTextField");
   trace(thisMovTitle);
   with (thisMovTitle) {
      multiline = false; 
      wordWrap = true;
      border = true;
      borderColor = 0x000000;
   }
   this.myTextField.text = "Text is here";
   trace(display_mc.list_mc[instanceName]["myTextField"].borderColor);
}  // end for

I can't test that but like I said somewhere in there you need to tell the text box you create what to say.

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
That's what I thought too! I previously had text in there, but I took it out. I added it bask in just to make sure now. The textField still doesn't show up. I also had the border in there so I could at least see that...but I can't see that either. What do you think?

The trace is giving the correct result, but its just not showing up?!

thank you -
Frank


The new code is in red:

Code:
var nextAvailableDepth = 1;

for (var SLIndex=0; SLIndex<10; SLIndex++){
   instanceName = "thisMC"+SLIndex;
   thisMov = display_mc.list_mc.createEmptyMovieClip(instanceName, _root.nextAvailableDepth++);
   with (thisMov) {
      beginFill(0xFFFF59, 40);
      lineTo(100, 0);
      lineTo(100, 20);
      lineTo(0, 20);
      endFill(0, 0);
      _x=10;
      _y=SLIndex*30;
   }

   //create text box
   thisMov.createTextField("myTextField",_root.nextAvailableDepth,1,1,10,10);
   var thisMovTitle = eval(thisMov + ".myTextField");
   trace(thisMovTitle);
   with (thisMovTitle) {
      multiline = false; 
      wordWrap = true;
      border = true;
      borderColor = 0x000000;
      [red]text = "Text is here";[/red]
   }
   [red]trace(display_mc.list_mc[instanceName]["myTextField"].text);[/red]
}  // end for


stop();
 
Hi cruise95,

Your problem is simply that your text fields aren't big enough. 10 x 10 just won't hold 12 point text. you also forgot the ++ on the end of nextAvailableDepth.
use:
Code:
thisMov.createTextField("myTextField",_root.nextAvailableDepth++,0,0,100,20);

Philip Keiter
Senior Flash Software Developer
Sphyrras
 
Thanx Philip for catching the ++. That would definately make a difference. I also increased the textField boundaries, but that didn't help.

Regards -
Frank
 
Hello again,

I want to thank FlashDev and Pixl8r for their help. I've about decided to try something else. I got display_mc and list_mc out of a tutorial that I bought. However, the tutorial explains AS and not the GUI stuff. In other words, I can re-create display_mc, but not list_mc. I thought that I could recreate it too. I don't like not being able to recreate the examples that I'm using.

All that I want to do is:
I started out with some animations/images on _root. These work fine. However the animations may go off the screen and the user will need to scroll down to access the rest. So I wanted to provide a way for the user to scroll down. It sounds pretty simple (so I thought). I've seen many examples of scrolling textFields but not animation.

Does anyone know of a good tutorial or some other way that I can scroll animations? I really appreciate any help with this -

Frank
 
I first create a movieClip (list_mc) that contains the other movies. Contained in list_mc are a series of empty movieClips (created using a for loop). Thes movieClips contain a textField. The text shows up and everything looks good. I can create a mask layer and all is well. But when I draw a mask, then I can see the masked portion of the MovieClip (as expected) but I cannot see the text.

Somehow the mask is blocking my textFields. Why is this? How do I get the textFields to show up?

Thanx -
Frank
 
I was making a mask totally from the GUI. Now I am just making an MC (squareMask) for my mask - like the GUI approach - but using AS (_root.setMask(squareMask)) instead.

This seems to work good. _root contains list_mc which contains myMC0,myMC1,...myMC9. The myMCs contain a textField.
i.e.
_level0:
_level0.list_mc
_level0.list_mc.myMC0
_level0.list_mc.myMC0.myTextField
_level0.list_mc.myMC1
_level0.list_mc.myMC1.myTextField
...
_level0.list_mc.myMC9
_level0.list_mc.myMC9.myTextField


I have two buttons on _root with instance names of up_btn and down_btn. When ever one is pressed, the list_mc moves up or down and the mask stays in place. This gives the efect of scrolling. This makes me happy, but I am not through and there are still some probable pitfalls.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top