A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Access Text Field On Stage

  1. #1

    Access Text Field On Stage

    I have a text field mainLoadText placed on the stage at authoring time. How do I access it, from the timeline?

    If I use stage.mainLoadText I get

    1119: Access of possibly undefined property mainLoadText through a reference with static type Class.

    and If I use just mainLoadText I get

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at Package:ocument/Package::frame1()

  2. #2
    hippie hater Cimmerian's Avatar
    Join Date
    Oct 2006
    Location
    over there
    Posts
    599
    click it, go in propertys, give it an instance name and use that name

  3. #3
    Besides it being common sense, I have already given it an instance name of mainLoadText, but I cannot access it.

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    There should be no problem accessing the textfield when it is harcopy on the stage. You cannot use Stage (see error). How do you place it on the stage?
    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    I just made a new dynamic text field on the stage and named it mainLoadText.

    Here is my frame 1 code

    mainLoadText.text = "Hello"

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Works for me. Do you have CS3?
    - The right of the People to create Flash movies shall not be infringed. -

  7. #7
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,358
    and the textfield is on the same frame as the code, right? You will get #1009 if not. #1119 is a result of trying to access a variable/instance name from an instance that doesnt have that variable defined for it. The stage object cannot have any variables defined for it outside of its own default definition (plus all objects on the main timeline are in the root instance and the root instance is sitting in stage).

  8. #8
    I see, that was the problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center