Groups | Blog | Home
all groups > flash actionscript > february 2005 >

flash actionscript : Text oddity - does this make sense?


Byron Canfield
2/20/2005 7:33:58 PM
That would tend to indicate that originally, the textfields did not exist on
the timeline at either when you were trying to assign a value to the text
property and when you were trying to retrieve the value from the text
property.

--
--------
Reality will not be altered to comply with preconceived notions.

Byron "Barn" Canfield
Flash example files: http://www.canfieldstudios.com

Byron Canfield
2/20/2005 8:45:50 PM
Well, you did the trace, and it said the textfield text propety was
undefined, which is a very clear indication that either the textfield, as
addressed, did not exist when the trace executed. That is the purpose of
doing such traces.

You could test this by putting the same code on the very frame after the
textfields come into existence on the timeline. I would also recommend that
you carefully check the instance name of the textfield, as it is possible to
inadvertently put in a wordspace before or after the instance name in the
text entry field, and you won't even see it.

Challenge your assumptions.

--
--------
Reality will not be altered to comply with preconceived notions.

Byron "Barn" Canfield
Flash example files: http://www.canfieldstudios.com

Dave Mennenoh
2/20/2005 9:22:55 PM
In my movie I had a layer with 4 or 5 dynamic text fields. In a frame script
if I tried setting the text of any of them nothing happened:
fieldName.text = "some text"
If I tried to get the text I got undefined:
trace(fieldName.text)
Thinking a corruption problem, I deleted a field and recreated it. Still no
go. I quit Flash and restarted it. Same thing.
As a last resort, I selected all my fields and created a movie clip out of
them.
Now I can get and set the text of each field without problem.
I don't understand.


--
Dave -
www.blurredistinction.com/director
www.macromedia.com/go/team

Dave Mennenoh
2/20/2005 9:57:10 PM
Thanks Byron, but the frame script doing the setting and trace was 10 frames
after the text fields were instanced. It was very simple, it should work.
Simply putting the fields into a clip, and then referencing the clip first
made my code work.

--
Dave -
www.blurredistinction.com/director
www.macromedia.com/go/team

Dave Mennenoh
2/21/2005 3:30:43 AM
I'm telling ya - I did all that. It was an oddity and I'm wondering how
it might happen. Like I said, the text fields were instantiated 10
frames before the script executed. All I did to remedy the problem was
place the fields into a movie clip, which I named info. I then changed
my code from: trace(comments.text) to trace(info.comments.text) and it
worked. I didn't move anything around - just added the clip reference.
It's an anomoly.


David Stiller
2/21/2005 9:46:00 AM
Dave,

I'd be interested in seeing your FLA, if it's a file you can share and
you feel like emailing it to me. I hear what Byron is saying and I hear
what you're saying ... so now I'm just insanely curious. Despite what
you're seeing, it certainly is possible to simply lay down dynamic text
fields, give them instance names, and assign them text several frames
later -- as you would expect.


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

mandingo
2/22/2005 10:35:49 AM
So the obvious question would then be were the textFields all given an instanceName AND were all the instanceNames unique?

Dave Mennenoh
2/22/2005 11:37:42 AM
Hi David,
As I explained I place the fields in a clip and now it's working fine.
I'll see if removing them from the clip and placing them back on the
timeline cause the issue to reappear. I know you can just lay down
fields and then work with them - I do it all over the place in the same
movie - just this one spot having problems. Anyway, if the issue comes
back I'll be more than happy to send you the .fla. I'd like to get to
the botom of this also.


David Stiller
2/22/2005 1:20:27 PM
[quoted text, click to view]

Curioser and curioser. Well, certainly, in all my experience, there
have been a handful of times when nothing at all made sense. You said
you've already deleted the field(s) and recreated, so that's a stumper.


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

Byron Canfield
2/22/2005 2:56:27 PM
You mean you put the textfields in a movieclip and didn't change the code
that addressed the textfields, and then it worked? Or did you also change
the code? If so, to what?

--
--------
Reality will not be altered to comply with preconceived notions.

Byron "Barn" Canfield
Flash example files: http://www.canfieldstudios.com

AddThis Social Bookmark Button