#2025 error: The supplied DisplayObject must be a child of the caller.

Hi all

I would appreciate help with this.

I'm working on a piece of flash that will play 4 videos, according to the key pressed. First button will launch the first video, 2e-2e video and so on. Once the video is done playing, close_btn, learn_more_btn and replay_btn appear, plus a final image that is different for each of the videos (BoxLivePic, BoxSleepPic and BoxFeelPic). So - in fact 4 things appear after the movie stops playing and the last image depends on a user has clicked on the buttons...

My question is, when I click on the close button (andI'm sure even apply for the other 2 buttons), I get the error below:

ArgumentError: Error #2025: the supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at AER1_r5_fla::MainTimeline/closeVideo()

I understand is actually that it's because each image is not added to the display list, unless it has clicked the appropriate button... However, I don't know how to fix it! I hope that this will make some sence - here is my Code... Thanks a bunch:

import com.greensock;
com.greensock.easing import. *;
import com.greensock.easing.CustomEase;
import com.greensock.loading.VideoLoader;
import flash.display.Sprite;
import com.greensock.events.LoaderEvent;

import flash.display.MovieClip;
to import flash.display.SimpleButton;
import flash.events.MouseEvent;

Last buttons Variables
var close_btn:Button_close = new Button_close();
var learn_more_btn:Button_learn_more = new Button_learn_more();
var replay_btn:Button_replay = new Button_replay();

Last Pic Variables
var BoxLivePic:Box_Live_Pic = new Box_Live_Pic();
var BoxFeelPic:Box_Feel_Pic = new Box_Feel_Pic();
var BoxSleepPic:Box_Sleep_Pic = new Box_Sleep_Pic();

Video Variables
var Video_Breathe:VideoLoader = new VideoLoader ("Breathe_Video.f4v", {container:,})
x: 0, y:0});
var Video_Live:VideoLoader = new VideoLoader ("Live_Video.f4v", {container:,})
x: 0, y:0});
var Video_Sleep:VideoLoader = new VideoLoader ("Sleep_Video.f4v", {container:,})
x: 0, y:0});
var Video_Feel:VideoLoader = new VideoLoader ("Feel_Video.f4v", {container:,})
x: 0, y:0});

Video complete event listeners
Video_Breathe.addEventListener (VideoLoader.VIDEO_COMPLETE, donePlaying_breathe);
Video_Live.addEventListener (VideoLoader.VIDEO_COMPLETE, donePlaying_live);
Video_Sleep.addEventListener (VideoLoader.VIDEO_COMPLETE, donePlaying_sleep);
Video_Feel.addEventListener (VideoLoader.VIDEO_COMPLETE, donePlaying_feel);


OverwriteManager.init (OverwriteManager.AUTO);

Invisible buttons
breathe_mc.learn_btn. Visible = false;
breathe_mc.video_btn. Visible = false;
live_mc.learn_btn. Visible = false;
live_mc.video_btn. Visible = false;
sleep_mc.learn_btn. Visible = false;
sleep_mc.video_btn. Visible = false;
feel_mc.learn_btn. Visible = false;
feel_mc.video_btn. Visible = false;


Custom acceleration
CustomEase.create ("myCustomEase", [{s: 0, cp:1.14999, e:1.4}, {s:1.4, cp:1.65, e: 1}]);
CustomEase.create("myCustomEase2",[{s:0,cp:0.97,e:1.22},{s:1.22,cp:1.47,e:1}]);

var timeline:TimelineLite = new TimelineLite({onComplete:showBreathe});)
addChild (removeChild (better_mc));

TweenLite.to (better_mc, 2, {alpha: 1, y: 186.6, ease:Bounce.easeOut});})

timeline.appendMultiple([)
TweenLite.to (breathe_mc, 1, {alpha: 1, y: 117, ease:CustomEase.byName ("myCustomEase2")});
TweenLite.to (live_mc, 1, {alpha: 1, y: 117, y: 37, ease:CustomEase.byName ("myCustomEase2")});
TweenLite.to (sleep_mc, 1, {alpha: 1, y: 77, ease:CustomEase.byName ("myCustomEase2")});
[TweenLite.to (feel_mc, 1, {alpha: 1, y: 77, ease:CustomEase.byName ("myCustomEase2")})], 1, TweenAlign.START,. (2);

function showBreathe (): void
{

breathe_mc.learn_btn. Visible = true;
breathe_mc.video_btn. Visible = true;
TweenLite.to (breathe_mc.learn_btn,.5, {alpha: 1});
TweenLite.to (breathe_mc.video_btn,.5, {alpha: 1});

TweenLite.to (breathe_mc, 1, {y: 77, ease:CustomEase.byName("myCustomEase")});})

Display text
TweenLite.to (breathe_txt_mc, 1, {alpha: 1});
}

Event listeners
breathe_mc.addEventListener (MouseEvent.MOUSE_OVER, breatheOpen);
live_mc.addEventListener (MouseEvent.MOUSE_OVER, liveOpen);
sleep_mc.addEventListener (MouseEvent.MOUSE_OVER, sleepOpen);
feel_mc.addEventListener (MouseEvent.MOUSE_OVER, feelOpen);


For the video game event listeners
breathe_mc.video_btn.addEventListener (MouseEvent.MOUSE_DOWN, breathe_play_video);
live_mc.video_btn.addEventListener (MouseEvent.MOUSE_DOWN, live_play_video);
sleep_mc.video_btn.addEventListener (MouseEvent.MOUSE_DOWN, sleep_play_video);
feel_mc.video_btn.addEventListener (MouseEvent.MOUSE_DOWN, feel_play_video);

Event listener for the close video
close_btn.addEventListener (MouseEvent.MOUSE_DOWN, closeVideo);

Functions of the buttons of the VIDEO and find OUT more
function breathe_play_video(event:MouseEvent):void {}
Video_Breathe.load ();
this.addChild (Video_Breathe.content);
}

function live_play_video(event:MouseEvent):void {}
Video_Live.load ();
this.addChild (Video_Live.content);
}

function sleep_play_video(event:MouseEvent):void {}
Video_Sleep.load ();
this.addChild (Video_Sleep.content);
}

function feel_play_video(event:MouseEvent):void {}
Video_Feel.load ();
this.addChild (Video_Feel.content);
}


function closeVideo(event:MouseEvent):void {}
Video_Breathe.Unload ();
Video_Sleep.Unload ();
Video_Feel.Unload ();
Video_Live.Unload ();
removeChild (close_btn);
removeChild (learn_more_btn);
removeChild (replay_btn);
removeChild (BoxLivePic);
removeChild (BoxSleepPic);
removeChild (BoxFeelPic);
}

Finally breathe buttons added to the stage
function donePlaying_breathe(e:Event):void {}

addChild (close_btn);
addChild (learn_more_btn);
addChild (replay_btn)
close_btn.x = 313;
close_btn.y = 183;
learn_more_btn.x = 434;
learn_more_btn.y = 183;
replay_btn.x = 554;
replay_btn.y = 183;
}

Last direct buttons
function donePlaying_live(e:Event):void {}

addChild (BoxLivePic);
addChild (close_btn);
addChild (learn_more_btn);
addChild (replay_btn)
close_btn.x = 43;
close_btn.y = 183;
learn_more_btn.x = 164;
learn_more_btn.y = 183;
replay_btn.x = 284;
replay_btn.y = 183;
}

Last sleep buttons
function donePlaying_sleep(e:Event):void {}

addChild (BoxSleepPic);
addChild (close_btn);
addChild (learn_more_btn);
addChild (replay_btn)
close_btn.x = 313;
close_btn.y = 183;
learn_more_btn.x = 434;
learn_more_btn.y = 183;
replay_btn.x = 554;
replay_btn.y = 183;
}

Latest sensation buttons
function donePlaying_feel(e:Event):void {}

addChild (BoxFeelPic);
addChild (close_btn);
addChild (learn_more_btn);
addChild (replay_btn)
close_btn.x = 313;
close_btn.y = 183;
learn_more_btn.x = 434;
learn_more_btn.y = 183;
replay_btn.x = 554;
replay_btn.y = 183;
}


Functions of breathing
function breatheOpen(event:MouseEvent):void
{
TweenLite.to (breathe_mc, 1, {y: 77, ease:Elastic.easeOut});})

TweenLite.to (breathe_mc.learn_btn,.5, {alpha: 1});
TweenLite.to (breathe_mc.video_btn,.5, {alpha: 1});

Live close
TweenLite.to (live_mc, 1, {y: 117, ease:Elastic.easeOut});})
TweenLite.to (live_mc.learn_btn,.5, {alpha: 0});
TweenLite.to (live_mc.video_btn,.5, {alpha: 0});

Close the sleep
TweenLite.to (sleep_mc, 1, {y: 77, ease:Elastic.easeOut});})
TweenLite.to (sleep_mc.learn_btn,.5, {alpha: 0});
TweenLite.to (sleep_mc.video_btn,.5, {alpha: 0});

Feel close
TweenLite.to (feel_mc, 1, {y: 77, ease:Elastic.easeOut});})
TweenLite.to (feel_mc.learn_btn,.5, {alpha: 0});
TweenLite.to (feel_mc.video_btn,.5, {alpha: 0});

See photo
TweenLite.to (pic_breathe_mc,.5, {alpha: 1});

Hide other photos
TweenLite.to (pic_live_mc,.5, {alpha: 0});
TweenLite.to (pic_sleep_mc,.5, {alpha: 0});
TweenLite.to (pic_feel_mc,.5, {alpha: 0});

Display text
TweenLite.to (breathe_txt_mc, 1, {alpha: 1});

Hide other texts
TweenLite.to (live_txt_mc, 1, {alpha: 0});
TweenLite.to (sleep_txt_mc, 1, {alpha: 0});
TweenLite.to (feel_txt_mc, 1, {alpha: 0});
}

Live functions
function liveOpen(event:MouseEvent):void
{
TweenLite.to (live_mc, 1, {y: 77, ease:Elastic.easeOut});})

live_mc.learn_btn. Visible = true;
live_mc.video_btn. Visible = true;
TweenLite.to (live_mc.learn_btn,.5, {alpha: 1});
TweenLite.to (live_mc.video_btn,.5, {alpha: 1});

Close to breathe
TweenLite.to (breathe_mc, 1, {y: 117, ease:Elastic.easeOut});})
TweenLite.to (breathe_mc.learn_btn,.5, {alpha: 0});
TweenLite.to (breathe_mc.video_btn,.5, {alpha: 0});

Close the sleep
TweenLite.to (sleep_mc, 1, {y: 77, ease:Elastic.easeOut});})
TweenLite.to (sleep_mc.learn_btn,.5, {alpha: 0});
TweenLite.to (sleep_mc.video_btn,.5, {alpha: 0});

Feel close
TweenLite.to (feel_mc, 1, {y: 77, ease:Elastic.easeOut});})
TweenLite.to (feel_mc.learn_btn,.5, {alpha: 0});
TweenLite.to (feel_mc.video_btn,.5, {alpha: 0});

See photo
TweenLite.to (pic_live_mc,.5, {alpha: 1});

Hide other photos
TweenLite.to (pic_sleep_mc,.5, {alpha: 0});
TweenLite.to (pic_feel_mc,.5, {alpha: 0});

Display text
TweenLite.to (live_txt_mc, 1, {alpha: 1});

Hide other texts
TweenLite.to (breathe_txt_mc, 1, {alpha: 0});
TweenLite.to (sleep_txt_mc, 1, {alpha: 0});
TweenLite.to (feel_txt_mc, 1, {alpha: 0});
}


Sleep functions
function sleepOpen(event:MouseEvent):void
{
TweenLite.to (sleep_mc, 1, {y: 37, ease:Elastic.easeOut});})

sleep_mc.learn_btn. Visible = true;
sleep_mc.video_btn. Visible = true;
TweenLite.to (sleep_mc.learn_btn,.5, {alpha: 1});
TweenLite.to (sleep_mc.video_btn,.5, {alpha: 1});

Close to breathe
TweenLite.to (breathe_mc, 1, {y: 117, ease:Elastic.easeOut});})
TweenLite.to (breathe_mc.learn_btn,.5, {alpha: 0});
TweenLite.to (breathe_mc.video_btn,.5, {alpha: 0});

Live close
TweenLite.to (live_mc, 1, {y: 117, ease:Elastic.easeOut});})
TweenLite.to (live_mc.learn_btn,.5, {alpha: 0});
TweenLite.to (live_mc.video_btn,.5, {alpha: 0});

Feel close
TweenLite.to (feel_mc, 1, {y: 77, ease:Elastic.easeOut});})
TweenLite.to (feel_mc.learn_btn,.5, {alpha: 0});
TweenLite.to (feel_mc.video_btn,.5, {alpha: 0});

See photo
TweenLite.to (pic_sleep_mc,.5, {alpha: 1});

Hide other photos
TweenLite.to (pic_feel_mc,.5, {alpha: 0});

Display text
TweenLite.to (sleep_txt_mc, 1, {alpha: 1});

Hide other texts
TweenLite.to (live_txt_mc, 1, {alpha: 0});
TweenLite.to (breathe_txt_mc, 1, {alpha: 0});
TweenLite.to (feel_txt_mc, 1, {alpha: 0});
}

Feeling of functions
function feelOpen(event:MouseEvent):void
{
TweenLite.to (feel_mc, 1, {y: 37, ease:Elastic.easeOut});})

feel_mc.learn_btn. Visible = true;
feel_mc.video_btn. Visible = true;
TweenLite.to (feel_mc.learn_btn,.5, {alpha: 1});
TweenLite.to (feel_mc.video_btn,.5, {alpha: 1});


Close to breathe
TweenLite.to (breathe_mc, 1, {y: 117, ease:Elastic.easeOut});})
TweenLite.to (breathe_mc.learn_btn,.5, {alpha: 0});
TweenLite.to (breathe_mc.video_btn,.5, {alpha: 0});

Live close
TweenLite.to (live_mc, 1, {y: 117, ease:Elastic.easeOut});})
TweenLite.to (live_mc.learn_btn,.5, {alpha: 0});
TweenLite.to (live_mc.video_btn,.5, {alpha: 0});

Close the sleep
TweenLite.to (sleep_mc, 1, {y: 77, ease:Elastic.easeOut});})
TweenLite.to (sleep_mc.learn_btn,.5, {alpha: 0});
TweenLite.to (sleep_mc.video_btn,.5, {alpha: 0});

See photo
TweenLite.to (pic_feel_mc,.5, {alpha: 1});

Display text
TweenLite.to (feel_txt_mc, 1, {alpha: 1});

Hide other texts
TweenLite.to (live_txt_mc, 1, {alpha: 0});
TweenLite.to (sleep_txt_mc, 1, {alpha: 0});
TweenLite.to (breathe_txt_mc, 1, {alpha: 0});

}

This error means that you are trying to access an object on the display (object) list is not there.

For example, if the instance of close_btn is not added as a child, the following line will throw this error:

removeChild (close_btn);

One of the ways to remedy this situation is to confirm that the object is added:

If (Contains (close_btn)) removeChild (close_btn);

Tags: Adobe Animate

Similar Questions

  • Add Radio button dynamically, twice - #2025 error: the supplied DisplayObject must be a child of

    Hello

    I have some difficulty to the dynamic addition of user interface controls. For the most part with radio buttons.

    Here is an example that illustrates my problem:

    < s:Application
    ' xmlns:fx = ' http://ns.Adobe.com/MXML/2009 "
    xmlns:s = "library://ns.adobe.com/flex/spark".
    xmlns:MX = "library://ns.adobe.com/flex/mx".
    creationPolicy = "all".
    >

    < fx:Script >
    <! [CDATA]
    Import mx.containers.Form;
    Import mx.containers.Panel;
    Import mx.controls.Label;
    Import mx.controls.NumericStepper;
    Import mx.controls.RadioButton;

    private var theChar:String = 'B ';.

    protected function btnAdd_clickHandler(event:MouseEvent):void
    {

    var theForm:Form = new Form();
    theForm.label = theChar;

    1 label
    var myLabel:Label = new Sun;
    MyLabel.set_Text = "My Label";
    myLabel.width = 120;
    theForm.addChild (myLabel);

    2. digital stepper
    var myNumStepper:NumericStepper = new NumericStepper();
    myNumStepper.id = "numPointHigh" + theChar;
    myNumStepper.name = "numPointHigh" + theChar;
    myNumStepper.minimum = 0;
    myNumStepper.maximum = 120;
    myNumStepper.width = 50;
    myNumStepper.height = 30;
    theForm.addChild (myNumStepper);

    3. radio button
    var myRadioButton:RadioButton = new RadioButton;
    myRadioButton.id = "myRadioButton" + theChar;
    myRadioButton.name = "myRadioButton" + theChar;
    myRadioButton.label = "my button";
    myRadioButton.selected = true;
    theForm.addChild (myRadioButton);

    4. expert group
    var thePanel:Panel = new Panel();
    thePanel.width = 300;
    thePanel.height = 475;
    thePanel.name = theChar;
    thePanel.title = 'my profile sign ';
    thePanel.setStyle ("backgroundColor", "blue");

    Add the shape in the Panel
    thePanel.addChild (theForm);

    Add the Panel to the list control
    myList.addChild (thePanel);

    }

    protected function btnClear_clickHandler(event:MouseEvent):void
    {
    var numChildren:Number = myList.numChildren;
    for (var i: Number = numChildren - 1; i > - 1; i--) {}
    myList.removeChildAt (i);
    }
    }

    []] >
    < / fx:Script >

    < mx:VBox width = "100%" >
    < mx:List id = "myList" / >
    < mx:Button id = "btnAdd" label = "Add a Panel" click = "btnAdd_clickHandler (event)" color = "black" / > "
    < mx:Button id = "btnClear" label = "Clear" click = "btnClear_clickHandler (event)" color = "black" / > "
    < / mx:VBox >

    < / s:Application >

    ^ Running. Click on the button "add a Panel." Then click on "delete". Then click again on the button "add a Panel." You will see the error:

    ArgumentError: Error #2025: the supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/getChildIndex()
    at mx.core::Container/getChildIndex() [E:\dev\4.0.0\frameworks\projects\framework\src\mx\core \Container.as:2833]
    at mx.containers::Panel/getChildIndex() [E:\dev\4.0.0\frameworks\projects\framework\src\mx\co ntainers\Panel.as:1174]
    at mx.controls::RadioButtonGroup/breadthOrderCompare() [E:\dev\4.0.0\frameworks\projects\fram ework\src\mx\controls\RadioButtonGroup.as:600]
    at mx.controls::RadioButtonGroup/breadthOrderCompare() [E:\dev\4.0.0\frameworks\projects\fram ework\src\mx\controls\RadioButtonGroup.as:611]
    at mx.controls::RadioButtonGroup/breadthOrderCompare() [E:\dev\4.0.0\frameworks\projects\fram ework\src\mx\controls\RadioButtonGroup.as:611]
    to Array$ / _sort)
    table / http://Adobe.com/AS3/2006/builtin:sort ()
    to mx.controls::RadioButtonGroup / http://www.Adobe.com/2006/Flex/MX/internal:addInstance ([E:\dev\4.0.0\frameworks\projects \framework\src\mx\controls\RadioButtonGroup.as:465])
    at mx.controls::RadioButton/addToGroup() [E:\dev\4.0.0\frameworks\projects\framework\src\mx\c ontrols\RadioButton.as:574]
    at mx.controls::RadioButton/commitProperties() [E:\dev\4.0.0\frameworks\projects\framework\sr c\mx\controls\RadioButton.as:514]
    at mx.core::UIComponent/validateProperties() [E:\dev\4.0.0\frameworks\projects\framework\src\ mx\core\UIComponent.as:7772]
    at mx.managers::LayoutManager/validateProperties() [E:\dev\4.0.0\frameworks\projects\framewor k\src\mx\managers\LayoutManager.as:572]
    at mx.managers::LayoutManager/doPhasedInstantiation() [E:\dev\4.0.0\frameworks\projects\frame work\src\mx\managers\LayoutManager.as:730]
    at mx.managers::LayoutManager/doPhasedInstantiationCallback() [E:\dev\4.0.0\frameworks\projec ts\framework\src\mx\managers\LayoutManager.as:1072]

    I don't understand why I can't add the option button? If you comment out the code for the button of the radio (comment #3 of the article) you can easily add the panels. It happens only when I have radio buttons is added to the form/Panel.

    Why this is happening and how to fix it? Why is this only happening radio button? I thought that I had this problem

    I have responded on the stack overflow.  Make sure your Radio buttons are in a group of Radio buttons and your error disappears.

  • The supplied DisplayObject must be a child of the appellant please help!

    Hi hope someone can help me with this.

    IM child added to a bg MovieClip

    ----------------------------------------------

    for (var i: int = 1; i < = cols; i ++)

    {

    for (int var q = 1; q < = lines; q ++)

    {

    var random_card = Math.floor (Math.random () * colordeck.length);

    tile = new colors();

    tile.width = widthvar;

    tile.height = widthvar;

    tile.col = colordeck [random_card];

    colordeck.splice(random_card,1);

    tile.gotoAndStop (9);

    tile.x = (i +. 2) * xvar;

    tile.y = (q + adjust) * yvar.

    tile.addEventListener (MouseEvent.CLICK, tile_clicked);

    bg.addChild (tile);

    }

    }

    ------------------------------------------

    When I removeChild (bg) it does not remove its children and dear I addChild (bg) again

    He adds more children on top.

    How can I remove these BG?

    I tried:

    ----------------------------------------

    If (bg.contains (tile))

    {

    for (var i: int = 1; i < = cols; i ++)

    {

    for (int var q = 1; q < = lines; q ++)

    {

    bg.removeChild (tile);

    }

    }

    }

    ---------------------------------

    but get an error:

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

    at flash.display::DisplayObjectContainer/removeChild()

    If you can help id rly appriciate it

    THX pavel

    You can also use some methods such as:

    for (i = mc.numChildren - 1; i > = 0; i--) {}

    trace (MC.getChildAt (i). (Name)

    mc.removeChildAt (i);

    }

  • #2025 error: the supplied DisplayObject must be a child of the appellant - delete table object

    Hi guys, I'm fairly new to as3 and I'm doing a game where the player clicks on so-called onstage and 3 towers which I generated dynamically must pull the space. Everything works on the plane of rotation of the Tower, etc., but bullets will not be removed from the scene when I leave the level in another scene. Control of the border is fine, also.

    Here is a part of the code in the Main.as file.

     private function clickTower1(e:MouseEvent):void 
    {
    for each (var tower1:mcTower1 in tower1Array)
    {
    var newLaser1:mcLaser1 = new mcLaser1();
    newLaser1
    .rotation = tower1.rotation;
    newLaser1.x = tower1.x + Math.cos(newLaser1.rotation * Math.PI / 180) * 40;
    newLaser1.y = tower1.y + Math.sin(newLaser1.rotation * Math.PI / 180) * 40;
    newLaser1.addEventListener(Event.ENTER_FRAME, laser1Handler);
    tower1BulletArray.push(newLaser1); stage.addChild(newLaser1);
    }
    }

     
    private function laser1Handler(e:Event):void
    {
    //Make laser move in direction of turret.
    var newLaser1:MovieClip = e.currentTarget as MovieClip;
    newLaser1.x += Math.cos(newLaser1.rotation * Math.PI / 180) * laser1Speed;
    newLaser1.y += Math.sin(newLaser1.rotation * Math.PI / 180) * laser1Speed;
    //Boundary checking if (newLaser1.x < -50 || newLaser1.x > 800 || newLaser1.y > 600 || newLaser1.y < -50)
    {
    newLaser1.removeEventListener(Event.ENTER_FRAME, laser1Handler); stage.removeChild(newLaser1);
    tower1BulletArray.splice(0, 1);
    }
    }

    I have a function called exitLevel, coming out, as its name suggests, the level when a button is clicked. It worked perfectly before you start coding the bullets.

        private function exitLevel(e:MouseEvent):void
    {
    stage
    .frameRate = 6;
    gamePaused = false;
    clearLevel();
    gotoAndStop(1, 'exitLevel');
    btnExitLevel.addEventListener(MouseEvent.CLICK, levelSelect1);
    }
      private function clearLevel():void
    {
    stage.removeEventListener(Event.ENTER_FRAME, update);
    stage.removeChild(buttonCreep1); stage.removeChild(buttonCreep2);
    for (var i = creep1Array.length - 1; i >= 0; i--)
    {
    removeChild(creep1Array[i]);
    creep1Array.splice(i, 1);
    //trace ("Creep1 Removed");
    }
    for (var j = creep2Array.length - 1; j >= 0; j--)
    {
    removeChild(creep2Array[j]);
    creep2Array
    .splice(j, 1);
    //trace ("Creep2 Removed");
    }
    for (var k = tower1Array.length - 1; k >= 0; k--)
    {
    removeChild(tower1Array[k]); tower1Array.splice(k, 1);
    }
    for (var l = tower1BulletArray.length - 1; l >= 0; l--)
    {
      stage.removeChild(tower1BulletArray[l]);
    tower1BulletArray.splice(0, 1);
      }
    }

    After debugging, it is said that the error is at the end, where I'm trying to remove the child from the scene. What's wrong? Sorry, I'm a newbie to as3, so the answers could be gave... I'll try to learn and understand, however. Thank you!

    I took the code out of a guide on the web, and I do not fully understand, then someone can explain to me what this code does as well? What is e.currentTarget? Thank you!

     var newLaser1:MovieClip = e.currentTarget as MovieClip;

    Here is the .as file full if someone wants to take a look. http://pastebin.com/5ff4BQa5

    If fleas are still on the screen, you or the other

    1. did you not run this code just before the change of scene or

    2 Add bullets to the displaylist without adding to tower1BulletArray or

    3. continue to add chips to the displaylist after this code executes

  • ArgumentError: Error #2025: the supplied DisplayObject must be a child of the appellant

    I get this error and I think I understand, but I look at my code and the enemy doesn't seem to be on the stage. The error is on the last line of the Enemy.as. It cannot remove the enemy display object as it seems that the scene is not like a child.

    Main.As (instantiated enemy: enemy)

    Enemy.As (contains the problem code) it is basically saying that the scene is not the enemy of display object.

    I'll post the parts where the enemy is mentioned.

    Main.As

    private var enemy: enemy = new enemy (Stadium, Heroes);

    ...

    for (var i: int = 0; i < 5; i ++)

    {

    enemy = new enemy (Stadium, Heroes);

    Enemy.x = 100 + offsetEnemy;

    enemyVector [i] = enemy; populate the vector with enemies.

    addChild (enemy);

    enemy.cacheAsBitmap = true;

    }

    Enemy.As

    package

    {

    import flash.display.MovieClip;

    import flash.display.Stage;

    import flash.events.Event;

    import flash.display.Stage;

    SerializableAttribute public class enemy extends MovieClip

    {

    private var stageRef:Stage;

    private var vy:Number = 1; Speed y

    private var ay: Number =. 1; acceleration of y

    private var target: Hero;

    public void enemy (stageRef:Stage, target: Hero): void

    {

    this.stageRef = stageRef;

    This.target = target;

    x = Math.Random () * stageRef.stageWidth;

    y =-5;

    addEventListener (Event.ENTER_FRAME, loop, false, 0, true);

    }

    private void loop(e:Event): void

    {

    Vy += ay;

    y += vy;

    If (y > stageRef.stageHeight)

    removeSelf();

    }

    private void removeSelf(): void {}

    removeEventListener (Event.ENTER_FRAME, loop);

    If (stageRef.contains (this))

    stageRef.removeChild (this);

    }

    }

    }

    If I add the enemy in the main class, while I would like to remove the enemy in the main class.

    If you want the enemy to refer to the scene, and then use an ADDED_TO_STAGE event listener in the instantiation function and have sound handler to deal with anything whatsoever from the scene for this instance of treatment.

    Do not use the same name for different instances of variables.  You're not going anywhere the assignment of a variable to itself ("this" is the most often useless in AS3)...

    this.stageRef = stageRef;

    This.target = target;

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

    I have a button that creates mc what mouse downwards and remove it when the mouse upwards.

    can someone tell me why I get this error and how to fix it.

    the error only appears when I repeat the mouse down.

    Thank you

    import flash.events.Event;

    brown.addEventListener (MouseEvent.MOUSE_DOWN, GB)

    function createCircle (xx:Number, yy:Number, d: Number, color: number live: Boolean = true)

    {

    brown.addEventListener (MouseEvent.MOUSE_UP, goo)

    var mc:MovieClip = new MovieClip

    mc.addEventListener (Event.ENTER_FRAME, kav);

    mc.addEventListener (MouseEvent.MOUSE_UP, goo);

    MC.visible = live;

    mc.buttonMode = true;

    addChild (mc);

    mc.graphics.beginFill (color);

    mc.graphics.drawCircle (xx, yy, d);

    function kav(e:Event) {}

    MC.y-= 0.2

    }

    function goo (MouseEvent) {}

    removeChild (mc)

    }

    }

    function GB (MouseEvent) {}

    createCircle (250,200,Math.random () * 40 + 10, Math.random () * 0xFFFFFF)

    }

    When you create an object, there is, and by using addChild it simply brings in the display list.  Using removeChild removes it from the display list, but it's not the object disappear... it still exists, you just can't see. So the next time you make one event MOUSE_UP, you try to remove a child who has already been deleted.

    When you work with listeners and dynamic objects, you should remove listeners when you delete objects.

    Another thing, you shouldn't nest named within the functiions functions.

  • #2025 error: The supplied DisplayObject must be a child of the caller.      to flash. display::DisplayObj

    Hi guys I am pullying my hair since 2 days

    Plese help me

    Is my document class

    package

    {

    import flash.display.MovieClip;

    import flash.display.StageScaleMode;

    import flash.display.StageAlign;

    /public class Main extends MovieClip

    {

    scrollerBg:ScrollerBg private var;

    public void Main()

    {

    stage.scaleMode = StageScaleMode.NO_SCALE;

    stage.align = StageAlign.TOP;

    scrollerBg = new ScrollerBg();

    addChild (scrollerBg);

    scrollerBg.x = 39;

    scrollerBg.y = 572;

    }

    }

    }

    My ScrollerBg is connect to this class

    package com.elements

    {

    import flash.display.MovieClip;

    import LeftArrow.

    import RightArrow;

    import flash.display.Sprite;

    import flash.net.URLLoader;

    import flash.events.Event;

    import flash.net.URLRequest;

    import flash.display.Loader;

    import flash.events.ProgressEvent;

    import flash.events.IOErrorEvent;

    import com.elements.PreloaderObject;

    import com.greensock.TweenMax;

    /public class Scrollercontainer extends MovieClip

    {

    leftArrow:LeftArrow private var;

    rightArrow:RightArrow private var;

    scrollerBg:Sprite private var;

    scrollerMask:Sprite private var;

    private var xmlPath:String = "xml/scroller.xml.

    xmlLoader:URLLoader private var;

    private var preloader: PreloaderObject;

    public static var bgImage:Array;

    public static var thumbImage:Array;

    public static var labelArray:Array;

    xmlData:XML private var;

    public void Scrollercontainer()

    {

    addEventListener (Event.ADDED_TO_STAGE, onAddedtoStageHandeler, false, 0, true);

    }

    onAddedtoStageHandeler(evt:Event):void private function

    {

    scrollerBg = new Sprite();

    scrollerBg.graphics.beginFill (0 x 000000, 1);

    scrollerBg.graphics.drawRect (0,0,865,78);

    scrollerBg.graphics.endFill ();

    addChild (scrollerBg);

    scrollerBg.x = 28;

    scrollerBg.y = 13;

    scrollerMask = new Sprite();

    scrollerMask.graphics.beginFill (0 x 000000, 1);

    scrollerMask.graphics.drawRect (0,0,865,78);

    scrollerMask.graphics.endFill ();

    addChild (scrollerMask);

    scrollerMask.x = 28;

    scrollerMask.y = 13;

    scrollerBg.mask = scrollerMask;

    left arrow = new LeftArrow();

    leftArrow.x = 14;

    leftArrow.y = 44;

    leftArrow.buttonMode = true;

    addChild (leftArrow);

    right arrow = new RightArrow();

    rightArrow.x = 901.

    rightArrow.y = 44;

    rightArrow.buttonMode = true;

    addChild (rightArrow);

    lodXMLinit();

    }

    private function lodXMLinit (): void

    {

    bgImage = new Array();

    thumbImage = new Array();

    labelArray = new Array();

    xmlLoader = new URLLoader();

    xmlLoader.addEventListener (Event.COMPLETE, xmlLoaded);

    xmlLoader.load (new URLRequest (xmlPath));

    preloader = new PreloaderObject();

    preloader.buildPreloader ();

    }

    xmlLoaded(evt:Event):void private function

    {

    xmlData = new XML (evt.target.data);

    var xmlList:XMLList = xmlData.slide;

    var point: XML;

    / / trace (xmlList.toXMLString ());

    for each (xmlList)

    {

    bgImage.push (item.slide);

    thumbImage.push (item.thumbImage);

    labelArray.push (item.label);

    }

    / / trace(thumbImage[1]);

    buildThumbScroller();

    }

    private function buildThumbScroller (): void

    {

    for (var i: int = 0; i < thumbImage.length; i ++)

    {

    var thumbBackground:MovieClip = new MovieClip();

    var thumbImgeBackground:Sprite = new Sprite();

    thumbImgeBackground.graphics.beginFill(0xffffff,1);

    thumbImgeBackground.graphics.drawRect (0,0,100,78);

    thumbImgeBackground.graphics.endFill ();

    thumbBackground.addChild (thumbImgeBackground);

    thumbBackground.x (100 + 20) = * i;

    thumbBackground.indexs = i;

    thumbBackground.src = thumbImage [i];

    thumbBackground.buttonMode = true;

    var preloader: PreloaderObject = new PreloaderObject();

    preloader.name = String (i);

    preloader.buildPreloader ();

    var imageContainer:Sprite = new Sprite();

    var thldr:Loader = new Loader();

    thldr.contentLoaderInfo.addEventListener (Event.OPEN, pairs loadStarted);

    thldr.contentLoaderInfo.addEventListener (Event.COMPLETE, imageLoaded);

    thldr.contentLoaderInfo.addEventListener (ProgressEvent.PROGRESS, showProgress);

    thldr.contentLoaderInfo.addEventListener (IOErrorEvent.IO_ERROR, onError);

    thldr.load (new URLRequest (thumbBackground.src));

    imageContainer.addChild (thldr);

    thumbBackground.addChild (imageContainer);

    scrollerBg.addChild (thumbBackground);

    }

    }

    loadStarted(evt:Event):void private function

    {

    trace (this); Traces [object ScrollerBg];

    this.addChild (preloader);

    }

    imageLoaded(evt:Event):void private function

    {

    }

    showProgress(evt:ProgressEvent):void private function

    {

    / / trace (this);

    var percent: Number = (1.0 / evt.bytesTotal) * evt.bytesLoaded;

    / / trace (percent);

    si (p == 1)

    {       

    this.removeChild (preloader); Here's my problem when it draws traces [object ScrollerBg];

    }

    else

    {

    preloader.loadBar.width = stage.stageWidth * per cent;

    }

    }

    onError(evt:IOErrorEvent):void private function

    {

    }

    }

    }

    and my Preloader object class is the following

    package com.elements

    {

    import flash.display.MovieClip;

    import flash.display.Shape;

    /public class PreloaderObject extends MovieClip

    {

    public var loadBar:Shape;

    public void PreloaderObject()

    {

    }

    buildPreloader(color:uint_=_0xffccdd,height:uint_=3):void of the public service

    {

    Gauge = new Shape();

    loadBar.graphics.beginFill(color,1);

    loadBar.graphics.drawRect (0.0,0.0,100,100);

    loadBar.graphics.endFill ();

    loadBar.width = 0.0;

    loadBar.height = height;

    addChild (loadBar);

    }

    }

    }

    Here, I want to show the preloader on each thumbloading process
    When tracing both parent show is the same but preloader does not work please help me
    Thanks in advance

    This is not going to work.

    you have a problem with your logic.  you have a preloader.  you have several objects that you load into a loop for.  the first object will finish loading, preloader is removed and then the next object end of loading.

    1. There is no preloader displaying prices charge when the first object is completed loading

    2. the preloader first shows the load progress of the first object only, not the load course of whatever it is you want to load

    3. the error of you know: preloader seeks to be removed, after it is already deleted.

    If you don't like about 1 and 2 do not resolve your issue, use the code that I suggested in my first post:

    {if (preloader.stage)}

    this.removeChild (preloader);

    }

    If you want to display the load progress of the rest of the loop for loads, you will need to decide what exactly you want to display.

  • Procedural error the call for VARRAY String as parameter

    Hello

    I get the error during the call to the procedure:

    Here are the steps:

    CREATE or REPLACE TYPE PART_TYPE IS an OBJECT (part_number VARCHAR2 (120));

    CREATE OR REPLACE TYPE PART_REC_TBL IS VARRAY (1000) of PART_TYPE ;

    I have a stored procedure in the package:

    create or replace package TEST_PART_SEARCH_PKG AUTHID CURRENT_USER AS

    PROCEDURE ADD_TO_PART)

    p_part_number_list IN PART_REC_TBL ,

    p_ord_number IN Varchar2,

    x_error_flag OUT Varchar2,

    x_error_msg OUT Varchar2

    );

    end TEST_PART_SEARCH_PKG;

    When I call the Package:

    DECLARE

    v_flag varchar2 (100);

    v_err_msg varchar2 (100);

    BEGIN

    TEST_PART_SEARCH_PKG. ADD_TO_PART ('09031518,0897701 ',' 003146M 56', v_flag, v_err_msg);

    END;

    error report-

    ORA-06550: line 5, column 6:

    PLS-00306: wrong number or types of arguments in the call to 'ADD_TO_PART '.

    ORA-06550: line 5, column 6:

    PL/SQL: Statement ignored

    It would be helpful if someone can help me on this

    Obviously. There are no part_number, so turn in your package and get rid of it:

    FOR indx1 IN 1.p_lot_number_list. COUNTY

    LOOP

    BEGIN

    SELECT

    inventory_item_id

    IN

    var_item_id

    Of

    test_part_number_v

    WHERE

    PART_NUMBER = p_part_number_list (indx1);

    EXCEPTION

    WHILE OTHERS THEN

    var_item_id: = NULL;

    END;

    SY.

  • #2006 error: The supplied index is out of bounds

    Hello

    I'm trying to addChild with an interval, using this piece of code, but I always get an error saiyng that the State index is out of bounds.

    Why?

    What should I do to have mc1, added so the wait lets say a second and add m2 2 and so on?

    Thank you

    var tempo_espera:Timer = new Timer(1000, 1);
    tempo_espera.addEventListener ("timer", joints);
    tempo_espera. Start();
    //
    function inserir(evt:TimerEvent):void {}
    for (var nv1:int = 0; nv1 < promocoes.length; nv1 ++) {}
    holder.addChildAt (mc, nv1);
    var animacao:TransitionManager = new TransitionManager (mc);
    animacao.startTransition ({type: Zoom, direction: Transition.IN, easing: Elastic.easeOut, duration: 3});
    }
    }

    RangeError: Error #2006: the supplied index is out of range.
    at flash.display::DisplayObjectContainer/addChildAt()
    to MethodInfo - 346)
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()

    Here is the code that works. The problem was that Timer.currentCount begins with 1 - 0 no. Made on each call, it must be decremented from 1 to call table position (highlighted in red).

    var holder:Sprite = new Sprite();addChild(holder);// this is array of movie clipsvar mcArray:Array = new Array();// it is better to declare variable once and then reinstantiate itvar mc:MovieClip;// do your regular routinevar prm:Array;for (var nv:uint = 0; nv < promocoes.length; nv++) {    prm = promocoes[nv].split("|sep|");    mc = new MovieClip();
        mc.name = "mc_"+nv;    mc.graphics.beginFill(0x000000, 0.20);    mc.graphics.drawRect(0, 0, 100, 60);    mc.graphics.endFill();    mc.name = "mc_"+nv;    // place this new mc into array    mcArray.push(mc);}
    
    // start timer - note that timer will fire as many times as there are movie clipsvar tempo_espera:Timer = new Timer(1000, mcArray.length);tempo_espera.addEventListener(TimerEvent.TIMER, placeClip);tempo_espera.start();
    // the clip you will apply transition tovar currentClip:MovieClip;
    // function that places clipsfunction placeClip(e:TimerEvent):void {    trace("placeClip: currentCount = " + tempo_espera.currentCount);    // get next clip by calling movie that corresponds with the timer counter    currentClip = MovieClip(mcArray[tempo_espera.currentCount - 1]);    // just place next clip    holder.addChild(currentClip);    var animacao:TransitionManager = new TransitionManager(currentClip);    animacao.startTransition({type:Zoom, direction:Transition.IN, easing :Elastic.easeOut, duration:3});}
    
  • Error message: your browser must have Java enabled to use the Client for Java when you try to access the Citrix server.

    Original title: java question.

    I'm trying to access the Citrix server to access my work server.  When I click on an application, I get an error message: your browser must have Java enabled to use the Client for Java.  I checked and the right version of Java installed and removed the old Java applications but still this message when trying to access Citrix.  Please meet w / directions for a fix.

    Start by seeing if Java has been installed correctly:

    http://www.Java.com/en/download/testjava.jsp

    or
    http://javatester.org/

  • Configurator error 'the hard size in the first string of RAID must be smaller than the drive selected in the second Raid channel'

    Hello, I hope this is the forum for this question rigth.

    I am trying to set up a new T330 for one of our customers, and I want to use a Raid 1 + Raid 1 configuration. First raid for the operating system and daily backups, second raid for a database.

    I tried the C15c configuration, but I always get the error "the size of the hard drive in the first RAID channel must be smaller than the selected hard drive in the second Raid channel".

    Is it really necessary to buy an SSD that is bigger than the HD used in the first Raid? The DSS may be relatively low, but I need more space for the backup.

    Is there an alternative solution to this?

    Thanks in advance,

    Stefan

    Yes. In fact, you can mix drive types on the SAME channel... they just cannot be mixed in the same virtual disk (table).

  • Microsoft SQL Server 2014 (SP1 - CU4) (KB3106660) query failed with error ORDER BY items must appear in the select list if SELECT DISTINCT is specified.

    Hello
    I use Microsoft SQL Server 2014 (SP1 - CU4) (KB3106660) Enterprise Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1)

    SELECT DISTINCT A.PI_LOOKUP_CATEGORY_ID,
    REPLACE (REPLACE (UPPER (A.LOOKUP_CATEGORY_NAME), ' ', '_'), '-', '_') AS CATEGORY_TECH_NAME,
    A.LOOKUP_CATEGORY_NAME,
    A.LOOKUP_CATEGORY_DESCR,
    COUNT (B.PI_LOOKUP_CATEGORY_ID) AS USAGE_COUNT
    FROM [PI_LOOKUP_CATEGORY] A LEFT OUTER JOIN B [PI_INSIGHT_COLUMN] WE
    A.PI_LOOKUP_CATEGORY_ID = B.PI_LOOKUP_CATEGORY_ID
    A.PI_LOOKUP_CATEGORY_ID GROUP,
    REPLACE (REPLACE (UPPER (A.LOOKUP_CATEGORY_NAME), ' ', '_'), '-', '_').
    A.LOOKUP_CATEGORY_NAME,
    A.LOOKUP_CATEGORY_DESCR
    ORDER TO REPLACE (REPLACE (UPPER (A.LOOKUP_CATEGORY_NAME), ' ', '_'), '-', '_')

    above request is failed with error ' ORDER BY items must appear in the select list if SELECT DISTINCT is specified. " Microsoft SQL Server (SP1 - CU4) 2014 (KB3106660)

    same query works fine with older versions of SQL servers like (2008R2, or 2012)

    Please let me know the resolution of this problem...

    Thank you
    Touria

    Ask here:

    MSDN - SQL Server - Microsoft forums

  • Start testapp error "Module: TestApp-1" must be signed with the Runtime RIM signing key code

    Hi all

    Help me please

    I signed my code files with the signign provided blackberry (RRT, CPR, RBB) keys. When I download my application via OTA in my camera, and when I run my application it shows an error like "start Testapp error: ' Module: TestApp-1" must be signed with the Runtime RIM signing key code ".so I signed my application code files, when I opened TestApp-1 to sign it indicates"no signature required"."

    Please anyone suggest me.

    Thank you

    Ashutosh

    I think that JDE currupted. When I compile it with different JDE, he executed well.

    Thank you all to share your experiencewith me.

  • ERROR: The target system must be running a 32 bit OS. When you try to open files

    Original title: Openfiles.exe

    Hello

    I am trying to identify the files opened using the command WIndows Openfiles.exe. But I get an error message "ERROR: the target system must be running a 32 bit OS.»

    I would like to understand why this error and how to get out of this.

    I understand that because of the 64-bit computer, even if it's a 64-bit machine as it should work.

    Kind regards

    Francis Amalanathan Duraisamy

    Hey Francois,.

    The question you posted would be better suited in the TechNet Forums. I would recommend posting your query in the TechNet Forums.

    http://social.technet.Microsoft.com/forums/Windows/en-us/home

  • Opatch error: the patch directory field must be a number.

    Hello Sir,

    I try to upgrade EBS 11i to R12, I come to this place of the document

    ·          SQL> shutdown immediate;

    · 27 apply additional 11.2.0.4 RDBMS patches

    when I apply patch 17468141 ,

    I had this error patch area directory must be a number, but I apply patches a lot before I do not had this error.

    So please help me out in this matter.

    Thank you

    Ahmed.

    Hello

    If you want to upgrade the database 11g and the application of R12 in the same window of downtime, then do not follow the document ID 881505.1 and rather follow Doc ID 1058763.1.

    If you want to upgrade to 11g and stay on 11i for awhile, you can then follow the document 881505.1. Patching must be performed while the application is down.

    The examples CD is in 6 of the fix 13390677file. When you click Download, you will get a list of 7 files.

    Download files 1,2 and 6 only.

    Download OPatch step by step:

    1. Go to the download of patches
    2. Type the patch # 6880880
    3. Enter your platform (x 86 Linux, for example)
    4. Look for a patch with the description "hotfix version 11.2.0.3.10 of Oracle software OPatch publishes 11.2.0.x (April 2015).
    5. Download the patch
    6. Unzip the file into the 11.2.0.4 oracle home (unzip qo - p6880880_112000_LINUX.zip d $ORACLE_HOME)
    7. Check the version (version opatch)

    Kind regards

    Bashar

Maybe you are looking for