A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: dynamic text on a button

  1. #1
    Junior Member
    Join Date
    Sep 2008
    Posts
    19

    dynamic text on a button

    Hi!

    I'm trying to have a button with dynamic text to change the name for each button. Here is the code I entered (btn is my button, and btn0 is my dynamic text field):

    Code:
    btn.btn0.text="Work";
    but here is the output error I receive:

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

    I will be so grateful for any help!
    Thanks

  2. #2
    rabid_Delineator AttackRabbit's Avatar
    Join Date
    Dec 2003
    Location
    Orlando, Florida
    Posts
    481
    when are you trying to do this ?

  3. #3
    Junior Member
    Join Date
    Sep 2008
    Posts
    19
    I'm sorry; I'm not getting your question.

  4. #4
    Senior Member
    Join Date
    Jul 2006
    Location
    San Jose, CA
    Posts
    334
    The error is occurring because Flash doesn't know what "btn" is. So either the button isn't named correctly, or you're trying to access it before it's being created.
    I (Love | Hate) Flash.
    ----
    Save a version back so others may help you!

  5. #5
    rabid_Delineator AttackRabbit's Avatar
    Join Date
    Dec 2003
    Location
    Orlando, Florida
    Posts
    481
    when are you trying to assign this textfield a value ? Based on the one tiny line of code , I have absolutely no idea what else is going on in your app. Is this in a class , is this on the timeline somwhere, what event is calling this , is this in a function.

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