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 ,
Feb 26, 2014 Feb 26, 2014

Hi

My friend is stuck with code for an input output and i cant work out what is wrong.

The errors that are appearing are

printscreen.png

he is using TextInput componants for input and Dynamic Text Boxes for the output.

any help would be appreciated

Matthew

package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.events.FocusEvent;
import fl.controls.TextInput;

public class Main extends MovieClip
{
  private var _isDragging:Boolean;
  var page1:Page1;
  var page2:Page2;
  var page3:Page3;
  var page4:Page4;
  var page5:Page5;
  var page6:Page6; 

  public function Main()
  {
  
   _isDragging = false;
   page1 = new Page1 ;
   page2 = new Page2 ;
   page3 = new Page3 ;
   page4 = new Page4 ;
   page5 = new Page5 ;
   page6 = new Page6 ;  
  
  
   addChild(page1);
   page1.buttonPathway1.addEventListener(MouseEvent.CLICK,buttonPathway1Click);
   page1.buttonPathway2.addEventListener(MouseEvent.CLICK,buttonPathway2Click);
   //removed button code
   page2.Next1.addEventListener(MouseEvent.CLICK,Next1Click);
   page2.Back2.addEventListener(MouseEvent.CLICK,Back2Click);
   page3.Next2.addEventListener(MouseEvent.CLICK,Next2Click);
   page3.Back1.addEventListener(MouseEvent.CLICK,Back1Click);
   page4.Back3.addEventListener(MouseEvent.CLICK,Back3Click);
   page4.Next3.addEventListener(MouseEvent.CLICK,Next3Click);
   page5.Next4.addEventListener(MouseEvent.CLICK,Next4Click);
   page5.Back4.addEventListener(MouseEvent.CLICK,Back4Click);
   page6.Backstart.addEventListener(MouseEvent.CLICK,BackstartClick);

   page3.greenSkirt.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown);
   page3.blueSkirt.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown);
   page3.redSkirt.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown);
   page3.redShirt.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown);
   page3.blueShirt.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown);
   page3.whiteShirt.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown);
   page3.navyJeans.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown);
   page3.blueJeans.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown);
   page3.blackJeans.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown);
  
   page3.greenSkirt.addEventListener(MouseEvent.MOUSE_UP,onMouseUp);
   page3.blueSkirt.addEventListener(MouseEvent.MOUSE_UP,onMouseUp);
   page3.redSkirt.addEventListener(MouseEvent.MOUSE_UP,onMouseUp);
   page3.redShirt.addEventListener(MouseEvent.MOUSE_UP,onMouseUp);
   page3.blueShirt.addEventListener(MouseEvent.MOUSE_UP,onMouseUp);
   page3.whiteShirt.addEventListener(MouseEvent.MOUSE_UP,onMouseUp);
   page3.navyJeans.addEventListener(MouseEvent.MOUSE_UP,onMouseUp);
   page3.blueJeans.addEventListener(MouseEvent.MOUSE_UP,onMouseUp);
   page3.blackJeans.addEventListener(MouseEvent.MOUSE_UP,onMouseUp);
  
   Page5.nameInput.addEventListener(Event.CHANGE,nameChangeHandler);
   Page5.nameInput.addEventListener(FocusEvent.KEY_FOCUS_CHANGE,k_m_fHandler);
   Page5.nameInput.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE,k_m_fHandler);
   Page5.emailAddressInput.addEventListener(Event.CHANGE,EmailChangeHandler);
   Page5.emailAddressInput.addEventListener(FocusEvent.KEY_FOCUS_CHANGE,k_m_fHandler);
   Page5.emailAddressInput.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE,k_m_fHandler);
  
   addEventListener(Event.ENTER_FRAME,onEnterFrame);

  }

  function buttonPathway1Click(event:MouseEvent):void
  {
   addChild(page2);
   removeChild(page1);
  }
  function buttonPathway2Click(event:MouseEvent):void
  {
   addChild(page3);
   removeChild(page1);
  }
  function Next1Click(event:MouseEvent):void
  {
   addChild(page3);
   removeChild(page2);
  }
  function Next2Click(event:MouseEvent):void
  {
   addChild(page4);
   removeChild(page3);

  }
  function Back1Click(event:MouseEvent):void
  {
   addChild(page2);
   removeChild(page3);
  }
  function Back2Click(event:MouseEvent):void
  {
   addChild(page1);
   removeChild(page2);
  }
  function Back3Click(event:MouseEvent):void
  {
   addChild(page3);
   removeChild(page4);
  }
  function Next3Click(event:MouseEvent):void
  {
   addChild(page6);
   addChild(page5);
   removeChild(page4);
  }
  function Next4Click(event:MouseEvent):void
  {
   removeChild(page5);
  
  }
  function Back4Click(event:MouseEvent):void
  {
   addChild(page4);
   removeChild(page5);
  }
  function BackstartClick(event:MouseEvent):void
  {
   addChild(page1);
   removeChild(page6);
  }


  private function onEnterFrame(event:Event):void
  {
   if (page3.greenSkirt.hitTestObject(page3.trouserTarget))
   {
    if (! _isDragging)
    {
     page3.greenSkirt.x = page3.trouserTarget.x;
     page3.greenSkirt.y = page3.trouserTarget.y;
    }
   }
   if (page3.blueSkirt.hitTestObject(page3.trouserTarget))
   {
    if (! _isDragging)
    {
     page3.blueSkirt.x = page3.trouserTarget.x;
     page3.blueSkirt.y = page3.trouserTarget.y;
    }
   }
   if (page3.redSkirt.hitTestObject(page3.trouserTarget))
   {
    if (! _isDragging)
    {
     page3.redSkirt.x = page3.trouserTarget.x;
     page3.redSkirt.y = page3.trouserTarget.y;
    }
   }
   if (page3.redShirt.hitTestObject(page3.topTarget))
   {
    if (! _isDragging)
    {
     page3.redShirt.x = page3.topTarget.x;
     page3.redShirt.y = page3.topTarget.y;
    }
   }
   if (page3.blueShirt.hitTestObject(page3.topTarget))
   {
    if (! _isDragging)
    {
     page3.blueShirt.x = page3.topTarget.x;
     page3.blueShirt.y = page3.topTarget.y;
    }
   }
   if (page3.whiteShirt.hitTestObject(page3.topTarget))
   {
    if (! _isDragging)
    {
     page3.whiteShirt.x = page3.topTarget.x;
     page3.whiteShirt.y = page3.topTarget.y;
    }
   }
   if (page3.navyJeans.hitTestObject(page3.trouserTarget))
   {
    if (! _isDragging)
    {
     page3.navyJeans.x = page3.trouserTarget.x;
     page3.navyJeans.y = page3.trouserTarget.y;
    }
   }
   if (page3.blueJeans.hitTestObject(page3.trouserTarget))
   {
    if (! _isDragging)
    {
     page3.blueJeans.x = page3.trouserTarget.x;
     page3.blueJeans.y = page3.trouserTarget.y;
    }
   }
   if (page3.blackJeans.hitTestObject(page3.trouserTarget))
   {
    if (! _isDragging)
    {
     page3.blackJeans.x = page3.trouserTarget.x;
     page3.blackJeans.y = page3.trouserTarget.y;
    }
   }
  }
  private function onMouseUp(event:Event):void
  {
   var currentDragObject:MovieClip = event.currentTarget as MovieClip;
   currentDragObject.stopDrag();
   _isDragging = false;
   currentDragObject.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
  
   //Find the name of the object over which the drag object is dropped
   if(currentDragObject.dropTarget != null)
   {
    trace(currentDragObject.dropTarget.parent.name);
   }
  }
  private function onMouseDown(event:Event):void
  {
   var currentDragObject:MovieClip = event.currentTarget as MovieClip;
   currentDragObject.startDrag();
  
   _isDragging = true;
   currentDragObject.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
  }
  function nameChangeHandler(ch_evt:Event):void
  {
   Page6.nameOutput.text = Page5.nameInput.text;
  }
  function k_m_fHandler(kmf_event:FocusEvent):void
  {
   kmf_event.preventDefault();
  }
  function EmailChangeHandler(ch_evt:Event):void
  {
   Page6.emailAddressOutput.text = Page5.emailAddressInput.text;
  }
}
}

TOPICS
ActionScript
509
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
Community Expert ,
Feb 26, 2014 Feb 26, 2014
LATEST

there's no nameInput defined for page5 when that line of code executes.  you can confirm by checking the line numbers in the error message.

likewise with the rest of the page5 properties.

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