ArgumentError: Error #1063:Help

I am trying to use the onMouseWheel method
First I wanted to check if my event listener and event handler work
stage.addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheel);
private function onMouseWheel():void {
trace ("onMouseWheel()  method");
I am getting this error when I try it
ArgumentError: Error #1063: Argument count mismatch on onMouseWheel(). Expected 0, got 1.
Please help

You ALWAYS have to pass event into event handler:
private function onMouseWheel(e:MouseEvent):void

Similar Messages

  • ArgumentError: Error #1063: Argument count mismatch on portfolio_fla::MainTimeline/loadFightBite().

    Hi
    I'm trying to load a swf onto my stage and I'm having some problems with the event handler. I'm getting an error: when I comment out the event handler, it returns no errors, I've tried the function both with and without void, but it doesn't fix the error. I know this should be an easy fix, but it's got me stumped. Can anybody help? Thanks guys.
    ArgumentError: Error #1063: Argument count mismatch on portfolio_fla::MainTimeline/loadFightBite(). Expected 0, got 1.
    var fightBite_mc:MovieClip;
    var swfLoader:Loader = new Loader ();
    var swfRequest:URLRequest;
    fightBite_but.addEventListener (MouseEvent.CLICK, loadFightBite);
    function loadFightBite():void {
         this.addChild(swfLoader);
         swfLoader.load(new URLRequest("ftb_preloader.swf"));
         swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
    function swfLoaded(loadEvent:Event){
         swfLoader.x = stage.stageHeight /2;
         swfLoader.y = stage.stageWidth /2;
         swfLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, swfLoaded);
         fightBite_mc=swfLoader.content as MovieClip;

    use:
    var fightBite_mc:MovieClip;
    var swfLoader:Loader = new Loader ();
    var swfRequest:URLRequest;
    fightBite_but.addEventListener (MouseEvent.CLICK, loadFightBite);
    function loadFightBite(e:MouseEvent):void {
         this.addChild(swfLoader);
         swfLoader.load(new URLRequest("ftb_preloader.swf"));
         swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
    function swfLoaded(loadEvent:Event:Event){
         swfLoader.x = stage.stageHeight /2;
         swfLoader.y = stage.stageWidth /2;
         swfLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, swfLoaded);
         fightBite_mc=swfLoader.content as MovieClip;

  • About ArgumentError: Error #1063: Argument count mismatch

    Hi
    i am newbie to Flex Environment .
    This is my first post in Flex , so please excuse if my question is a dumb one .
    I am trying to dynamically create a Button and add EventListener to it .
    public function handleClick(event:MouseEvent):void
    var myBtn2:Button = new Button()
    myBtn2.label = "Dynamic";
    myBtn2.addEventListener(MouseEvent.MOUSE_OVER,handleClick1);
    this.addChild(myBtn2);
    public function handleClick1(event:MouseEvent):void
    Alert.show("This is for Dynamic button");                                                                                                             
    I have observered that , if i dont pass event on to the handleClick1() function i am getting ArgumentError: Error #1063: Argument count mismatch and  if i pass , all is working fine .
    Please tell me , why is it mantadatory to pass this ??

    More accurate to say that if you define an event handler in MXML, as in  <mx:Button click="clickFunc()"/> then it is optional to pass an event object with clickFunc(event), and if you do not pass it, your clickFunc() method signature does not need that argument.
    But if you add an event listener with addEventListener, then the listener method signature must always tae the event object as an argument.
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex / AIR Development, Training, and Support Services

  • ArgumentError: Error #1063: Argument count mismatch on Greeter$iinit(). Expected 0, got 1.

    I keep getting this error message after i press run.
    ArgumentError: Error #1063: Argument count mismatch on
    Greeter$iinit(). Expected 0, got 1.
    at PMA$iinit()
    at mx.managers::SystemManager/create()
    at mx.managers::SystemManager/::initializeTopLevelWindow()
    at mx.managers::SystemManager/::frameEndHandler()
    I have tried commenting out each function one by one to
    identify the error, but it persists even after every function has
    been commented out in the Greeter class. Has anyone experience this
    error before?

    Run "Clean" from the Project menu, see if that helps.
    I assume you corrected the argument mismatch issue. Note: 1.5
    allowed argument count mismatches. In 2.0, if you have an optional
    argument, you can specify a default value in the argument
    declaration.
    Tracy

  • Help Error #1063

    I get this error:
    ArgumentError: Error #1063: Argument count mismatch on ShipMc(). Expected 1, got 0.
        at flash.display::Sprite/constructChildren()
        at flash.display::Sprite()
        at flash.display::MovieClip()
        at Main()
    This is the main Class:
    public function Main() {
                ship = new ShipMc(this.stage);//create a new ship
                //in ShipMc we need stage to create the keyObject
                this.addChild(ship);//add ship to stage

    Try tracing this.stage and see what you have for it.  It probably hasn't yet had time to come into existence by the time you are trying to target it.

  • #error 1063

    hi guys
    i have  3 classes in the library (external classes) and 1 document class called Main
    and iam getting these  errors all the time i dont know why
    ArgumentError: Error #1063: Argument count mismatch on tree1/onAdded(). Expected 0, got 1.
        at flash.display::DisplayObjectContainer/addChild()
        at Main()
    ArgumentError: Error #1063: Argument count mismatch on tree1/onAdded(). Expected 0, got 1.
        at flash.display::DisplayObjectContainer/addChild()
        at Main()
    ArgumentError: Error #1063: Argument count mismatch on tree1/onAdded(). Expected 0, got 1.
        at flash.display::DisplayObjectContainer/addChild()
        at Main()
    ArgumentError: Error #1063: Argument count mismatch on tree1/onAdded(). Expected 0, got 1.
        at flash.display::DisplayObjectContainer/addChild()
        at Main()
    ArgumentError: Error #1063: Argument count mismatch on tree1/onAdded(). Expected 0, got 1.
        at flash.display::DisplayObjectContainer/addChild()
        at Main()
    ArgumentError: Error #1063: Argument count mismatch on tree1/onAdded(). Expected 0, got 1.
        at flash.display::DisplayObjectContainer/addChild()
        at Main()
    here are the classes code (the external classes ) in the lib
    MAINMAP1 class
    package
    import flash.system.System;
    import flash.system.fscommand;
        import flash.display.MovieClip;
    import flash.media.Sound;
        import flash.media.SoundChannel;
        import flash.events.KeyboardEvent;
        import flash.ui.Keyboard;
        import flash.events.Event;
        import flash.events.MouseEvent;
        import flash.display.Stage;
    public class MAINMAP1 extends MovieClip {
        var vx:int = 0
        var vy:int = 0
      public function MAINMAP1(){
        addEventListener(Event.ADDED_TO_STAGE, onAdded)
      public function onAdded (event:Event):void  {
    tree1 class
    package{
        import flash.system.System;
    import flash.system.fscommand;
        import flash.display.MovieClip;
    import flash.media.Sound;
        import flash.media.SoundChannel;
        import flash.events.KeyboardEvent;
        import flash.ui.Keyboard;
        import flash.events.Event;
        import flash.events.MouseEvent;
        import flash.display.Stage;
        public class tree1 extends MovieClip{
            public function tree1 (){
                    addEventListener(Event.ADDED_TO_STAGE, onAdded)
                    public function onAdded (){
                                                  addEventListener(Event.ENTER_FRAME, onEnterFrame);
        public function onEnterFrame(event:Event){
    HERO class
    package{
        import flash.system.System;
    import flash.system.fscommand;
        import flash.display.MovieClip;
    import flash.media.Sound;
        import flash.media.SoundChannel;
        import flash.events.KeyboardEvent;
        import flash.ui.Keyboard;
        import flash.events.Event;
        import flash.events.MouseEvent;
        import flash.display.Stage;
        public class HERO extends MovieClip{
        private var vx:int = 0;
            private var vy:int = 0;
            public function HERO (){
                    addEventListener(Event.ADDED_TO_STAGE, onAdded)
                    public function onAdded (event:Event):void  {
          gotoAndStop(3)
              addEventListener(Event.ENTER_FRAME, onEnterFrame);
            stage.addEventListener(KeyboardEvent.KEY_DOWN,onKeyDown);
                stage.addEventListener(KeyboardEvent.KEY_UP,onKeyUp);
        public function onEnterFrame(event:Event){
            x += vx
            y += vy
        public function onKeyDown(event:KeyboardEvent){
            if (event.keyCode == Keyboard.LEFT){
                gotoAndStop(2)
                vx = -5
                    if (event.keyCode == Keyboard.RIGHT){
                        gotoAndStop(1)
                                    vx = 5
            if (event.keyCode == Keyboard.DOWN){
                vy = +5
                gotoAndStop(6)
    if (event.keyCode == Keyboard.UP){
                vy = -5
    public function onKeyUp(event:KeyboardEvent){
                if (event.keyCode == Keyboard.LEFT ||event.keyCode == Keyboard.RIGHT ){
                    vx= 0;
    if (event.keyCode == Keyboard.UP ||event.keyCode == Keyboard.DOWN ){
                    vy= 0;
    THE DOCUMENT CLASS (Main)
    package  {
        import flash.system.System;
    import flash.system.fscommand;
        import flash.display.MovieClip;
    import flash.media.Sound;
        import flash.media.SoundChannel;
        import flash.events.KeyboardEvent;
        import flash.ui.Keyboard;
        import flash.events.Event;
        import flash.events.MouseEvent;
        import flash.display.Stage;
        public class Main extends MovieClip {
            var mainmap1:MAINMAP1 = new MAINMAP1;
            public function Main() {
                addChild(mainmap1);
    done
    the program running but there are errors in the output i couldn.t get it
    help me please
    thank you

    ahh sorry i just did that because i thought this was another forum and  another people ,and i posted alot in action script ,so i thought people will ignore  me
    because am just asking and useless person , but  i was worng
    sorry again

  • VideoDisplay/Slider Error = Error #1063: Argument count mismatch on... Expected 0, got 1

    I'm trying to connect a hslider to a video display. The idea being that as I move the slider the video will update live however when I drag the slider or the playhead updates ie. the video moves forward by a second I get the error in the title of this thread i.e:-
    ArgumentError: Error #1063: Argument count mismatch on components::VideoPopUp/onPlayingVideoUpdate(). Expected 0, got 1
    Here is the code that I use for my HSlider and myVideo Display. Can anyone please help me out as I'm not sure where I'm going wrong here:-
    <mx:Script>
    <![CDATA[
      import mx.events.VideoEvent;
      import mx.events.SliderEvent;
      private function videoDisplaySliderThumbDragHandler(event:SliderEvent):void{   
          videoDisplay.playheadTime = videoDisplaySlider.value;  
      private function videoDisplaySlider_ThumbPress():void{
          videoDisplay.removeEventListener(VideoEvent.PLAYHEAD_UPDATE, onPlayingVideoUpdate);
          videoDisplay.pause();
      private function videoDisplaySlider_ThumbRelease():void{
           videoDisplay.addEventListener(VideoEvent.PLAYHEAD_UPDATE, onPlayingVideoUpdate);
           videoDisplay.playheadTime = videoDisplaySlider.value;
           videoDisplay.play();
      private function videoDisplay_ready():void{
           videoDisplay.addEventListener(VideoEvent.PLAYHEAD_UPDATE, onPlayingVideoUpdate);
           videoDisplay.visible = true;
      private function onPlayingVideoUpdate() :void{
           videoDisplaySlider.value = videoDisplay.playheadTime;
    ]]>
    </mx:Script>
    <mx:HSlider id="videoDisplaySlider" invertThumbDirection="true" allowTrackClick="false" liveDragging="true" thumbDrag="videoDisplaySliderThumbDragHandler(event)" thumbPress="videoDisplaySlider_ThumbPress()" thumbRelease="videoDisplaySlider_ThumbRelease()" minimum="0" maximum="{videoDisplay.totalTime}"/>
    <mx:VideoDisplay id="videoDisplay" ready="videoDisplay_ready()" source="assets/myVideo.mp4" playheadUpdate="onPlayingVideoUpdate()"/>

    Aha I've managed to solve my own problem I missed the event out of the onVideoPlayingUpdate function I've now changed it to:-
    private function onPlayingVideoUpdate(event:VideoEvent) :void{
    and it works now.
    However I now have another problem when I drag the slider's thumb and then release it the video doesn't jump straight to that point as it should and just starts to play really slowly and jumpy.
    Also as I drag the thumb the video isn't changing live.
    To see what I'm trying to achieve go to YouTube and start dragging the thumb on the slider on their videos, you can see the picture updating live but I can't get that to happen in this case.
    Can anybody help me out on getting this to work smoothly?

  • Error #1063: Argument count mismatch on entities::Family(). Expected 2, got 0.

    Hello:
    I'm trying to start a simple remoting app.  I'm getting the folowing error.  My value objects and remoting code are below.  Any help would be appreciated!
    ArgumentError: Error #1063: Argument count mismatch on entities::Family(). Expected 2, got 0.
        at ObjectInput/readObject()
        at mx.messaging.messages::AbstractMessage/readExternal()[C:\autobuild\3.2.0\frameworks\proje cts\rpc\src\mx\messaging\messages\AbstractMessage.as:377]
        at mx.messaging.messages::AsyncMessage/readExternal()[C:\autobuild\3.2.0\frameworks\projects \rpc\src\mx\messaging\messages\AsyncMessage.as:146]
        at mx.messaging.messages::AcknowledgeMessage/readExternal()[C:\autobuild\3.2.0\frameworks\pr ojects\rpc\src\mx\messaging\messages\AcknowledgeMessage.as:77]
    Family class in Flex:
    package entities
        [Bindable]
        [RemoteClass(alias="family.Family")]
        public class Family  {
            public function Family(father:Person, mother:Person) {
                this.father = father;
                this.mother = mother;
            protected var father:Person;
            protected var mother:Person;
            public function getFather():Person {
                return father;
            public function setFather(o:Person):void {
                father = o;
            public function getMother():Person {
                return mother;
            public function setMother(o:Person):void {
                mother = o;
    Family object in Java
    package family;
    public class Family {
        private Person father = null;
        private Person mother = null;
        public Family(Person father, Person mother) {
            this.father = father;
            this.mother = mother;
        public Person getFather() {
            return father;
        public void setFather(Person father) {
            this.father = father;
        public Person getMother() {
            return mother;
        public void setMother(Person mother) {
            this.mother = mother;
    Person class in Flex:
    package entities
        [Bindable]
        [RemoteClass(alias="family.Person")]
        public class Person {
            protected var givenName:String;
            protected var surname:String;
            protected var birthdate:String;
            protected var birthLocation:String;
            protected var deathdate:String;
            protected var deathLocation:String;
            public function getGivenName():String {
                return givenName;
            public function setGivenName(o:String):void {
                givenName = o;
            public function getSurname():String {
                return surname;
            public function setSurname(o:String):void {
                surname = o;
            public function getBirthdate():String {
                return birthdate;
            public function setBirthdate(o:String):void {
                birthdate = o;
            public function getBirthLocation():String {
                return birthLocation;
            public function setBirthLocation(o:String):void {
                birthLocation = o;
            public function getDeathdate():String {
                return deathdate;
            public function setDeathdate(o:String):void {
                deathdate = o;
            public function getDeathLocation():String {
                return deathLocation;
            public function setDeathLocation(o:String):void {
                deathLocation = o;
            public function Person()
    Person class in Java
    package family;
    public class Person {
        private String givenName = null;
        private String surname = null;
        private String birthdate = null;
        private String birthLocation = null;
        private String deathdate = null;
        private String deathLocation = null;
        public String getGivenName() {
            return givenName;
        public void setGivenName(String givenName) {
            this.givenName = givenName;
        public String getSurname() {
            return surname;
        public void setSurname(String surname) {
            this.surname = surname;
        public String getBirthdate() {
            return birthdate;
        public void setBirthdate(String birthdate) {
            this.birthdate = birthdate;
        public String getBirthLocation() {
            return birthLocation;
        public void setBirthLocation(String birthLocation) {
            this.birthLocation = birthLocation;
        public String getDeathdate() {
            return deathdate;
        public void setDeathdate(String deathdate) {
            this.deathdate = deathdate;
        public String getDeathLocation() {
            return deathLocation;
        public void setDeathLocation(String deathLocation) {
            this.deathLocation = deathLocation;
    Remoting code:
        var family:Family;
          getRemoteFamily(function (familyOut:Family) : void {
             family = familyOut;
        public function getRemoteFamily(result:Function, fault:Function=null):void {   
            var token:AsyncToken = ro.getFamily();
            token.addResponder(new AsyncResponder(
                        function (data:Object, token:Object):void {
                            if (!data || !data.result) {
                                throw new Error("RO [getFamily] result object was null, or missing . . .");
                                return;
                            result(data.result as Family);
                        function (info:Object, token:Object):void {
                            if (fault != null) fault(info);   
                        token

    Hi,
    I was facing the same problem, then saw this http://forums.adobe.com/thread/471206. I think that all the value objects must have a constructor with default values. So initially if your constructor on the flex side was say:
    public function Parameter(name:String, value:String){
         this.name=name;
         this.value=value;
    Then change it to :
    public function Parameter(name:String="", value:String=""){
         this.name=name;
         this.value=value;
    I am not claiming this is how it should be done but doing this solved the problem for me.
    Also I think all the variables that u need to send to the server should be public otherwise they are not sent.

  • Need Details of Error #1063

    Hi all,
         This is the piece of code which belongs to my application:
    //global var.s
    var redBoxContainer:Sprite=new Sprite(); //Container for temporary_circle. Leave about red circle now.It is not required now
    ...bla ...bla ...bla
    /* When I click on loaded image, a greencircle(Sprite type) gets displayed.
    * Now, when I click on this displayed greencircle(a Sprite object),
    * a blue circle which is larger in size should get visible at the same pixel-position
    * over this green_circle(hides the green_circle).
    // This is the required code gets executed when I click on green_circle.
    //redBoxContainer.visible=false;
                                  trace("blueCircleContainer.numChildren"+blueCircleContainer.numChildren);
                                  if (blueCircleContainer.numChildren >0) {
              trace("checking blue");
              for (i=0; i<=blueCircleContainer.numChildren; i++) {
                   trace("in for(blue)");
                   //Now, deleting the existing blue-dot/circle properties and making invisible.
                   blueCircleContainer.getChildAt(blueCircleContainer.numChildren-1).visible = false;
                   blueCircleContainer.removeChildAt(blueCircleContainer.numChildren-1);
                                  var inc_circle:Sprite = new Sprite();
                                  inc_circle.graphics.beginFill(0x0000ff);
                                  inc_circle.graphics.drawCircle(temp_x,temp_y,5);
                                  blueCircleContainer.addChild(inc_circle);
                                  addChild(blueCircleContainer);
                                  if (blueCircleContainer.visible==true)
                                        redBoxContainer.visible=false;
                                  trace("blueCircleContainer.numChildrenlast"+blueCircleContainer.numChildren);
                                  blueCircleContainer.addEventListener(MouseEvent.CLICK,onBlueCircleClick);
                                  function onBlueCircleClick(event:MouseEvent):void {
         hidePopup();
         //hideEditPopup();
         trace(temp_x+"::"+temp_y);
         showEditPopup();
         mypopup.visible=false;
         cancelbtn.visible=false;               
         onScrollCancel();
                                  }// end for temporary blue circle                              
    ...bla   ...bla    ...bla
    When I run my flash application, the following error gets displayed in the output-box at runtime:
         ArgumentError: Error #1063: Argument count mismatch on DynaAccess_fla::MainTimeline/onScrollCancel(). Expected 1, got 0.
                   at MethodInfo-374()

    onScrollCancel() should have an event as a parameter.

  • Argument Error #1063: Argument count mismatch

    So I'm having another issue my code.  I keep getting this error whenever I test:
    ArgumentError: Error #1063: Argument count mismatch on Enemy(). Expected 2, got 0.
        at flash.display::Sprite/constructChildren()
        at flash.display::Sprite()
        at flash.display::MovieClip()
        at MenuScreen()[C:\Users\Erin\Documents\School\National University\Game Scripting MUL 355 - December 2012\AvoiderGameFinal\Classes\MenuScreen.as:10]
        at DocumentClass()[C:\Users\Erin\Documents\School\National University\Game Scripting MUL 355 - December 2012\AvoiderGameFinal\Classes\DocumentClass.as:13]
    Here's my code for MenuScreen:
    <pre>
    package
        import flash.display.MovieClip;
        import flash.display.SimpleButton;
        import flash.events.MouseEvent;
        public class MenuScreen extends MovieClip
            public function MenuScreen()
                var startButton:StartButton = new StartButton();
                startButton.addEventListener( MouseEvent.CLICK, onClickStart );
            public function onClickStart( event:MouseEvent ):void
                dispatchEvent( new NavigationEvent( NavigationEvent.START ) );
    </pre>
    And here's my code for DocumentClass:
    <pre>
    package
        import flash.display.MovieClip;
        public class DocumentClass extends MovieClip
            public var menuScreen:MenuScreen;
            public var playScreen:AvoiderGame;
            public var gameOverScreen:GameOverScreen;
            public function DocumentClass()
                    super();
                    menuScreen = new MenuScreen();
                    menuScreen.addEventListener( NavigationEvent.START, onRequestStart );
                    menuScreen.x = 0;
                    menuScreen.y = 0;
                    addChild( menuScreen );
                public function onAvatarDeath( avatarEvent:AvatarEvent ):void
                    gameOverScreen = new GameOverScreen();
                    gameOverScreen.addEventListener( NavigationEvent.RESTART, onRequestRestart );
                    gameOverScreen.x = 0;
                    gameOverScreen.y = 0;
                    addChild( gameOverScreen );
                    playScreen = null;
                public function onRequestRestart( navigationEvent:NavigationEvent ):void
                    restartGame();
                public function onRequestStart( navigationEvent:NavigationEvent ):void
                    playScreen = new AvoiderGame();
                    playScreen.addEventListener( AvatarEvent.DEAD, onAvatarDeath );
                    playScreen.x = 0;
                    playScreen.y = 0;
                    addChild( playScreen );
                    menuScreen = null
                public function restartGame():void
                        menuScreen = new MenuScreen();
                    menuScreen.addEventListener( AvatarEvent.DEAD, onAvatarDeath );
                    menuScreen.x = 0;
                    menuScreen.y = 0;
                    addChild( menuScreen );
                    gameOverScreen = null;
    </pre>
    Any ideas?

    Hi sinious - yeah that's what I was thinking, but why does it say in the error message that it's in these two AC3 files?  I'm very new to it too.  Here's my Enemy file:
    <pre>
    package
        import flash.display.MovieClip;
        public class Enemy extends MovieClip
            public function Enemy( startX:Number, startY:Number )
                x = startX;
                y = startY;
            public function moveDownABit():void
                y = y + 3;
    </pre>

  • Error #1063: Argument count mismatch on "filename"

    Hi, all. I keep getting an error I cannot seem to solve. Although it does not seem to influence the behavior of my file, I don't know if it will in the future.
    ArgumentError: Error #1063: Argument count mismatch on "filename"::MainTimeline/"thisfunction"(). Expected 0, got 1.
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at fl.transitions::Tween/set time()
    at fl.transitions::Tween/nextFrame()
    at fl.transitions::Tween/onEnterFrame()
    I've already looked up the error, and it's true, there is no argument assigned within the "()" of my function, but I don't know what to put since it's a function that applies to multiple buttons and is called upon in another function. A similar function doesn't return this error. When I put "e:Event" within the "()" it returns "error 1136: Incorrect number of arguments.  Expected 1.

    This type of thing can often happen if you are calling a function from an event listener, as well as directly.
    When an event listener triggers a function it passes an object, of the listener type (MouseEvent, Event, VideoEvent, etc) to the function.
    You say that button presses trigger it, which leads me to believe that you should be watching for a MouseEvent.
    So:
    function thisfunction(e:MouseEvent){
    Furthermore, if you are calling it directly, you need to do 1 of 2 things.
    1. You can send a MouseEvent to it (so, thisfunction(new MouseEvent(MouseEvent.CLICK));
    2. You can set a default value for the argument, allowing 0 to be passed (so,   function thisfunction(e:MouseEvent = null){    )
    If neither of these suggestions work, please post the code so a more thorough look can be performed.

  • ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.

    Evenin' all.
    I'm creating a Flash application split up into scenes. One of the scenes is divided into sections of ten frames with keyframes at 1 (home, 10, 20, 30, 40, 50, 60, 70, 80 and 90. Frame #1 is the menu and contains the buttons to skip to each section using the gotoAndStop(); command.
    However, I want to be able to skip to #1 from any point using Next/Previous buttons. I have declared the buttons in frame 1 of scene 1 as follows:
    I have declared the buttons in frame 1 of scene 1 as follows:
    Code:
    var nextButton:Button = new Button();
    var prevButton:Button = new Button();
    var homeButton:Button = new Button();
    At each point, I use addChild(nextButton) to add the buttons to  the stage, and when the buttons are clicked it removes them as follows:
    Code:
    nextButton.addEventListener(MouseEvent.CLICK, goNext);
    function goNext(e:Event):void
          removeChild(videoPlayer);
          removeChild(prevButton);
          removeChild(nextButton);
          removeChild(homeButton);
          gotoAndStop(20);
    Now, all the 'Next' buttons work but none of the 'Previous'  buttons work, when all they do is gotoAndStop() ten frames backwards  rather than ten frames forwards, I keep getting this error message:
    Code:
    ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
         at flash.display::DisplayObjectContainer/removeChild()
         at Prototype_fla::MainTimeline/goBack()
    The same is happening with the Home buttons, which skip from whichever frame the user is on to the menu. The Next buttons are the only ones working consistently.
    Please help, this is really stressing me out, I'm on Flash CS4.
    Cheers

    You can`t remove the target of your event while it is "active"
    you wrote....
    nextButton.addEventListener(MouseEvent.CLICK, goNext);
    function goNext(e:Event):void
          removeChild(videoPlayer);
          removeChild(prevButton);
          removeChild(nextButton);
          removeChild(homeButton);
          gotoAndStop(20);
    instead you should write sth. like:
    nextButton.addEventListener(MouseEvent.CLICK, goNext);
    function goNext(e:Event):void
      // to be sure that there`s actualloy sth. to remove
          if(videoPlayer!=null){
          removeChild(videoPlayer);
         //similar  
         removeChild(prevButton);
          removeChild(homeButton);                
          e.currentTarget.removeEventListener(MouseEvent.CLICK, goNext)     
          removeChild(e.currentTarget);     
          gotoAndStop(20);
    this is probably similar in your other function, too

  • Image Gallery - ArgumentError: Error #2025

    Hi Guys,
    I am new to flash cs3 and action script 3.0. I have made 3
    image galleries, that all work fine by themselves, however i have
    recently tried to link them to a central flash file and I am
    getting the error:
    ArgumentError: Error #2025: The supplied DisplayObject must
    be a child of the caller.
    at flash.display::DisplayObjectContainer/removeChild()
    at home_fla::MainTimeline/gotoHome()
    I have attached the code for the central/home flash file
    below.
    Basically, all I am trying to achieve is to add the
    client_images.swf as a child when the client images button is
    clicked and then listen for a mouse click on the client_images home
    button and remove the child. This works if I click the home button
    straight away. If i don't click the home button with in 3 seconds,
    i get the error.
    I have had a good look for a solution to this problem and
    haven't had much luck. Any help would be greatly appreciated. I can
    send the .fla's if you need more information.
    Cheers,
    Paul.

    what's happening in client_images.swf? ie, btn_home is on the
    main timeline. and that timeline has more than 1 frame, correct?
    if yes, when 3 seconds expires the playhead is on a frame
    where btn_home does not exist. ie, make sure it's the same instance
    in frame 1 and frame whatever by clearing keyframes and re-creating
    them on btn_home's layer.

  • ArgumentError: Error #2108: Scene LevelSelect was not found

    Hello,
    I am a new student and recently I am getting this error in every program that I write or import into Flash:
    ArgumentError: Error #2108: Scene * was not found    
    at flash.display::MovieClip/gotoAndPlay()
              at _5_fla::MainTimeline/clickPlay()
    It doesn't matter what the scene name is because I have tried cutting and pasting the scene name from the scene window and it happens on every button in every program..
    Here is the code from my professor and I get the same error:
    import flash.events.MouseEvent;
    stop();
    //Add Event Listener Area
    playButton.addEventListener(MouseEvent.MOUSE_DOWN, clickPlay);
    howButton.addEventListener(MouseEvent.MOUSE_DOWN, clickHow);
    // Functions Area
    function clickPlay(event:MouseEvent):void
              MovieClip(this.root).gotoAndPlay(1,"LevelSelect");
    function clickHow(event:MouseEvent):void
              gotoAndStop("1","HowToPlay");
    function clickBack(event:MouseEvent):void
              gotoAndStop("1","MainMenu");
    function clickLevel(event:MouseEvent):void
              gotoAndStop("1","GamePlay");
    I copied and pasted the scene names here:
    MainMenu
    HowToPlay
    LevelSelect
    GamePlay
    Anyone have any suggestions?  This program works for the professor.

    that's expected behavior.  there's nothing wrong except your understanding:
    how could that work in "test scene"?  it's a "test scene" test environment, not a "test scenes" environment. 
    to test scenes in flash, use "test movie".
    p.s.  please mark helpful/correct responses.

  • Error #1063: Argument count mismatch. Expected 1, got 0.

    I'm trying to call a TweenEvent function which is placed in another class from my Document Class.
    ActionScript Code:
    ball[i].tweenX();
    However, the following error message is appearing...
    ActionScript Code:
    Error #1063: Argument count mismatch on Ball/tweenX(). Expected 1, got 0.
    I'm guessing I need to include something in the parentheses when I call .tweenx();, but I'm not too sure what?!
    Here's the Tween Event function in the Ball class as well if it helps.
    ActionScript Code:
    public function tweenX(event:TweenEvent):void
                var randomXBoundary = (xBoundary[int(Math.random() * xBoundary.length)]);
                myTweenX = new Tween(this, "x", None.easeOut, this.x, randomXBoundary, 10, true);
                trace("tweenX function for " + this + " has been called and is heading for" + randomXBoundary + " x pos");
                myTweenX.addEventListener(TweenEvent.MOTION_FINISH,tweenX);
            }//end of tweenX function

    There is a slight conflict of interests so to speak in that you want to call the same function in two different ways... with and without the event argument being passed.
    What you probably need to do is separate the tweening function from the event handler function...
    public function tweenX():void {
                var randomXBoundary = (xBoundary[int(Math.random() * xBoundary.length)]);
                myTweenX = new Tween(this, "x", None.easeOut, this.x, randomXBoundary, 10, true);
                trace("tweenX function for " + this + " has been called and is heading for" + randomXBoundary + " x pos");
                myTweenX.addEventListener(TweenEvent.MOTION_FINISH, tweenXEvt);
    public function tweenXEvt(event:TweenEvent):void {
                tweenX();

Maybe you are looking for

  • Multiple Email accounts and 1 reply to address

    I have 3 Email accounts setup on my Iphone one is Gmail one is .mac and the third is my Exchange IMAP email. my question is when i send an email from either my .mac account or my Exchange IMAP account and when the person replies to the message it aut

  • Local logical system is not defined

    Hello We are trying to setup a logical system  - created or defined the logical system when we try the BD64 it gives out the error "Local Logical system not defined" I am using ECC 6 version IS there any way to bypass  and do the setup ?

  • Javascript function not working in LiveCycle

    I've just completed importing an existing acrobat form into LiveCycle for editing.  During the import process, I received this LiveCycle warning: The form includes a simple JavaScript Function that looks really good, but probably doesn't reference th

  • Inputing array data through JTextFields

    Dear All, I am working on a little programme that will manipulate array variables. However, I will like the array data to be added though a GUI form made of text fields. I can input the data as part of the code, but I want it flexible. The array is l

  • Messages don't dequeue

    I manually queued row LCR's using the procedure described in chapter 16 in streams documentation pages 16-3 to 16-7. My messages are effectively queued but they are in WAITING state and i don't know why they are not dequeued automatically by the appl