Search code examples
flashactionscript-2

AS 2.0 dynamic Text in Movieclip


I'm using ActionScript 2.0 and I do not have control of dynamic text inside movie clips. I have a movie clip named 'Glass' and dynamic text named 'Glass_ID' I want Glass_ID Value become Glass_ID01 when clicked the button named 'btn' but it doesn's work how to i'm solve it?

on(press){this.Glass.Glass_ID.text ="Glass_ID01"}

Solution

  • If "Glass" is not inside the button this won't work, you must set the correct path, eg.

    on(press){_level0.Glass.Glass_ID.text ="Glass_ID01"}
    

    or from the timeline:

    btn.onPress = function(){
       _level0.Glass.Glass_ID.text ="Glass_ID01"
    }
    

    (of course, you should change that _level0 with _root or a container movieclip, whatever applies to your situation).

    Disclaimer: last time I used Flash it was 2011! :-)