FORUMS: list search recent posts

When does createTextField() fail?

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
When does createTextField() fail?
on Dec 5, 2006 at 11:15:06 pm

I have a document that creates a text field like this:

var home=this;

function loader () {
home.createTextField("thetext", 8, 10, 10, 220, 300);
home.thetext.text="This example creates a text field";
trace(home + ' x ' + home.thetext );


When I run this file on its own, it creates the text field like I'd expect, and it traces "_level0 x _level0.thetext"

But when I import it into another document like this:

loadMovie(theurl, shutter.display);

The background of the file loads, but the text does not. And it traces "_level0.shutter.display x _level0.shutter.display" This makes it look like "thetext" wasn't created.

I've loaded other files with this loader before, but not anything else that dynamically created a text field like this. I made a very simple loader that did successfully load this file, but haven't yet determined what's the difference between the simple loader and the complex loader I would like to work.

What can make createTextField() fail? What should I double check?

Return to posts index

Mostly fixed it...
on Dec 6, 2006 at 12:05:16 am

I should have checked this off the bat, but it turns out my loader was version 5. I switched it up to 6 and it's good.

It still doesn't show the text, though the textfield does exist, and it contains the correct text, even if it is not displaying it. This may be a font embedding issue?

Return to posts index

Re: Mostly fixed it...
on Dec 6, 2006 at 1:38:05 am

I'd be suspicious of the level you're creating the text field in.

Return to posts index

Re: Mostly fixed it...
on Dec 6, 2006 at 3:30:05 am

I thought so, but I tried changing it to 200 or so and it still wasn't showing up.
I also have this code right next to it, which draws a translucent rectangle behind the text:

backing.beginFill(0xFFFFFF, 75);
backing.moveTo(0, 0);
backing.lineTo(240, 0);
backing.lineTo(240, 320);
backing.lineTo(0, 320);

So I tried bumping that up to 8 (same level as my text field was before) and it showed up fine.

I finished this particular project with a regular text-field and just changed its _visibility. But I'll still try to figure this thing out.

Return to posts index

Re: Mostly fixed it...
on Dec 6, 2006 at 3:58:19 am

Try this:

home.createTextField("thetext", home.getNextHighestDepth(), 10, 10, 220, 300);

Return to posts index

Matt Klundt
Re: Mostly fixed it...
on Dec 6, 2006 at 3:29:41 pm

You can do a couple things to error test this. Set the textfield to be selectable. You should see the I cursor when over the area of the textBlock.

home.thetext.selectable = true;

Another test is to trace the text inside the block. This will give you a better idea of if the text block should be displaying.


Or if all else fails, don't forget to use the built in debugger. (Shift+Cmd+Enter) You can see all heirarchy and values in that.


Return to posts index

Re: Mostly fixed it...
on Dec 6, 2006 at 5:53:08 pm

I've got it, now. It was a version problem again. I may have to give up on supporting flash player 6; I only started trying to support it after an annoying job interview a couple months ago.

Because this thing worked fine when it was on its own, I didn't think it was a version problem at first.

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved