Call to a possibly undefined method

I am having a real problem with using two different Tile Lists in one movieClip I keep getting:
call to a possibly undefined method trousers1
call to a possibly undefined method trousers2
call to a possibly undefined method trousers3
call to a possibly undefined method trousers4
call to a possibly undefined method trousers5
package
import flash.display.MovieClip;
import flash.events.MouseEvent;
import fl.controls.Slider;
import fl.events.SliderEvent;
import fl.controls.Label;
import fl.controls.NumericStepper;
import flash.events.Event;
import fl.controls.TileList;
import flash.display.DisplayObject;
import fl.events.ListEvent;
import flash.utils.getDefinitionByName;
import flash.events.EventDispatcher;
import fl.controls.SelectableList;
public class Main extends MovieClip
   //Variables
   var startPage:StartPage;
   var tutorialPage:TutorialPage;
   var maleSizePage:MaleSizePage;
   var femaleSizePage:FemaleSizePage;
   var maleDragDropPage:MaleDragDropPage;
   var femaleDragDropPage:FemaleDragDropPage;
   var objTShirt:Object={};
   var objTrouser:Object={};
   //clothes variables
   var tshirt1:tShirt1;
   var tshirt2:tShirt2;
   var tshirt3:tShirt3;
   var tshirt4:tShirt4;
   var trousers1:Trousers1;
   var trousers2:Trousers2;
   var trousers3:Trousers3;
   var trousers4:Trousers4;
   var trousers5:Trousers5;
   var _isDragging:Boolean;
   public function Main()
    //Pages
    startPage = new StartPage;
    tutorialPage = new TutorialPage;
    maleSizePage = new MaleSizePage;
    femaleSizePage = new FemaleSizePage;
    maleDragDropPage = new MaleDragDropPage;
    femaleDragDropPage = new FemaleDragDropPage;
    objTShirt[0+"_"+0] = new tShirt1;
    objTShirt[1+"_"+0] = new tShirt2;
    objTShirt[2+"_"+0] = new tShirt3;
    objTShirt[3+"_"+0] = new tShirt4;
    objTrouser[0+"_"+0] = new trousers1;
    objTrouser[1+"_"+0] = new trousers2;
    objTrouser[2+"_"+0] = new trousers3;
    objTrouser[3+"_"+0] = new trousers4;
    objTrouser[4+"_"+0] = new trousers5;
    _isDragging = false;
    addChild(startPage);
    //Event Listeners Buttons
    startPage.startButton.addEventListener(MouseEvent.CLICK,startButtonClick);
    tutorialPage.continueButton.addEventListener(MouseEvent.CLICK,tutorialContinueButtonClick);
    maleSizePage.continueButton.addEventListener(MouseEvent.CLICK,maleSizeContinueButtonClick);
    femaleSizePage.continueButton.addEventListener(MouseEvent.CLICK,femaleSizeContinueButtonClick);
    //Size Page Event Listeners
    maleSizePage.heightSlider.addEventListener(SliderEvent.CHANGE,heightSlChange_M);
    maleSizePage.neckSlider.addEventListener(SliderEvent.CHANGE,neckSlChange_M);
    maleSizePage.chestSlider.addEventListener(SliderEvent.CHANGE,chestSlChange_M);
    maleSizePage.waistSlider.addEventListener(SliderEvent.CHANGE,waistSlChange_M);
    maleSizePage.armSlider.addEventListener(SliderEvent.CHANGE,armSlChange_M);
    maleSizePage.legSlider.addEventListener(SliderEvent.CHANGE,legSlChange_M);
    maleSizePage.heightValue.addEventListener(Event.CHANGE,heightVChange_M);
    maleSizePage.neckValue.addEventListener(Event.CHANGE,neckVChange_M);
    maleSizePage.chestValue.addEventListener(Event.CHANGE,chestVChange_M);
    maleSizePage.waistValue.addEventListener(Event.CHANGE,waistVChange_M);
    maleSizePage.armValue.addEventListener(Event.CHANGE,armVChange_M);
    maleSizePage.legValue.addEventListener(Event.CHANGE,legVChange_M);
    femaleSizePage.heightSlider.addEventListener(SliderEvent.CHANGE,heightSlChange_F);
    femaleSizePage.bustSlider.addEventListener(SliderEvent.CHANGE,bustSlChange_F);
    femaleSizePage.hipSlider.addEventListener(SliderEvent.CHANGE,hipSlChange_F);
    femaleSizePage.armSlider.addEventListener(SliderEvent.CHANGE,armSlChange_F);
    femaleSizePage.waistSlider.addEventListener(SliderEvent.CHANGE,waistSlChange_F);
    femaleSizePage.legSlider.addEventListener(SliderEvent.CHANGE,legSlChange_F);
    //Drag and Drop page Listeners
    maleDragDropPage.menuBar.stop();
    femaleDragDropPage.menuBar.stop();
    maleDragDropPage.menuBar.topsButton.addEventListener(MouseEvent.MOUSE_DOWN,topsMenuShow_M);
    maleDragDropPage.menuBar.trousersButton.addEventListener(MouseEvent.MOUSE_DOWN,trousersMenuShow_M);
    maleDragDropPage.menuBar.shoesButton.addEventListener(MouseEvent.MOUSE_DOWN,shoesMenuShow_M);
   //Event Button handlers
   function startButtonClick(event:MouseEvent):void
    addChild(tutorialPage);
   function tutorialContinueButtonClick(event:MouseEvent):void
    if (startPage.maleSelection.selected == true)
     addChild(maleSizePage);
     removeChild(startPage);
     removeChild(tutorialPage);
    if (startPage.femaleSelection.selected == true)
     addChild(femaleSizePage);
     removeChild(startPage);
     removeChild(tutorialPage);
   function maleSizeContinueButtonClick(event:MouseEvent):void
    addChild(maleDragDropPage)
    removeChild(maleSizePage)
   function femaleSizeContinueButtonClick(event:MouseEvent):void
    addChild(femaleDragDropPage)
    removeChild(femaleSizePage)
   // slider handlers
   function heightSlChange_M(event:SliderEvent):void
    maleSizePage.heightValue.value = maleSizePage.heightSlider.value;
    maleSizePage.maleCharacter.height = maleSizePage.heightSlider.value + 280;
   function neckSlChange_M(event:SliderEvent):void
    maleSizePage.neckValue.value = maleSizePage.neckSlider.value;
    maleSizePage.maleCharacter.neck.width = maleSizePage.neckSlider.value + 40;
   function chestSlChange_M(event:SliderEvent):void
    maleSizePage.chestValue.value = maleSizePage.chestSlider.value;
    maleSizePage.maleCharacter.chest.width = maleSizePage.chestSlider.value + 141;
   function waistSlChange_M(event:SliderEvent):void
    maleSizePage.waistValue.value = maleSizePage.waistSlider.value;
    maleSizePage.maleCharacter.waist.width = maleSizePage.waistSlider.value + 140;
   function armSlChange_M(event:SliderEvent):void
    maleSizePage.armValue.value = maleSizePage.armSlider.value;
    maleSizePage.maleCharacter.leftArm.height = maleSizePage.armSlider.value + 180;
    maleSizePage.maleCharacter.rightArm.height = maleSizePage.armSlider.value + 180;
   function legSlChange_M(event:SliderEvent):void
    maleSizePage.legValue.value = maleSizePage.legSlider.value;
    maleSizePage.maleCharacter.rightLeg.height = maleSizePage.legSlider.value + 250;
    maleSizePage.maleCharacter.leftLeg.height = maleSizePage.legSlider.value +250;
   function heightVChange_M(e:Event):void
    maleSizePage.heightSlider.value = maleSizePage.heightValue.value;
    maleSizePage.maleCharacter.height = maleSizePage.heightValue.value + 280;
   function neckVChange_M(e:Event):void
    maleSizePage.neckSlider.value = maleSizePage.neckValue.value;
    maleSizePage.maleCharacter.neck.width = maleSizePage.neckValue.value + 40;
   function chestVChange_M(e:Event):void
    maleSizePage.chestSlider.value = maleSizePage.chestValue.value;
    maleSizePage.maleCharacter.chest.width = maleSizePage.chestValue.value + 141;
   function waistVChange_M(e:Event):void
    maleSizePage.waistSlider.value = maleSizePage.waistValue.value;
    maleSizePage.maleCharacter.waist.width = maleSizePage.waistValue.value + 140
   function armVChange_M(e:Event):void
    maleSizePage.armSlider.value = maleSizePage.armValue.value;
    maleSizePage.maleCharacter.leftArm.height = maleSizePage.armValue.value + 180;
    maleSizePage.maleCharacter.rightArm.height = maleSizePage.armValue.value + 180;
   function legVChange_M(e:Event):void
    maleSizePage.legSlider.value = maleSizePage.legValue.value;
    maleSizePage.maleCharacter.leftLeg.height = maleSizePage.legValue.value + 240;
    maleSizePage.maleCharacter.rightLeg.height = maleSizePage.legValue.value + 240;
   function heightSlChange_F(e:Event):void
    femaleSizePage.heightValue.value = femaleSizePage.heightSlider.value;
    femaleSizePage.femaleCharacter.height = femaleSizePage.heightSlider.value + 250;
   function bustSlChange_F(e:Event):void
    femaleSizePage.bustValue.value = femaleSizePage.bustSlider.value;
    femaleSizePage.femaleCharacter.chest.width = femaleSizePage.bustSlider.value + 150;
   function waistSlChange_F(event:SliderEvent):void
    femaleSizePage.waistValue.value = femaleSizePage.waistSlider.value;
    femaleSizePage.femaleCharacter.waist.width = femaleSizePage.waistSlider.value + 140;
   function armSlChange_F(event:SliderEvent):void
    femaleSizePage.armValue.value = femaleSizePage.armSlider.value;
    femaleSizePage.femaleCharacter.leftArm.height = femaleSizePage.armSlider.value + 180;
    femaleSizePage.femaleCharacter.rightArm.height = femaleSizePage.armSlider.value + 180;
   function legSlChange_F(event:SliderEvent):void
    femaleSizePage.legValue.value = femaleSizePage.legSlider.value;
    femaleSizePage.femaleCharacter.rightLeg.height = femaleSizePage.legSlider.value + 250;
    femaleSizePage.femaleCharacter.leftLeg.height = femaleSizePage.legSlider.value +250;
   function hipSlChange_F(event:SliderEvent):void
    femaleSizePage.hipValue.value = femaleSizePage.hipSlider.value;
    femaleSizePage.femaleCharacter.hips.width = femaleSizePage.hipSlider.value + 160;
   function heightVChange_F(e:Event):void
    femaleSizePage.heightSlider.value = femaleSizePage.heightValue.value;
    femaleSizePage.femaleCharacter.height = femaleSizePage.heightValue.value + 280;
   function bustVChange_F(e:Event):void
    femaleSizePage.bustSlider.value = femaleSizePage.bustValue.value;
    femaleSizePage.femaleCharacter.chest.width = femaleSizePage.bustValue.value + 150;
   function hipsVChange_F(e:Event):void
    femaleSizePage.hipSlider.value = femaleSizePage.hipValue.value;
   function waistVChange_F(e:Event):void
    femaleSizePage.waistSlider.value = femaleSizePage.waistValue.value;
    femaleSizePage.femaleCharacter.waist.width = femaleSizePage.waistValue.value + 140;
   function armVChange_F(e:Event):void
    femaleSizePage.armSlider.value = femaleSizePage.armValue.value;
    femaleSizePage.femaleCharacter.leftArm.height = femaleSizePage.armValue.value + 180;
    femaleSizePage.femaleCharacter.rightArm.height = femaleSizePage.armValue.value + 180
   function legVChange_F(e:Event):void
    femaleSizePage.legSlider.value = femaleSizePage.legValue.value;
    femaleSizePage.femaleCharacter.rightLeg.height = femaleSizePage.legValue.value + 250;
    femaleSizePage.femaleCharacter.leftLeg.height = femaleSizePage.legValue.value +250;
   //Drag and Drop handlers
   function topsMenuShow_M(event:MouseEvent):void
    maleDragDropPage.menuBar.gotoAndStop(2);
    maleDragDropPage.menuBar.maleTops.addEventListener(ListEvent.ITEM_CLICK,addTshirt1_M)
   function trousersMenuShow_M(event:MouseEvent):void
    maleDragDropPage.menuBar.gotoAndStop(3);
    maleDragDropPage.menuBar.maleTrousers.addEventListener(ListEvent.ITEM_CLICK,addTrousers1_M)
   function shoesMenuShow_M(event:MouseEvent):void
    maleDragDropPage.menuBar.gotoAndStop(4);
   function addTshirt1_M(event:ListEvent):void
    trace(event.rowIndex,event.columnIndex)
    if (contains(objTShirt[0+"_"+0]))
     removeChild(objTShirt[0+"_"+0]);
    if (contains(objTShirt[1+"_"+0]))
     removeChild(objTShirt[1+"_"+0]);
    if (contains(objTShirt[2+"_"+0]))
     removeChild(objTShirt[2+"_"+0]);
    if (contains(objTShirt[3+"_"+0]))
     removeChild(objTShirt[3+"_"+0]);
    addChild(objTShirt[event.rowIndex+"_"+event.columnIndex] as DisplayObject).addEventListener(MouseEvent.MOUSE_DOWN,tShirtDragPickup);
   function tShirtDragPickup(event:Event):void
    var currentDragObject:MovieClip = event.currentTarget as MovieClip;
    currentDragObject.startDrag();
    setChildIndex(currentDragObject, numChildren-1);
    _isDragging = true;
    currentDragObject.addEventListener(MouseEvent.MOUSE_UP, tShirtDragDrop);
   function tShirtDragDrop(event:Event):void
    var currentDragObject:MovieClip = event.currentTarget as MovieClip;
    currentDragObject.stopDrag();
    _isDragging = false;
    currentDragObject.removeEventListener(MouseEvent.MOUSE_UP, tShirtDragDrop);
   function tShirtTarget(event:Event):void
    if (maleDragDropPage.objTShirt[0+"_"+0].hitTestObject(maleDragDropPage.maleCharacter.chest))
     if (! _isDragging)
      maleDragDropPage.objTShirt[0+"_"+0].x = maleDragDropPage.maleCharacter.chest.x;
      maleDragDropPage.objTShirt[0+"_"+0].y = maleDragDropPage.maleCharacter.chest.y;
    if (maleDragDropPage.objTShirt[1+"_"+0].hitTestObject(maleDragDropPage.maleCharacter.chest))
     if (! _isDragging)
      maleDragDropPage.objTShirt[1+"_"+0].x = maleDragDropPage.maleCharacter.chest.x;
      maleDragDropPage.objTShirt[1+"_"+0].y = maleDragDropPage.maleCharacter.chest.y;
    if (maleDragDropPage.objTShirt[2+"_"+0].hitTestObject(maleDragDropPage.maleCharacter.chest))
     if (! _isDragging)
      maleDragDropPage.objTShirt[2+"_"+0].x = maleDragDropPage.maleCharacter.chest.x;
      maleDragDropPage.objTShirt[2+"_"+0].y = maleDragDropPage.maleCharacter.chest.y;
    if (maleDragDropPage.objTShirt[3+"_"+0].hitTestObject(maleDragDropPage.maleCharacter.chest))
     if (! _isDragging)
      maleDragDropPage.objTShirt[3+"_"+0].x = maleDragDropPage.maleCharacter.chest.x;
      maleDragDropPage.objTShirt[3+"_"+0].y = maleDragDropPage.maleCharacter.chest.y;
   function addTrousers1_M(event:ListEvent):void
    trace(event.rowIndex,event.columnIndex)
    if (contains(objTrouser[0+"t"+0]))
     removeChild(objTrouser[0+"t"+0]);
    if (contains(objTrouser[1+"t"+0]))
     removeChild(objTrouser[1+"t"+0]);
    if (contains(objTrouser[2+"t"+0]))
     removeChild(objTrouser[2+"t"+0]);
    if (contains(objTrouser[3+"t"+0]))
     removeChild(objTrouser[3+"t"+0]);
    if (contains(objTrouser[4+"t"+0]))
     removeChild(objTrouser[4+"t"+0]);
    addChild(objTrouser[event.rowIndex+"t"+event.columnIndex] as DisplayObject).addEventListener(MouseEvent.MOUSE_DOWN,trouserDragPickup);
   function trouserDragPickup(event:Event):void
    var currentDragObject:MovieClip = event.currentTarget as MovieClip;
    currentDragObject.startDrag();
    setChildIndex(currentDragObject, numChildren-1);
    _isDragging = true;
    currentDragObject.addEventListener(MouseEvent.MOUSE_UP, trouserDragDrop);
   function trouserDragDrop(event:Event):void
    var currentDragObject:MovieClip = event.currentTarget as MovieClip;
    currentDragObject.stopDrag();
    _isDragging = false;
    currentDragObject.removeEventListener(MouseEvent.MOUSE_UP, trouserDragDrop);
   function trouserTarget(event:Event):void
    if (maleDragDropPage.objTrouser[0+"_"+0].hitTestObject(maleDragDropPage.maleCharacter.waist))
     if (! _isDragging)
      maleDragDropPage.objTrouser[0+"_"+0].x = maleDragDropPage.maleCharacter.waist.x;
      maleDragDropPage.objTrouser[0+"_"+0].y = maleDragDropPage.maleCharacter.waist.y;
    if (maleDragDropPage.objTrouser[1+"_"+0].hitTestObject(maleDragDropPage.maleCharacter.waist))
     if (! _isDragging)
      maleDragDropPage.objTrouser[1+"_"+0].x = maleDragDropPage.maleCharacter.waist.x;
      maleDragDropPage.objTrouser[1+"_"+0].y = maleDragDropPage.maleCharacter.waist.y;
    if (maleDragDropPage.objTrouser[2+"_"+0].hitTestObject(maleDragDropPage.maleCharacter.chest))
     if (! _isDragging)
      maleDragDropPage.objTrouser[2+"_"+0].x = maleDragDropPage.maleCharacter.chest.x;
      maleDragDropPage.objTrouser[2+"_"+0].y = maleDragDropPage.maleCharacter.chest.y;
    if (maleDragDropPage.objTShirt[3+"_"+0].hitTestObject(maleDragDropPage.maleCharacter.chest))
     if (! _isDragging)
      maleDragDropPage.objTrouser[3+"_"+0].x = maleDragDropPage.maleCharacter.chest.x;
      maleDragDropPage.objTrouser[3+"_"+0].y = maleDragDropPage.maleCharacter.chest.y;

You are trying to assign undefined instances of class objects rather than define them...
    objTrouser[0+"_"+0] = new trousers1;
    objTrouser[1+"_"+0] = new trousers2;
    objTrouser[2+"_"+0] = new trousers3;
    objTrouser[3+"_"+0] = new trousers4;
    objTrouser[4+"_"+0] = new trousers5;
should be
    objTrouser[0+"_"+0] = new Trousers1();
    objTrouser[1+"_"+0] = new Trousers2();
    objTrouser[2+"_"+0] = new Trousers3();
    objTrouser[3+"_"+0] = new Trousers4();
    objTrouser[4+"_"+0] = new Trousers5();
and I didn't look deeper to see why you aren't creating the instances you declared (trousers1, etc) instead of objTrouser[0+"_"+0] etc.

Similar Messages

  • Call to a possibly undefined method setPropertyIsEnumerable?

    Hi,
      I am trying to accomplish using doubleClick events on dateChoosers. Below is the code that is working:
         <mx:VBox>
                  <mx:Label text="Simple DateChooser control."/>
                  <mx:DateChooser id="dateChooser1" doubleClickEnabled="true"
                      doubleClick="displayDate2()"
                      change="displayDate(DateChooser(event.target).selectedDate)"/>
                  <mx:Label id="selection"  color="blue" text="Date selected:"/>
              </mx:VBox>
      I tried putting in doubleClickEnabled as true in Actionscript, and then call the event, and this is the syntax I used:
         //enable the double Click Enabled Property
                        dch.setPropertyIsEnumerable("doubleClickEnabled",true);
                       dch.addEventListener("doubleClick", useDate2);
      This did not work, and I got this error instead: 1061: Call to a possibly undefined method setPropertyIsEnumerable through a reference with static type mx.controls:DateChooser.   
      I tried to find a suitable import statement to insert in my code, but I am not sure what to put there. Could anyone please give me a hint what to do here to get my code to accept the method?
    Thanks in advance.
    Alice

    Hi, Ryan:
      Thanks, I got that to work, but it seems like the doubleClick does not allow me to use it on the dateChooser. Here is the code:
        The MXML:
               <mx:VBox id="box2">
                <mx:DateChooser id="dch" doubleClickEnabled="true"
                      doubleClick="displayDate2()"
                      change="displayDate(DateChooser(event.target).selectedDate)"/>
             </mx:VBox>
        The same thing in Actionscript, but not working:
         dch = new DateChooser();
         dch.addEventListener("change", displayDate);
         dch.doubleClickEnabled = true;
        dch.addEventListener("doubleClick",displayDate2);
      //Got an error saying TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::MouseEvent@20112769 to     
      //mx.events.CalendarLayoutChangeEvent.
         box2.addChild(dch);
       Could you give me some pointers on what I have wrong here?
    Thanks for your help.
    Alice

  • Call to a possibly undefined method getClipboardContents through a reference with static type flashx.textLayout.edit:ISelectionManager.

    Hi Guys,
    As i am using the nigtly build of TLF 4.0.0.11073.
    I want to copy some text from the TLF, by copy operation. I am getting this type of Error.
    - Call to a possibly undefined method getClipboardContents through a reference with static type flashx.textLayout.edit:ISelectionManager.
    In the previous build, i dont use to get this type of error, but in this nightly builds i am getting this type of error.
    Can anyone help me to fix the same or any workaound.
    Thanks in advance.
    Krishna

    This functionality is still available, but it has moved. It's now in a TextClipboard class, in the same flashx.textLayout.edit package. So you should replace calls to getClipboardFormat() with TextClipboard.getContents().
    Hope this helps,
    - robin

  • Call to a possibly undefined method displays when using static function in Unit Test

    Hello!
    This has been driving me nuts. I am setting up unit tests for a static class which manages a collection of songs. This is how my unit test class looks:
    //START CODE
    package flexUnitTests {
              import com.myapp.managers.MusicManager;
              import flash.utils.Dictionary;
              import flexunit.framework.Assert;
              public class MyAppManagerTest {
                        [Before]
                        public function setUp():void {
                                  var songData:Dictionary = new Dictionary();
                                  songData["mn0012345"] = new Dictionary();
                                  songData["mn0012345"]["title"] = "All the Pretty Little Horses";
                                  songData["mn0012345"]["description"] = "by: American Traditional | Voice, Piano | 3 pages";
                                  MusicManager.setSongData(songData);
                        [Test]
                        public function test_getAuthorsBySKU():void {
                                  var expected:String = "American Traditional";
                                  var given:String = MusicManager.getAuthorsBySKU("mn0012345");
                                  Assert.assertEquals(expected, given);
    //END OF CODE
    You will notice two calls in red above. When I leave them in the code I see a variety of errors which look like this:
    "Call to a possibly undefined method '' through a reference with a static type com.myapp..."
    And
    "Access of possible undefined property '' through a reference with static type com.myapp..."
    Then, when I comment out the two lines in red above, these errors go away. Flash Builder seems really flakey to me. Often I notice that the error list varies, how can it just no longer be an error? Where did this new access error come from, in a no related part of the code, by adding or removing a function call to a static class which remains in the import statement.
    Note that the MusicManager contains no references to any of the UI mxml that is throwing these errors. It just simply loads data into a few globals and allows you to grab info.
    How is my usage of this function making foreign objects inaccessible?
    Please help!!! I am really hoping there is an answer but I have a bad feeling the answer is just that Flash Builder is flakey.

    I did some more work on the issue above. There are functions with in the MusicManager that call the UserManager to get a user's ID. When I comment out these calls then the access errors go away. Well the user manager has some calls back to mxml that tell the class that changes where made. My best guess is this is where it stems into the code that is randomly throwing errors. But, it compiles fine and runs fine on a device. Is there something with test cases which doesn't invoke the UI?

  • 1180: Call to a possibly undefined method getDefinitionByName

    1180: Call to a possibly undefined method getDefinitionByName.   << i have this error
    i want to draw coins.
    so in library i have playerCoins100 and playerCoins200 movie clips with classes like name and base class: flash.display.MovieClip
    separated code:
    //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                   //show points in user bag
                   var classNames:Array = ["playerCoins100", "playerCoins200"];
                   var boxesList:Array = [];
                   var ClassRef:Class;
                   for (var i:int = 0; i < classNames.length ; i++)
                        ClassRef = Class(getDefinitionByName(classNames[i]));
                        boxesList[i] = new ClassRef();
                        addChild(boxesList[i]);
                   var currentBox:MovieClip;
                   var numCol:int = 3;
                   for (var columnIterator:int = 0; columnIterator < boxesList.length; columnIterator++)
                        var column:int = columnIterator % numCol;
                        var row:int = int(columnIterator / numCol);
                        currentBox = boxesList[columnIterator];
                        currentBox.x = currentBox.width * column;
                        currentBox.y = currentBox.height * row;
                   //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    any ideas?

    how i can put this array to point with coordinate x=200 and y=300 ?
    need create mc and put elements to this mc? or how?

  • Call to a possibly undefined method asyncResponder

    Hi, why would I be getting this error for this code
                token.addResponder(Async.asyncResponder(this, new AsyncResponder(onResult, faultHandler), 600));
    1061: Call to a possibly undefined method asyncResponder through a reference with static type Class. 
    my imports look fine
    import flexunit.framework.Assert;
        import org.flexunit.async.Async;

    that method is only available in the flex version of flexunit. since it depends of an flex library class, it is not included in the actionscriptonly build

  • Symbol 'LoseMessage', Layer 'Reset_btn', Frame 1, Line 15     1061: Call to a possibly undefined method

    Hi I have a game set up, when you deplete your lives it takes you to a lose screen (Symbol), on that screen I have a button called Reset Game.
    The button name is "Reset_btn"
    The button instance is "resetbtn"
    I have the code in the symbol and I am getting this error:
    Symbol 'LoseMessage', Layer 'Reset_btn', Frame 1, Line 15    1061: Call to a possibly undefined method addEventListener through a reference with static type Class.
    Here is my code:
    //Reset Button Code
    resetbtn.addEventListener(MouseEvent.CLICK, Reset_btn);
    function Reset_btn(event:Event):void
            gotoAndStop(1);
    I have given my button and instance name and a name for the button, why am i still getting this error, can anyone help?
    Casey

    Ok.. so
    This is on a separate timeline, its a movieclip which has a timeline inside it.
    on frame 1 of that timeline inside the movieclip I have my button inside the movieclip.
    The movieclip is activated when it meets a certain condition.
    In this case when lives have been depleted to 0 from 3 a gameover screen appears.
    A button is on that gameover screen which should take me back to the main menu or Frame 1 of the actual game in this case.
    Here is the code for the condition for when game over screen appears:
    if(cursor.hitTestObject(enemyAppear2))
                            enemyAppear2.parent.removeChild(enemyAppear2);
                            stage.removeEventListener(MouseEvent.CLICK, clickEnemy2);
                            life--
                            messageDisplay2.text = String(life);
                            if(life == 0)
                                enemyTimer2.stop();
                                var loseText:LoseMessage = new LoseMessage();
                                loseText.x = 0;
                                loseText.y = 0;
                                parent.addChild(loseText);
                                Mouse.show();
    This code is in my main gaming code timeline.
    The code im trying to show is inside the movieclip which i have set up.
    Is this a clear enough explanation?

  • Error 1180: Call to a possibly undefined method class_name

    hi,
    i am new AS 3.0. When i try to compile my file it show the following error.
    1180: Call to a possibly undefined method ClassA.                                 var obj =new ClassA(10,10);
    My class file contains...
    class ClassA {
        public var Avg:Number = 0;
        public function ClassA(a, b) {
            Addit(a,b);
        public function Addit(aval:Number, bval:Number):Number {
            Avg = aval+bval;
            trace("Average - "+Avg);
            return Avg;
    i have called in flash file....
    import ClassA;
    var obj =new ClassA(10,10);
    Any help Pls....
    Ayathas

    i have modified my AS file as
    package TestPackage{
        import flash.display.Sprite;
    public class ClassA extends Sprite {
        public var Avg:Number = 0;
        public function ClassA(a, b) {
            Addit(a,b);
        public function Addit(aval:Number, bval:Number):Number {
            Avg = aval+bval;
            trace("Average - "+Avg);
            return Avg;
    i have included the document path in the properties panel as, TestPackage.ClassA
    now it show's following error message....
    ArgumentError: Error #1063: Argument count mismatch on AS::ClassA$iinit(). Expected 2, got 0.
    When i modifiy ClassA construnctor as follows, it works fine.
      public function ClassA() {
            var a = 10;
            var b = 10;
            Addit(a,b);
    how can i get input values from the user..........
    Thanks in Advance,
    Ayathas
    Message was edited by: ayathas

  • 1180: Call to a possibly undefined method... Possibly?

    I have buttons, that when clicked will create an instance in one of 3 movie clips within a movie clip.
    For instance, this works just fine:
    b_IF_4G5_TOP.addEventListener(MouseEvent.CLICK, b_IF_4G5_TOP_add);
    function b_IF_4G5_TOP_add(event:MouseEvent):void
    var b:MovieClip = new IF_4G5_TOP();
    b.name = "IF_4G5_TOP";
    layout.substrate.addChild(b);
    but this does not:
    p_conn_h.addEventListener(MouseEvent.CLICK, p_conn_h_add);
    function p_conn_h_add(event:MouseEvent):void
    var b:MovieClip = new PC_H(); <- This line produces this error: 1180: Call to a possibly undefined method PC_H.
    b.name = "p_conn";
    layout.connectors.addChild(b);
    Which is odd, because as you can see in the first example, I have not "defined" var b:MovieClip = new IF_4G5_TOP();
    Both objects exist in the library, are movie clips, both targets and objects are accuratley named and exist.
    Am I missing something obvious? Thanks in advance for your help.

    Thanks for the suggestions, guys.
    I did try renaming the movieclips, no success.
    The movieclips that work fine, like IF_4G5_TOP have no as linkage or anything. The code simply places a copy of the movieclip from the library onto the stage within its target movieclip.
    I even tried to change their target to the same target as the ones that work:
    layout.connectors.addChild(b);
    to
    layout.substrate.addChild(b);
    But no go...
    Why do you suppose an identical function would work in one case, but throw errors in another? It's seemingly irrational inconsistencies like this that are so frustrating about actionscript.
    Any ideas? Thanks again.

  • 1180: Call to a possibly undefined method error for DEFINED method

    Hi,
    I have Document Class  main.Core  that in package main
    In the first frame of the .fla I have:
    stop();
    startGame();
    public function startGame():void {
           world = new World();
            world.startWorld();
    World is class in package world.
    I use import world.World;
    When I am tryng to export I get the error:
    1180: Call to a possibly undefined method startWorld.
    Can someone tell me why?
    Thanks.

    what's the following show:
    package world {
    import flash.display.MovieClip;
         public class World extends MovieClip {
              public function World():void {
    trace(this);         
              public function startWorld():void {
                   trace("b");

  • ActionScript 3 Noob Help - 1180: Call to a possibly undefined method addChild.

    Hey everyone, i'm in the process of learning ActionScript 3. I'm woking on my first OOP game with a class other than the document class.
    Right now, my game has a preloader library symbol called PreLoader and one called MainMenu (they have been exported for actionscript). All other objects are subobjects of these Movie Clips. My code si split into three actionscript files called Main.as (the document class. I had planned this to load and unload the preloader, mainmenu, and game itself) MainMenu.as (meant to controll the main menu's buttons and listeners) and PreLoader.as (which has the pre-Loader code in it.) I was having a lot of trouble with unloading the main menu and preloader after I was finished with them, so I let the document class handle them, which led to a series of errors as follows:
    C:\Users\...\hamletgame\Main.as, Line 19    1120: Access of undefined property mainMenu.
    C:\Users\...\hamletgame\Main.as, Line 20    1180: Call to a possibly undefined method addChild.
    C:\Users\...\hamletgame\Main.as, Line 20    1120: Access of undefined property mainMenu.
    C:\Users\...\hamletgame\Main.as, Line 21    1180: Call to a possibly undefined method removeChild.
    C:\Users\...\hamletgame\Main.as, Line 21    1120: Access of undefined property preLoader.
    C:\Users\...\hamletgame\Main.as, Line 25    1180: Call to a possibly undefined method removeChild.
    C:\Users\...\hamletgame\Main.as, Line 25    1120: Access of undefined property mainMenu.
    Thank you all very much in advance. I'm sure its something simple i've missed. My code is posted below.
    Main.as
    package
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.events.MouseEvent;
        public class Main extends MovieClip
            var preLoader:PreLoader;
            var mainMenu:MainMenu;
            public function Main()
                preLoader = new PreLoader;
                addChild(preLoader);
            static public function loadMainMenu():void
                mainMenu = new MainMenu();
                addChild(mainMenu);
                removeChild(preLoader);
            static public function loadGame():void
                removeChild(mainMenu);
    PreLoader.as
    package
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.events.MouseEvent;
        public class PreLoader extends MovieClip
            //Declare Variables Here
            //Constructor Function
            public function PreLoader()
                gotoAndStop(1);
                addEventListener(Event.ENTER_FRAME, loading);
            //Functions
            private function loading (event:Event):void
                var total:Number = stage.loaderInfo.bytesTotal;
                var loaded:Number = stage.loaderInfo.bytesLoaded;
                loadingBar.scaleX = loaded/total;
                if(loaded==total)
                    gotoAndStop(2);
                    removeEventListener(Event.ENTER_FRAME, loading);
                    playButton.addEventListener(MouseEvent.CLICK, startMovie)
            private function startMovie (event:MouseEvent):void
                removeEventListener(MouseEvent.CLICK, startMovie);
                Main.loadMainMenu();
    MainMenu.as
    package
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.events.MouseEvent;
        public class MainMenu extends MovieClip
            //Constructor Function
            public function MainMenu()
                addEventListener(Event.ENTER_FRAME, onFrameEnter);
            //Other Functions
            private function onFrameEnter(event:Event):void
                if(currentFrame==30)
                    stop();
                    playGameButton.addEventListener(MouseEvent.CLICK, onPlayGameButtonClick);
                    instructionsButton.addEventListener(MouseEvent.CLICK, onInstructionsButtonClick);
                    creditsButton.addEventListener(MouseEvent.CLICK, onCreditsButtonClick);
                    removeEventListener(Event.ENTER_FRAME, onFrameEnter);
                else
                    removeEventListener(Event.ENTER_FRAME, onFrameEnter);
            private function onPlayGameButtonClick(event:MouseEvent):void
                playGameButton.removeEventListener(MouseEvent.CLICK, onPlayGameButtonClick);
                instructionsButton.removeEventListener(MouseEvent.CLICK, onInstructionsButtonClick);
                creditsButton.removeEventListener(MouseEvent.CLICK, onCreditsButtonClick);
                Main.loadGame();
            private function onInstructionsButtonClick(event:MouseEvent):void
                playGameButton.removeEventListener(MouseEvent.CLICK, onPlayGameButtonClick);
                instructionsButton.removeEventListener(MouseEvent.CLICK, onInstructionsButtonClick);
                creditsButton.removeEventListener(MouseEvent.CLICK, onCreditsButtonClick);
            private function onCreditsButtonClick(event:MouseEvent):void
                playGameButton.removeEventListener(MouseEvent.CLICK, onPlayGameButtonClick);
                instructionsButton.removeEventListener(MouseEvent.CLICK, onInstructionsButtonClick);
                creditsButton.removeEventListener(MouseEvent.CLICK, onCreditsButtonClick);

    I'm not sure why I'm not able to use all 3 of your classes as intended.  I read that you cannot access the Document Class from other classes directly.  So This is what I have:
    Main.as
    package
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.events.MouseEvent;
        public class Main extends MovieClip
            var preLoader:PreLoader;
            var mainMenu:MainMenu;
            public function Main()
                preLoader = new PreLoader;
                addChild(preLoader);
                                  trace("Main");
            public function loadGame():void
                                  trace("loadGame start");
                //removeChild(mainMenu);
                                  trace("loadGame finish");
    MainMenu.as
    package
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.events.MouseEvent;
        public class MainMenu extends MovieClip
            //Constructor Function
                        var playGameButton:PlayGameButton;
                        var instructionsButton:InstructionsButton;
                        var creditsButton:CreditsButton;
                        var main:Main;
                        var mainMenu:MainMenu;
                        var preLoader:PreLoader;
                        var container1_mc:MovieClip;
            public function MainMenu()
                                  trace("MainMenu");
    PreLoader.as  (this is where the heart of your app is)
    package
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.events.MouseEvent;
              import flash.display.Loader;
              import flash.display.LoaderInfo;
        public class PreLoader extends MovieClip
            //Declare Variables Here
                        var playGameButton:PlayGameButton;
                        var instructionsButton:InstructionsButton;
                        var creditsButton:CreditsButton;
            var main:Main;
                        var mainMenu:MainMenu;
                        var preLoader:PreLoader;
                        var loadingBar:LoadingBar;
                        var playsButton;
                        var container_mc:MovieClip;
            //Constructor Function
            public function PreLoader()
                gotoAndStop(1);
                addEventListener(Event.ENTER_FRAME, loading);
            //Functions
            public function loading (event:Event):void
                var total:Number = stage.loaderInfo.bytesTotal;
                var loaded:Number = stage.loaderInfo.bytesLoaded;
                                  loadingBar=new LoadingBar();
                                  addChild(loadingBar);
                                  loadingBar.x=50;
                                  loadingBar.y=50;
                                  var playsButton=new PlaysButton();
                loadingBar.scaleX = loaded/total;
                if(loaded==total)
                                            removeChild(loadingBar);
                                            //stop();
                                            trace("loaded equals total");
                    gotoAndStop(2);
                    removeEventListener(Event.ENTER_FRAME, loading);
                                            addChild(playsButton);
                                            playsButton.x=50;
                                            playsButton.y=250;
                    playsButton.addEventListener(MouseEvent.CLICK, startMovie);
            public function startMovie(event:MouseEvent):void
                //removeEventListener(MouseEvent.CLICK, startMovie);
                                  trace("startMovie");
                                  loadMainMenu();
                         public function loadMainMenu():void
                        var main:Main;
                        var mainMenu:MainMenu;
                        var preLoader:PreLoader;
                        var container1_mc:MovieClip;
                                  trace(currentFrame+"cf");
                                  trace("loadMainMenu start");
                                  container1_mc= new MovieClip();
                                  addChild(container1_mc);
                                  playGameButton=new PlayGameButton();
                                  trace("1");
                                  instructionsButton= new InstructionsButton();
                                  creditsButton = new CreditsButton();
                                  playGameButton.x=100;
                                            playGameButton.y=100;
                                            instructionsButton.x=200;
                                            instructionsButton.y=100;
                                            creditsButton.x=300;
                                            creditsButton.y=100;
                                            trace(creditsButton.name);
                                            trace(creditsButton.x);
                                            trace(creditsButton.y);
                                            trace(container1_mc.x);
                                            trace(container1_mc.y);
                                  addChild(playGameButton);
                                  playGameButton.name="playGameButton";
                                  instructionsButton.name="instructionsButton";
                                  creditsButton.name="creditsButton";
                                  trace(creditsButton.name);
                                  trace("2");
                                            addChild(instructionsButton);
                                            addChild(creditsButton);
                                  trace("loadMainMenu finish");
                                  MainMenus();
                        public function MainMenus():void
                addEventListener(Event.ENTER_FRAME, onFrameEnter);
                                  trace("MainMenus");
                                  //loadMainMenu();
            public function onFrameEnter(event:Event):void
                                  trace("AA");
                if(currentFrame==0)
                                            if(creditsButton.name=="creditsButton"){
                    stop();
                                            trace("frame 30");
                                            trace(currentFrame);
                                            trace(creditsButton.name);
                    playGameButton.addEventListener(MouseEvent.CLICK, onPlayGameButtonClick);
                    instructionsButton.addEventListener(MouseEvent.CLICK, onInstructionsButtonClick);
                    creditsButton.addEventListener(MouseEvent.CLICK, onCreditsButtonClick);
                    removeEventListener(Event.ENTER_FRAME, onFrameEnter);
                else
                    removeEventListener(Event.ENTER_FRAME, onFrameEnter);
            public function onPlayGameButtonClick(event:MouseEvent):void
                                  trace("A");
                playGameButton.removeEventListener(MouseEvent.CLICK, onPlayGameButtonClick);
                instructionsButton.removeEventListener(MouseEvent.CLICK, onInstructionsButtonClick);
                creditsButton.removeEventListener(MouseEvent.CLICK, onCreditsButtonClick);
                //main.loadGame();
            public function onInstructionsButtonClick(event:MouseEvent):void
                                  trace("B");
                playGameButton.removeEventListener(MouseEvent.CLICK, onPlayGameButtonClick);
                instructionsButton.removeEventListener(MouseEvent.CLICK, onInstructionsButtonClick);
                creditsButton.removeEventListener(MouseEvent.CLICK, onCreditsButtonClick);
            public function onCreditsButtonClick(event:MouseEvent):void
                                  trace("C");
                playGameButton.removeEventListener(MouseEvent.CLICK, onPlayGameButtonClick);
                instructionsButton.removeEventListener(MouseEvent.CLICK, onInstructionsButtonClick);
                creditsButton.removeEventListener(MouseEvent.CLICK, onCreditsButtonClick);
    I've exported each button and movie clip which resides on the stage in the Library.  I've removed them from the stage/Timeline and just have the Exports in ActionScript on Frame 1.  I also noticed I couldn't access frame 30 and had to change the code to "if(currentFrame==0)....."
    I hope this gets you started in the right direction though I'm not sure what I've done is what you're looking for.

  • 1180: Call to a possibly undefined method BlueSquare.

    I keep get error mesage of what say 1180: call to possibly undefined method bluesquare what my object in the library
    some one please help.
    Here the tutorial i'm try do to learrn flash.
    here action script 3.0 code
    var myBlueSquare = new BlueSquare();
    trace(myBlueSquae);

    my class is this bluesquare in lower case letter no upper.

  • 1180: Call to a possibly undefined method produce.

    package{
        import flash.display.MovieClip
        import flash.display.MovieClip
        import flash.events.Event
        import flash.events.MouseEvent
        import flash.events.KeyboardEvent
        import flash.ui.Keyboard
        public class arrayagain extends MovieClip{
            var arrObj:Array = new Array( "mcDog", "mcElephant", "mcDog", "mcCat", "mcHippo", "mcLion" );
            var enemy:Array = new Array();
            var mc:MovieClip;
        produce(5);
        function produce(num:Number):void {
            for( var i:Number = 0; i < num; i++ ) {
                var ran:int = Math.random() * arrObj.length;
                mc = new (getDefinitionByName( arrObj[ran] ) as Class)();
                mc.x = 100 + (mc.width * i) + 50;
                mc.y += 9;
                enemy.push( mc );
                addChild( enemy[i] );
    What is the problem can somebody help me plss....

    You have the call to produce outside of any method... you can't do that in classes.
    Use:
    package{
        import flash.display.MovieClip
        import flash.display.MovieClip
        import flash.events.Event
        import flash.events.MouseEvent
        import flash.events.KeyboardEvent
        import flash.ui.Keyboard
        public class arrayagain extends MovieClip{
            var arrObj:Array = new Array( "mcDog", "mcElephant", "mcDog", "mcCat", "mcHippo", "mcLion" );
            var enemy:Array = new Array();
            var mc:MovieClip;
        public function arrayagain(){
             produce(5);
        function produce(num:Number):void {
            for( var i:Number = 0; i < num; i++ ) {
                var ran:int = Math.random() * arrObj.length;
                mc = new (getDefinitionByName( arrObj[ran] ) as Class)();
                mc.x = 100 + (mc.width * i) + 50;
                mc.y += 9;
                enemy.push( mc );
                addChild( enemy[i] );

  • "call to a possibly undefined method" error.

    I've been working my way through the tutorials in Gary Rosenzweig's "Flash Game University" book. Working on the "paddle ball" game tutorial, I changed the name of the file from "PaddleBall.fla" to "MyPaddleBall.fla", and changed the name of the .as file and the class definition accordingly. After I do this, I get the above error when calling the initialization function ("startPaddleBall()") The target for the .as file is set correctly. I tried using the original file to test it; it compiles fine as long as it's called "PaddleBall", but as soon as I change the name to "MyPaddleBall" (or anything else), it breaks. I commented out all the other code and replaced it with a trace statement inside the startPaddleBall() function to see if there was something else causing the problem, but I got the same result. When all the other functionality is stripped out, the file still works, but only when called "PaddleBall".
    Any help would be appreciated, thanks.
    -- Mark

    Thanks, in fact I did that. It's also one reason why I commented / stripped out all the other code.
    Here is the code in the .as file as it stands right now in its entirety:
    package {
    import flash.display.*;
    import flash.events.*;
    public class PaddleBall extends MovieClip {
    public function startMyPaddleBall() {
    trace("Started");
    This code, combined with the file PaddleBall.fla (containing the function call "startMyPaddleBall()") works. When I change it to "public class MyPaddleBall" and also change the names of the .fla and .as files to MyPaddleBall, it breaks.

  • 1180: Call to a possibly undefined method box.

    So I have my class being called on the main timeline
    var test:box = new CustomBoxThing();
    //or
    var test:MovieClip = new CustomBoxThing();
    //then
    test.name = "someName1";
    addChild(test);
    And its not working so well for me, I keep getting error
    1180. I know I'm missing something basic, your help is much
    appreciated :)

    I do - both - although I thought flash would create the class
    for me on the fly anyway?
    The validator in the linkage says I see it. When I look up
    the error online, I find it says the error is thrown only in strict
    mode.
    import flash.display.*;
    import flash.text.*;
    import flash.events.*;
    var test:CustomBoxThing = new CustomBoxThing();
    addChild(test);

Maybe you are looking for

  • Error while running Java Application as NT Service using INSTSRV

    Hi, I am trying to run Java Application as an NT Service using Instsrv.But when i start the service It works fine.when i stop the service it does not stop and it continues to run the application.When i uninstall the service It still executes.When i r

  • Problem with RANSAC

    I wrote this code to implement RANSAC (trying to find straight lines), but it seams that I have a problem with marking the line that I first found in order to exclude it and let the RANSAC to find the rest lines. Here is the code: public class RANSAC

  • HT204291 Apple TV sound problems

    I have a macbook pro and an apple tv. when I try to show a movie with my dvd player, i get a gray screen. the only way i can show a movie is if i hook my computer directly to the projector also, i tried renting a movie from itunes and an image showed

  • Can you open a Imac G5 w/ Isight???

    I have 2 iMacs: one is a 20inch without isight, and one is a 17in w/ isight I can open the older one easly (just 3 screws on the bottom). But can I open the newer iMac (The on with iSight)? Thanks in advance -Ron Sper

  • SCCM 2012: Reinstall remote distribution point?

    Hi, We have a remote distribution point to which we can't deploy packages anymore. Several attempts to repair it failed. I'd like to remove the distribution point and reinstall it via SCCM 2012 console. However, I'd like to know the impact since it c