0
votes

I have been working on a project in Adobe Flash Pro CS5 and I am trying to add text to a textbox inside of a movieclip. I then want to add this movie clip to a scrollpane. I have this: The instance names are scrollpane = scroller movieclip = achievements textbox = progress1 (I need to do this for 10 different text boxes all in the same movieclip)

import flash.text.TextField
achievements.progress1.text = "16";
scroller.source = achievements

When I run this I get the Error 1119: Access of possibly undefined property progress1 through a reference with static type Class.

I made the movieclip on the stage and exported it for actionscript. I added the text boxes to this and game them all instance names. I Don't know what is wrong and really need some help. Thanks!

1

1 Answers

0
votes

you apparently named your class "achievements" since as3 is saying the "progress1" property doesn't exist on the class itself. Of course you will want to size and move the components as you see fit, but here is a basic idea for the class and it's usage:

package {

      public class Achievements extends MovieClip {

           public var progress1:TextField = new TextField();
           public var progress2:TextField = new TextField();
           public var progress3:TextField = new TextField();

           public function Achievements(){
                addChild(progress1);
                addChild(progress2);
                addChild(progress3);
           }
      }
 }

 //Then in your main code:

 var achievements:Achievements = new Achievements();
 addChild(achievements);


 //Then to set the text
 achievements.progress1.text = "it's alive!!!";