Skip to main content
Participant
May 30, 2008
Question

Error 1120 Access of undefined property....

  • May 30, 2008
  • 2 replies
  • 379 views
I recently completed an Adobe video tutorial that showed me how to create a simple application using components: simple application

I'm trying to learn about document classes and how to use external .as files to control the movie, and so I figured this might be a good example to try using. However, I keep getting Compiler error 1120 on lines 11–4 (Access of undefined property dp); 16 (Access of undefined property myList and dp); 18 (Access of undefined property myList and announceSelect); 19 (Access of undefined property myButton and eatItem); and 22, 25, 26 (Access of undefined property myList). I looked at other 1120 problems on the forum and it seems like most of them are labeling-related, and from what I can tell, my labels are okay. Any help would be much appreciated!

The flash file consists of a list with the name myList and a button with the name myButton. The code from the .as file is as follows:
This topic has been closed for replies.

2 replies

Inspiring
May 31, 2008
Move all the initialization stuff into a constructor or method called by the
constructor. i.e.

public class Eating extends MovieClip {

var dp:DataProvider = new DataProvider();

//constructor
public function Eating ()
{
dp.addItem( { label: "tomato" } );
dp.addItem( { label: "carrot" } );
dp.addItem( { label: "blueberry" } );
dp.addItem( { label: "turnip" } );

myList.dataProvider = dp;
myList.addEventListener(Event.CHANGE, announceSelect);
myButton.addEventListener(MouseEvent.CLICK, eatItem);
}




Participating Frequently
May 30, 2008
myList do you create that on with authoring tool (is in the fla)?
If not make sure you create it in the AS3
philrulesAuthor
Participant
May 31, 2008
I'm sorry, I don't quite understand what you mean.

The AS worked in the flash file itself; it was when I tried to put it into an external file that I ran into problems.