Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

1119: Access of possibly undefined property nameInput through a reference with static type Class.

New Here ,
Mar 04, 2014 Mar 04, 2014

Hi

I have had problems with the input code and keep getting this error: 1119: Access of possibly undefined property nameInput through a reference with static type Class.

The code is here below

function captureText():void

  {

   var myText = Page5.nameInput.text;

   Page6.nameOutput.text = "Hello "+myText+"!"

  }

Page 5 is the page the input is on

Page 6 is where the outpu is

nameInput and nameOutput are my text area and dynamic text boxes
Apparently they are static classes??

Any ideas will be greatfully appreciated

Thanks

TOPICS
ActionScript
2.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Mar 04, 2014 Mar 04, 2014

always type your vars:

so it should be:

   var myText:String = Page5.nameInput.text;

   Page6.nameOutput.text = "Hello "+myText+"!"

then:

make sure that when you call captureText(), Page5 and Page6 (which I guess are Sprites/MovieClips) are part of the current Displaylist

if you are for example on Scene5 of your file and Page6 is on Scene6, calling Page6 will throw an error, because Flash can`t find it on its current DisplayList

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 04, 2014 Mar 04, 2014

Thanks for your response

I have just tried this and I still have the same errors.

Can you suggest anything else ?

Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 04, 2014 Mar 04, 2014

The error appears to be indicating that the words Page6 and/or Page5 represent class names, not movieclip instance names.  How are these names defined?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 05, 2014 Mar 05, 2014
LATEST

...And this is one of the many reasons why you shouldn't get in the habit of using global static things to access things in different scopes instead of using dependency injection. Because if you're not clear in your head about exactly what it is you're doing, you can run into this type of error.

To clarify what Ned says, you've created a Class, knowingly or not, called Page5. Page5 will either be an Actionscript Class or a symbol in your library that has "Export for Actionscript" checked.

Looking at your code, it looks like you're using frame scripts, so you need to look to your timeline and make sure you have something on stage that is an instance of Page5. To follow good naming conventions, you should name your instance in camel case, starting with a lower case letter, such as page5. Now, your code should become:

function captureText():void {

     var myText = Page5(page5).nameInput.text;//cast to Page5 Class so we can refer to nameInput without error

     //etc...

  }

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines