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?

Similar Messages

  • 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] );

  • 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);

  • MouseEventExample.as, Line 1     1180: Call to a possibly undefined method addFrameScript

    Hi. I have a question about a Flash Help example which outputs an error, here - http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/MouseEvent .html?filter_flash=cs5.5&filter_flashplayer=10.3&filter_air=2.6#MOUSE_DOWN
    and the code is at the bottom of the page, in the Examples section, the MouseEventExample class.
    I have created an AS doc named MouseEventExample.as, put in a folder, the same as the one with the Flash pro file, have given the Flash pro file a document class name of MouseEventExample, but when i test movie, i get this error - 1180 addFrameScript, presumably on line 1 of the AS file, but there's no addFrameScript there at all.
    thanks for any help:)

    I just saw the answer to this - by kglad
    at
    http://forums.adobe.com/message/3085064#3085064
    i had some commented code in the timeline, which was the issue outputting this error.
    if u reply kglad, i can CorrectAnswer u/thanks again.

  • 1180: Call to a possibly undefined method splice.

    Hi i get the above error when I try to use splice on this code:
    public function dispose(object:BlitSprite,i):void {
    _gameModel.screen.removeChild(object);
    splice(_gameModel.bulletModels[i],1);
    _gameModel.bulletModels[i] = null;
    I'm not that great at actionscript, do I have to import something for it to work? If anyone knows the solution please let me know, thanks

    splice is a method of the Array class, which you use in the following manner...
    someArray.splice(startIndex, deleteCount);
    I think what you are trying to do would be along the lines of...
    public function dispose(object:BlitSprite,i):void {
        _gameModel.screen.removeChild(object); 
        _gameModel.bulletModels.splice(i,1);

  • 1180: Call to a possibly undefined method Con2

    import com.greensock.*;
    import com.greensock.easing.*;
    Multitouch.inputMode = MultitouchInputMode.GESTURE;
    var bigCon2:Sprite = new Sprite();
    stage.addChild(bigCon2);
    var ccon2:MovieClip = new Con2();
    bigCon2.addChild(ccon2)
    bigCon2.x=0
    bigCon2.y=0
    stage.addEventListener(TransformGestureEvent.GESTURE_SWIPE , onSwipe2);
    function onSwipe2 (e:TransformGestureEvent):void{
    if (e.offsetY == 1) {
    //User swiped towards bottom
              TweenMax.to(bigCon2, 1, { y:bigCon2.y+500, ease:Sine.easeOut});
    if (e.offsetY == -1) {
    //User swiped towards top
              TweenMax.to(bigCon2, 1, { y:bigCon2.y-500, ease:Sine.easeOut});
    im not sure why im getting this error.. it worked well for my other script though..

    So i should put 'Con2' as the AS linkage in the library right?
    but there is another error now..
    1046: Type was not found or was not a compile-time constant: Con2
    what does that mean?
    p.s sorry, im a noob at AS3

  • 1180: Call to a possibly undefined method addChild.

    Hi - I get the folowing error in one of my classes and not too sure why? Would appreciate some enlightenment
    package  {
        import flash.display.Loader;
        import flash.net.URLRequest;
        import flash.events.*;
        import flash.display.*;
        //import flash.display.MovieClip;
        //public class LoadActivities extends MovieClip {
            public class LoadActivities  {
            //public var isACoin:Boolean;
            public function LoadActivities(game):void
                var loader:Loader = new Loader;
                loader.contentLoaderInfo.addEventListener(Event.COMPLETE, handler);
                loader.load(new URLRequest(game));
            public function handler(e:Event):void
                var mc:MovieClip = MovieClip(e.target.loader);
                addChild(mc);

    TypeError: Error #1034: Error de conversión forzada: no se puede convertir "game.swf" en LoadActivities.
    Thanks for your answer re: extends MovieClip that worked but now I get the following error.
    I have a main fla and its document class.
    The part of the code in document class that causes the problem:
    MAIN DOCUMENT CLASS
    private function processCollisions():void
                if (thePlayer.hitTestPoint(q.x, q.y))
                    this.removeEventListener(Event.ENTER_FRAME,mainGameLoop);
                   LoadActivities("game.swf");
                    return;
    This is a platform game. When the player hit tests q (which is my quiz) I want to stop the main loop of the platform (container) game and import a quiz.swf.
    I use a dedicated class LoadActivities to do this
    LoadActivities
    package  {
        import flash.display.Loader;
        import flash.net.URLRequest;
        import flash.events.*;
        import flash.display.*;
            public class LoadActivities extends MovieClip {
            public function LoadActivities(game):void
                var loader:Loader = new Loader;
                loader.contentLoaderInfo.addEventListener(Event.COMPLETE, handler);
                loader.load(new URLRequest(game));
            public function handler(e:Event):void
                var mc:MovieClip = MovieClip(e.target.loader);
                addChild(mc);

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

    Hi,
    I'm trying to make a menu button that when the mouse hovers over it, the rest of the menu is displayed. I wanted to do this by simply controlling the Movie Clip's timeline (menu_mc). I have a stop(); action at the start of the Movie Clip. But alas, once again AS3 is telling me I've done something wrong, this is the code I'm using...
    menu_mc.menu_btn.addEventListener(MouseEvent.MOUSE_OVER, menuUp);
    function menuUp(e:MouseEvent):void {
    menu_mc(root).gotoAndPlay(2);
    I'm a very slow beginner. So I apologise if this is a ridiculously simple problem.

    try:
    menu_mc.menu_btn.addEventListener(MouseEvent.MOUSE_OVER, menuUp);
    function menuUp(e:MouseEvent):void {
    menu_mc.gotoAndPlay(2);

  • 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.

  • 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

Maybe you are looking for

  • New MacBook Air: Safari can't open the page because the server where this page is located isn't responding

    Hi there, I purchased a new MacBook Air on Sunday and am using OS X Yosemite 10.10. Unfortunately since then I am having problems with connectivity with certain websites.  It is not just a problem with my MacBook Air, because I also have a MacBook an

  • How do I create my own eBook?

    I have many documents from school that I'd like to scan, convert to PDFs and then compile together into one PDF file. The problem is that whenever I scan a document, I can't compress it down enough without sacrificing quality, so I can't have a small

  • Simple dynamic text line break question

    I have a simple file that loads text dynamically inside a symbol.. How do I put line breaks in? My code is below. If I leave the text as is it skips a line inbetween. (actionscript in flash file) loadVariables("pacific.txt", "_root.pacific"); txt fil

  • Null pointer when trying to initialise speech recognition

    Hi all, I am attempting to utilise the JSAPI for a project for display at my Uni that utilises freeTTS and also some Java speech recognition. Through the tutorials online (such as the Hello World) I have built my speech recognizer but as I try to all

  • Why no mpeg 2 option?

    We installed to FC studio 5, I am a high shool teacher, and once the install was complete there is no option for me to export mpeg 2 from FCP? Any ideas why that would happen? And, how would I get the mpeg 2 option into the QT Export menu? Thanks Kyl