Skip to main content
November 21, 2009
Answered

MovieClip Compile Error

  • November 21, 2009
  • 1 reply
  • 958 views

Good evening,

Sorry for a newbie question, but that's what I am!  I am attempting to create a single frame movie clip that contains 3 dynamic text fields.  In the MovieClip class I need to modify the contents and format of the text fields.  My code has no syntax errors, but it does not compile.   Here is my code:

package 
{

import flash.display.MovieClip;
//import fl.controls.TextArea;
//import flash.text.TextField;
 
public class FactProblem extends MovieClip
{
  private var txtT1:String="a";
  private var txtT2:String="b";
  private var txtT3:String="c";
  private var locX:Number=20;
  private var locY:Number = 20;
  //private var t1:TextArea;
  //private var t1:TextField;
 
  public function FactProblem()
  {
   with (this)
   {
   x = locX;
   y = locY;
   //t1.text = txtT1;
   //t2.text = txtT2;
   //t3.text = txtT3;
   }
  }
}
}

As you can see from my code I tried importing TextArea and TextField, but the problem persists.  as the code exists, this is the error message:

ReferenceError: Error #1056: Cannot create property t1 on FactProblem.
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at FactProblem()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()

Your suggestions would be greatly appreciated.  For the past three days I've not been flashing; I've been stumbling in the dark!

This topic has been closed for replies.
Correct answer kglad

Kglad,

Thanks for your assistance.  I did as you suggested and created a new as3 fla.  I had the same problem.  I was using FlashDevelop to write the code, so I created yet another as3 fla, but using just flash.  Walla, it worked!!!   I have yet to figure out what went wrong in setting up FlashDevelop.  However, I do prefer that IDE to the Flash IDE.  I have to work my self up the learning curve


you're welcome.

1 reply

kglad
Community Expert
Community Expert
November 21, 2009

do you have a movieclip in your fla's library that has class =  FactProblem and does that movieclip contain textfields with instance names t1,t2, t3?

November 21, 2009

Kglad,

Thanks for your response.  The movie's fla Library contains one MovieClip, FactProblem.  The properties window for the MC has the "Export for ActionScript" and "Export in frame 1" checkboxes checked and the "Class" is FactProblem.  The "Base Class" entry box is empty.  The movie clip contains 3 Dynamic Text boxes, t1, t2, & t3.

BTW, I, too, am a Chicago native, grew up near Addison and Crawford, am a Cubs fan.

kglad
Community Expert
Community Expert
November 21, 2009

your base clase should be:  flash.display.MovieClip

(and i'm suffering with the bears right now.  i can't even think about the cubs.)