Skip to main content
Inspiring
November 4, 2008
Question

targeting one level from another

  • November 4, 2008
  • 8 replies
  • 498 views
Within a Flash document called "replace.swf" the following input style text field is created:
_root.createTextField("main_txt",10,375,65,375,400);

------- so, the above input text field can be addressed as "_level10.main_txt" from another level right?

I also load "textStyler.swf" within "replace.swf" on level99:

Now I try to make a change in "_level10.main_txt" from "textStyler.swf" with the following code:
_level10.main_txt.text = "this is the replacement text";


But no changes occur to the text field.

I guess there's something wrong with the targeting!
??
thanks, carry
This topic has been closed for replies.

8 replies

Inspiring
November 5, 2008
Thanks. I never cared much for _level anyway. It's nice to know that I can know less instead of leaning that I have to learn more :)
Inspiring
November 4, 2008
FYI - it's best if you completely forget about the notion of levels as they
are useless and confusing. Think in terms of movieClips and depths within
those clips - which are the same as layers in your clips timeline.

--
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/


Inspiring
November 4, 2008
okay, i get it.. i'm thinking of the z order. I can probably figure it out now.. thanks
Inspiring
November 4, 2008
No. it doesn't. If that code is in the clip that is loaded into _level99 then that code creates the text field at a DEPTH of 10 on the main timeline of _level99.

DEPTHS and LEVELS are not the same thing.
Inspiring
November 4, 2008
creates the text field on level 10 (i thought??)

_root.createTextField("main_txt",10,375,65,375,400);// level 10
main_txt.type = "input";
main_txt.border = false;
main_txt.textWidth = 400;
main_txt.background = false;
main_txt.multiline = true;
main_txt.html = false;
main_txt.selectable = true;
main_txt.wordWrap = true;
main_txt.variable = "sortedDir";
main_txt.scroll = true;
//load text file
loadText.load("editText/"+doc+".txt");
Inspiring
November 4, 2008
the .swf file that is loaded into level99 is addressing the dynamic text file that is loaded into level 10. It is trying to change the text in some way.
Inspiring
November 4, 2008
Oh as I clicked the reply button I noticed what I think you are doing.

You think that creating the clip at a depth of 10 puts it on _level10? That isn't what depths are. Read these pages to learn about depths in Flash:

http://www.kirupa.com/developer/actionscript/depths.htm

Levels are really not that useful if you are using actionscript because they aren't really a class with methods and properties that you can manipulate. In fact they have gone away in AS3. There is no way to create a textfield on _level10 other than to make a swf file with a textfield and then loadMovieNum (or the MovieClipLoader version) into _level10.
Inspiring
November 4, 2008
Well you say replace.swf is on _level99, but then you are addressing it on _level10. So which is it?

If it isn't working, then there is no text field called main_txt on the root timeline of _level10 -- at least not at the time the command is run. So you might have a problem with trying to address the field before the external content has loaded.