A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: getting edit path of text in buttons using actionscript?

  1. #1
    Junior Member
    Join Date
    Oct 2004
    Posts
    18

    getting edit path of text in buttons using actionscript?

    Dear All,

    I wanted to change the colour of text within buttons, but could not get the name to use with the text object scripts - using the instance name of the button would not work.

    Someone suggested using the debug:list objects to get the instance name. This worked, however should one naviagte around from screen to screen the instance names change. Not good! Also hand doing this for each button would not be efficient.

    So is there a way of actionscript getting the target path of the text object within a button?

    Cheers

    Steve

  2. #2
    Flashkit Jedi

    Join Date
    Jul 2001
    Location
    Coruscant System
    Posts
    3,426
    I assume you are using the TextFormat methods etc?

    XFM

  3. #3
    Senior Mender trionik's Avatar
    Join Date
    Nov 2000
    Location
    Montréal,Canada
    Posts
    1,077
    youButton.setStyle("color",0x000000)

  4. #4
    Junior Member
    Join Date
    Oct 2004
    Posts
    18
    Yes I am using Textformat, etc.

  5. #5
    Junior Member
    Join Date
    Oct 2004
    Posts
    18
    trionik. I'm not using the component button objects. I think that is required for this to work? Does it work if the text is set to html?
    Any further advice?

    Cheers

    Steve

  6. #6
    Senior Mender trionik's Avatar
    Join Date
    Nov 2000
    Location
    Montréal,Canada
    Posts
    1,077
    yourTextField_txt.textColor = 0x000000;

  7. #7
    Junior Member
    Join Date
    Oct 2004
    Posts
    18
    trionik,

    I tried your first script whcih worked on comonent buttons. However I'm not using component buttons.

    I've tried using that (hence the textFormat menthods mentioned in the question.

    I can't get the target path of the dynamic text to place in my button instance. I can get it from the debug, list objects. but this value as shown in the output panel (ie
    "Button: Target="_level0.mybutname"
    Edit Text: Target = "_level0.mybutname.instance35".) is only kept the first visit to that screen, it changes there after. Also one would not wish to have to get the values from debug. One wishes to get flash to get the value and place it in the code you listed at runtime.

    Do you get what I mean?

    Cheers.

    Steve

  8. #8
    Senior Mender trionik's Avatar
    Join Date
    Nov 2000
    Location
    Montréal,Canada
    Posts
    1,077
    Actually no i dont get it.

    If it is not a component then you set an instance name for the textfield and the path should be yourButton.yourTextfield

  9. #9
    Flashkit Jedi

    Join Date
    Jul 2001
    Location
    Coruscant System
    Posts
    3,426
    Originally posted by trionik
    Actually no i dont get it.

    If it is not a component then you set an instance name for the textfield and the path should be yourButton.yourTextfield
    Exactly

    XFM

  10. #10
    Junior Member
    Join Date
    Oct 2004
    Posts
    18
    yeah. Makes sense. But it does not do this.

    That's why jrh over at macromedia.com suggested using the debug output window to find the actual edit text instance. Which does work, but it can't be used as it assigns the values as the swf plays from screen to screen. (Actually I've just noticed each time the pages are revisited the instance value goes up by the original value ie. 3,6,9, etc!!)

    Thanks for looking at this. Try it. Let me know if there is something I've missed! But I'm pretty sure this is a macromedia flash apin in the ***.

    Hopeful you'll find me stupid.

    Cheers

    Steve

  11. #11
    Junior Member
    Join Date
    Oct 2004
    Posts
    18
    To xurion and trionik,

    here is a file to show you what I mean. If you debug, you'll find the flash assigned instance, that keeps changing as the gotoframe 1 effectively moves one around the "site".

    It does not have the mybut.mytext value.

    Again let me know if you have any joy sorting this one. maybe rewrite the file!!!

    Cheers

    Steve

    (file in 7.2 I've never attached here before so I hope this works!).
    Attached Files Attached Files

  12. #12
    Senior Mender trionik's Avatar
    Join Date
    Nov 2000
    Location
    Montréal,Canada
    Posts
    1,077
    there

  13. #13
    Junior Member
    Join Date
    Oct 2004
    Posts
    18
    I am really sorry trionik.

    I should have stipulated that I need this to work with buttons. Accessibility issues mean that one has to use buttons for buttons not movie clips. Something to do with the way accessibility works with browsers and other software like screen readers.

    Did you find the same result as me r.e. the textformat object controls not working for the button? And see the instance name flash assigned when using debug?

    Any ideas?

    Cheers

    Steve

  14. #14
    Senior Mender trionik's Avatar
    Join Date
    Nov 2000
    Location
    Montréal,Canada
    Posts
    1,077
    never work with button and no i did not investigate...

    Sory

  15. #15
    Junior Member
    Join Date
    Oct 2004
    Posts
    18
    Thanks for trying.

    Steve

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