Child of the caller?

Hello everyone. Curious if someone might be able to give me a
hand. I am attaching a screen grab for you to see what I am talking
about. It has the error there to read.
So what is happening is I have buttons dynamically calling
movie clips as drop menus. Now in one of the movie clips there is a
sub menu. Now when I roll over the sub menu I get the error that is
in the screen grab. I know what the problem is, I just don't know
how to fix it. The problem is on the sub menu where I have 4
buttons. When I go to rollover the buttons that is when I get the
error. When I remove the buttons then everything is fine.
I hope someone can help.
Thanks in advance.
Kevin
Link to attachment

Hi Chester,
Sorry for taking so long to get back to you; I have
downloaded your fla and the final swf file is not giving me an
error when I mouse over the legal buttons. But the links ain't been
completed, right?
Your file is working very nicely, once you've added the
links. Sorry mate, but I am not sure why your getting the error;
maybe just maybe you might be getting a security sandbox problem.
Kind Regards,
Boxing Boom

Similar Messages

  • 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

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

    Hi All,
    I would very much appreciate any help with this.
    I am working on a flash piece that will play 4 videos, depending on the button pressed. First button will launch first video, 2nd - 2nd video and so on. Once the Video is done playing, close_btn, learn_more_btn and replay_btn appear, in addition to an ending image that is different for each of the videos( BoxLivePic, BoxSleepPic and BoxFeelPic). So - actually 4 things appear once the movie stops playing and the last image depends on which buttons was clicked...
    My issue is, when I click the close button( andI'm sure same will 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 that it's because each Picture is not actually added to the display list, unless the proper button was clicked.. however, I don't know how to fix that! I hope this makes some sence - Below is all of my Code... Thanks a bunch in advance:
    import com.greensock.*;
    import com.greensock.easing.*;
    import com.greensock.easing.CustomEase;
    import com.greensock.loading.VideoLoader;
    import flash.display.Sprite;
    import com.greensock.events.LoaderEvent;
    import flash.display.MovieClip;
    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:this,
                                                x:0, y:0});
    var Video_Live:VideoLoader = new VideoLoader("Live_Video.f4v",{conainer:this,
                                                 x:0, y:0});
    var Video_Sleep:VideoLoader = new VideoLoader("Sleep_Video.f4v",{conainer:this,
                                                 x:0, y:0});
    var Video_Feel:VideoLoader = new VideoLoader("Feel_Video.f4v",{conainer:this,
                                                 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);
    //Buttons Invisible
    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 Eases
    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")});
        //Show 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);
    //Event Listeners for Playing Video
    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 Close Video
    close_btn.addEventListener(MouseEvent.MOUSE_DOWN, closeVideo);
    //Functions for VIDEO and LEARN MORE buttons
        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);
    // Last Breathe Buttons Added to 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 Live 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;
    //Last Feel 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 Breathe
    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});
        //Close Live
        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 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});
        //Close Feel
        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});
        //Show Pic
        TweenLite.to(pic_breathe_mc, .5, {alpha:1});
        //Hide Other Pics
        TweenLite.to(pic_live_mc, .5, {alpha:0});
        TweenLite.to(pic_sleep_mc, .5, {alpha:0});
        TweenLite.to(pic_feel_mc, .5, {alpha:0});
        //Show Text
        TweenLite.to(breathe_txt_mc, 1,{alpha:1});
        //Hide Other Text
        TweenLite.to(live_txt_mc, 1,{alpha:0});
        TweenLite.to(sleep_txt_mc, 1,{alpha:0});
        TweenLite.to(feel_txt_mc, 1,{alpha:0});
    // Functions live
    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 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 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});
        //Close Feel
        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});
        //Show Pic
        TweenLite.to(pic_live_mc, .5, {alpha:1});
        //Hide Other Pics
        TweenLite.to(pic_sleep_mc, .5, {alpha:0});
        TweenLite.to(pic_feel_mc, .5, {alpha:0});
        //Show Text
        TweenLite.to(live_txt_mc, 1,{alpha:1});
        //Hide Other Text
        TweenLite.to(breathe_txt_mc, 1,{alpha:0});
        TweenLite.to(sleep_txt_mc, 1,{alpha:0});
        TweenLite.to(feel_txt_mc, 1,{alpha:0});
    // Functions sleep
    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 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 Live
        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 Feel
        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});
        //Show Pic
        TweenLite.to(pic_sleep_mc, .5, {alpha:1});
        //Hide Other Pics
        TweenLite.to(pic_feel_mc, .5, {alpha:0});
        //Show Text
        TweenLite.to(sleep_txt_mc, 1,{alpha:1});
        //Hide Other Text
        TweenLite.to(live_txt_mc, 1,{alpha:0});
        TweenLite.to(breathe_txt_mc, 1,{alpha:0});
        TweenLite.to(feel_txt_mc, 1,{alpha:0});
    // Functions feel
    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 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 Live
        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 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});
        //Show Pic
        TweenLite.to(pic_feel_mc, .5, {alpha:1});
        //Show Text
        TweenLite.to(feel_txt_mc, 1,{alpha:1});
        //Hide Other Text
        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 display list that (object) is not there.
    For example, if close_btn instance is not added as child, the following line will throw this error:
    removeChild(close_btn);
    One of the ways to remedy this is to confirm that the object is added:
    if(contains(close_btn)) removeChild(close_btn);

  • Cannot remove display object: must be child of the caller

    ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/removeChild()
    at working_loader_container3_fla::MainTimeline/frame4()
    at flash.display::MovieClip/prevFrame()
    I have been getting this error after a bunch of different ways of trying this.  I am attempting to create a new instance of my movieclip which displays external images via xml. I want a new instance of the movieclip every other frame and need to be able to remove each instance on every other frame.  It will work going forwards, with a remove child call but as soon as I go back a frame, the error pops up.
    I tried using an if statement, but to no avail.
    I have attched an extremely rudimentary example of my issue, any help would be appreciated. The problem is best illustrated at frame 4 layer 2.

    Thanks for the help.  I finally got it to work. Below is what I put on the top layer.  I called the addChild() method after creating a new instance of my MovieClip class on each frame I wanted the images to appear on the second layer. Not the most elegant of solutions but worked.  (I'm a rookie.)
    next_btn.addEventListener(MouseEvent.CLICK, goNext);
    back_btn.addEventListener(MouseEvent.CLICK, goBack);
    function goNext(event:MouseEvent):void {
    nextFrame();
    if(currentFrame == 2)
    removeChild(container_mc);
    if(currentFrame == 4)
    removeChild(container_mc3);
    function goBack(event:MouseEvent):void {
    if(currentFrame == 3)
    removeChild(container_mc3);
    if(currentFrame == 5)
    removeChild(container_mc5);
    prevFrame();

  • Unexplainable exception:  "The supplied DisplayObject must be a child of the caller"

    What am I missing in the following code?  How is the indicated exception possible?  It seems to me that it simply "can't happen", yet it reliably does.
    I'm checking to see if a component is a child of "this", and if it is, I attempt to remove that child.  The remove faults.  Any thoughts?
                if (tf != null && this.contains(tf) == true)
                    this.removeChild(tf);   // Generates exception "The supplied DisplayObject must be a child of the caller"
                    tf=null;

    Check out the documentation for contains().  I suspect that tf isn't actually a child of this, but rather a grand child, or great grand child, ... .

  • DisplayObject must be a child of the caller.

    I am trying to remove the existing childs  (combobox and pods are the content in the page) using
    viewStack.selectedChild.removeAllChildren();
    in a tab click from the Viewstacks canvas.
    then I am trying to add new child.
    it gives this error.
    The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/getChildIndex()
    at mx.core::Container/setChildIndex()[C:\autobuild\3.2.0\frameworks\projects\framework\src\m x\core\Container.as:2449]
    Please help me to fix this

    private function onApplicationComplete():void{
    var arrView:Array =new Array();arrView=viewStack.getChildren();
    viewLength=arrView.length;
    // Load pods.xml, which contains the pod layout. 
    var httpService:HTTPService = new HTTPService();httpService.url =
    "data/pods.xml";httpService.resultFormat =
    "e4x";httpService.addEventListener(FaultEvent.FAULT, onFaultHttpService);
    httpService.addEventListener(ResultEvent.RESULT, onResultHttpService);
    httpService.send();
    private function onFaultHttpService(e:FaultEvent):void{
    Alert.show(
    "Unable to load data/pods.xml.");}
    public var viewXMLList:XMLList =new XMLList(); 
    private function onResultHttpService(e:ResultEvent):void{
    viewXMLList = e.result.view;
    var podcontentbase:PodContentBase=new PodContentBase; 
    var containerWindowManagerHash:Object = new Object();  
    var len:Number = viewXMLList.length(); 
    if (podLayoutManagers.length!=0)podLayoutManagers.splice(0,podLayoutManagers.length);
    for (var i:Number = 0; i < len; i++) // Loop through the view nodes.{
    // Create a canvas for each view node. 
    var canvas:Canvas = new Canvas(); 
    // PodLayoutManager handles resize and should prevent the need for 
    // scroll bars so turn them off so they aren't visible during resizes.canvas.horizontalScrollPolicy =
    "off";canvas.verticalScrollPolicy =
    "off";canvas.label = viewXMLList[i].@label;
    canvas.percentWidth = 100;
    canvas.percentHeight = 100;
    viewStack.addChild(canvas);
    traceDL(viewStack);
    // Create a manager for each view. 
    var manager:PodLayoutManager = new PodLayoutManager();manager.container = canvas;
    manager.id = viewXMLList[i].@id;
    manager.addEventListener(LayoutChangeEvent.UPDATE, StateManager.setPodLayout);
    // Store the pod xml data. Used when view is first made visible.podDataDictionary[manager] = viewXMLList[i].pod;
    //podcontentbase.podDataDictionarycopy[manager] = viewXMLList[i].pod; 
    podLayoutManagers.push(manager);
    onchange();
    private function onchange():void{
    tabBar.dataProvider=viewStack;
    var index:Number = StateManager.getViewIndex(); 
    // Make sure the index is not out of range. 
    // This can happen if a tab view was saved but then tabs were subsequently removed from the XML.index = Math.min(tabBar.numChildren - 1, index);
    onItemClickTabBar(
    new ItemClickEvent(ItemClickEvent.ITEM_CLICK, false, false, null, index));tabBar.selectedIndex = index;
    private var indextab:Number; 
    private function onItemClickTabBar(e:ItemClickEvent):void{
    indextab = e.index;
    StateManager.setViewIndex(indextab);
    // Save the view index.viewStack.selectedIndex = indextab;
    if( this.contains( viewStack.selectedChild) )viewStack.selectedChild.removeAllChildren();
    traceDL(
    this);

  • Error #2025:The supplied DisplayObject must be a child of the caller - Removing Object from Array

    Hi guys, I'm pretty new to as3 and I'm trying to make a game where the player supposedly clicks on the stage and 3 towers which I've spawned dynamically should shoot towards the area. Everything works in terms of tower rotation, etc, but the bullets will not be removed from the stage when I exit the level into another scene. The boundary checking is fine, too.
    Here's 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, which basically, as the name states, exits the level when a button is clicked. It worked perfectly before I started 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 says the error is at the end, where i try to remove the child from the stage. What is wrong? Sorry, I'm a beginner at as3 so any answers might have to be spoonfeeding... I'll try to learn and understand, though. Thanks!
    I did take some of the code off of a guide on the web, and I don't understand it totally, so can someone explain to me what this code does as well? What is e.currentTarget? Thanks!
    var newLaser1:MovieClip = e.currentTarget as MovieClip;
    Here's the full .as file if anybody wants to take a look. http://pastebin.com/5ff4BQa5

    Hi, I managed to solve the errors (kind of) by using this code.
    for (var i:int = tower1BulletArray.length - 1; i >= 0; i--)
    if (tower1BulletArray.parent)
    tower1BulletArray[l].parent.removeChild(tower1BulletArray[l]);
    tower1BulletArray.splice(i, 1);
    However, the problem still persists that the bullets stay in the screen after I change the scene. Any solution? Thanks!

  • Error 2050 with Menu and States - DisplayObject must be a child of the caller.

    Hi,
    I'm starting an application using States and a main Menu and
    when you click on the menu Item it changes the currentState.
    I was doing fine until I wanted to dock the Menu using an
    ApplicationControlBar.
    You can see the error message:
    http://dev2003.greatkingcasino.com/flex/casinomanagement.html
    My Idea is have always the menu on top and use States for
    each one of the menuItems. How can be done?
    Thanks,
    Paul
    Code:
    AS File:
    // MENU PERMISSIONS
    private function initApp():void
    dsData.send();
    }//initApp
    private function onResultMenuData(oEvent:ResultEvent):void
    xlcMenuData = new
    XMLListCollection(oEvent.result.children());
    private function menuHandler(oEvent:MenuEvent):void {
    currentState = oEvent.item.@label;
    MXML File:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="initApp()" currentState="navigation">
    <mx:Script source="functions.as"/>
    <mx:states>
    <mx:State name="logIn">
    blah
    </mx:State>
    <mx:State name="navigation">
    <mx:SetProperty name="layout" value="absolute"/>
    <mx:AddChild position="lastChild">
    <mx:ApplicationControlBar dock="true">
    <mx:MenuBar x="0" y="0"
    dataProvider="{xlcMenuData}"
    labelField="@label"
    itemClick="menuHandler(event);">
    </mx:MenuBar>
    </mx:ApplicationControlBar>
    </mx:AddChild>
    </mx:State>
    <mx:State name="Customer Detail" basedOn="navigation">
    <mx:AddChild position="lastChild">
    <mx:Panel x="0" y="111" width="464" height="247"
    layout="absolute" title="General Information">
    </mx:Panel>
    </mx:AddChild>
    <mx:AddChild position="lastChild">
    <mx:Panel x="472" y="111" width="350" height="530"
    layout="absolute" title="Customer Information">
    <mx:Form x="0" y="0" width="310" height="100%">
    </mx:Form>
    <mx:ControlBar>
    <mx:Button label="Update Information"/>
    </mx:ControlBar>
    </mx:Panel>
    </mx:AddChild>
    <mx:AddChild position="lastChild">
    <mx:Panel x="0" y="366" width="300" height="247"
    layout="absolute" title="Login Information">
    </mx:Panel>
    </mx:AddChild>
    <mx:AddChild position="lastChild">
    <mx:Label text="User Name" x="347" y="59"/>
    </mx:AddChild>
    <mx:AddChild position="lastChild">
    <mx:TextInput id="idCustomerID" text="1" x="421"
    y="57"/>
    </mx:AddChild>
    <mx:AddChild position="lastChild">
    <mx:Button label="Search"
    click="netService.GetCustomerDetails(idCustomerID.text);" x="589"
    y="57"/>
    </mx:AddChild>
    </mx:State>
    <mx:State name="Player Stats" basedOn="navigation">
    <mx:AddChild position="lastChild">
    <mx:Canvas label="Canvas 1" width="260"
    backgroundColor="#e2e2e2" id="canvas6" height="580" y="61">
    <mx:DateChooser x="10" y="66" id="datechooser1"/>
    <mx:DateChooser x="10" y="290" id="datechooser2"/>
    <mx:Button x="185" y="10" label="Search"
    id="button1"/>
    <mx:NumericStepper x="192" y="92" id="iniHour1" value="0"
    minimum="0" maximum="23"/>
    <mx:NumericStepper x="192" y="148" id="iniMinute1"
    value="0" minimum="0" maximum="59"/>
    <mx:Label x="10" y="40" text="Start Date"
    fontWeight="bold" id="label1"/>
    <mx:Label x="10" y="264" text="End Date"
    fontWeight="bold" id="label2"/>
    <mx:Label x="192" y="66" text="Hour" id="label3"/>
    <mx:Label x="192" y="122" text="Minute" id="label4"/>
    <mx:NumericStepper x="192" y="204" id="iniSecond1"
    value="0" minimum="0" maximum="0"/>
    <mx:Label x="192" y="178" text="Second" id="label5"/>
    <mx:NumericStepper x="192" y="316" id="endHour1"
    value="23" minimum="0" maximum="23"/>
    <mx:NumericStepper x="192" y="372" id="endMinute1"
    value="59" minimum="0" maximum="59"/>
    <mx:Label x="192" y="290" text="Hour" id="label6"/>
    <mx:Label x="192" y="346" text="Minute" id="label7"/>
    <mx:NumericStepper x="192" y="428" id="endSecond1"
    value="59" minimum="59" maximum="59"/>
    <mx:Label x="192" y="402" text="Second" id="label8"/>
    </mx:Canvas>
    </mx:AddChild>
    <mx:AddChild position="lastChild">
    <mx:Canvas label="Canvas 2" width="486"
    backgroundColor="#e2e2e2" id="canvas7" height="1200" x="268"
    y="61">
    <mx:DataGrid x="10" y="10" width="402" height="100%"
    id="datagrid1">
    <mx:columns>
    <mx:DataGridColumn headerText="Player"
    dataField="col1"/>
    <mx:DataGridColumn headerText="Risk"
    dataField="col2"/>
    <mx:DataGridColumn headerText="Win" dataField="col3"/>
    <mx:DataGridColumn headerText="Casino win"
    dataField="col1"/>
    <mx:DataGridColumn headerText="Percent (%)"
    dataField="col2"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Canvas>
    </mx:AddChild>
    </mx:State>
    <mx:State name="Casino Usage" basedOn="navigation">
    </mx:State>
    </mx:states>
    <mx:HTTPService id="dsData" url="MenuData.xml"
    resultFormat="e4x" result="onResultMenuData(event)"/>
    </mx:Application>
    Text

    try{
    catch(error:Error){
    finally{
    (look up error handling in documentation)

  • FindChildIndex cannot find the child with the given itemName

    Hi,
    I am getting error " findChildIndex cannot find the child with the given itemName" when runs the page from jdeveloper.
    I didnt use findChildIndex in my CO or AM.
    Please help me to resolve it.
    Thanks
    Amit Jaitly

    Amit
    Check old threads
    Re: how to call concurrent programs from oaf page
    http://forums.oracle.com/forums/search.jspa?threadID=&q=findChildIndex+cannot+find+the+child+with+the+given+itemName&objID=f210&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks
    AJ

  • Call_form dims the calling form

    My users are on a form and want to call a second form.. but then want to view both simultaneously.
    The calling form goes into dim mode.
    How do I keep the called and calling form both at "full visual strength"?

    Form A calls or opens From B
    using open form leave Form A un-dimmed but creates other problems - Form B is not able to open a further child Form.
    is there any way to control the color/density of the Form A when calling B so that it still is visible and printable? I would like to put them side by side and have then print with same quality.

  • Capturing the caller object

    I used to be doing like this:
    myTextObj.addCaretListener(new MyCustomCaretListener(myTextObj, ..., ...));because the constructor can't access the event and its source object. But current project has so many of these types of calls. Is there a way by which the constructor could automatically access the caller or registerer object? This is not a Swing question, but a more general one I suppose.

    There are a couple of ways. I agree with the last poster, an explanation of why you need this might lead to more helpful suggestions.
    1 - Use a Factory object. Assuming you are passing the same parent to multiple children, you could create a Factory object that takes the parent in its constructor. this object would then have methods to create the children and pass the parent as part of the parameters to child constructor.
    2 - Use inner classes which have a hidden parent in them.
    public class Outter {
         private String name;
         public Outter(String name) {
              this.name = name;
         public String getName() {
              return name;
         class Inner {
                     // The hidden parent
              Outter getParent() {
                   return Outter.this;
         public static void main(String[] args) {
              Outter outer = new Outter("Fred");
              Inner inner = outer.new Inner();
              System.out.println("Outter:" + outer.getName() +
                                     " Inner:" + inner.getParent().getName());
    } Both these suggestions, while workable, should be examined in the context of your project. It would be very easy to make the code less readable or just plain wrong, by using either of these techniques.
    Edited by: m0smith on Oct 10, 2007 9:27 PM

  • Using a variable in the call scenario

    I´m using ODI 10.1.3.6.8.
    I´m calling the scenario as follows:
    ./startscen CENARIO_PRINCIPAL 001 GLOBAL -v=5 GLOBAL.EVENTO=12345
    This is my CENARIO_PRINCIPAL within it calls two scenarios using the global variable GLOBAL.EVENTO.
    When I ran, appears the following error:
    "java.lang.Exception: Specified variable not found in the Repository: GLOBAL.EVENTO"
    I tried to create a step in CENARIO_PRINCIPAL, declaring GLOBAL.EVENTO (this variable is set to the most recent value).
    I ran the scenario again and appears no error, but the variable did not receive the value specified on the "./startscen CENARIO_PRINCIPAL 001 GLOBAL -v=5 GLOBAL.EVENTO=12345" .
    Can anyone help me?

    As I said, I declared the variable in CENÁRIO_PRINCIPAL and ran.
    But the variable GLOBAL.EVENTO not received the amount that I reported the call of the stage was GLOBAL.EVENTO = 12345.
    Remembering that this variable is being used within the scenarios that are executed within the CENARIO_PRINCIPAL.

  • How can I make a control inside a loop in a subVI change value when the calling VI's control changes?

    Hi.
    I think this is a pretty basic LV question, but I have not been able to find a good solution.
    I am attaching VIs that show the problem I am having, but obviously, the real application is a lot complicated, which forces me to try to do it this way.
    The issue is: I have a subVI with a Boolean control inside a loop.  When the control is true I want some action to take place.  When the subVI is run on its own, it works fine, acting properly when I set the boolean control to true via the LV FPGA interface from the host.  However, when I use it as a subVI, in which the top-level VI calls several instances of the subVI, I have the Boolean controls in the top level VI.  What is happening is that the false Boolean value with which the top-level VI starts is passed into the subVIs, and not updated, even though the control is inside the loop.
    Can any one suggest a good solution?
    Thanks,
    AlejandroZ
    Attachments:
    CallingVI.vi ‏7 KB
    subVI.vi ‏8 KB

    Hi.
    I know the example I posted might seem silly, but it was just to illustrate the problem I am having.  In reality this is the application:
    I have some LV FPGA code which uses a few FPGA IO to implement a serial link to communicate with a device.  Most of the time we are getting data from the device, so the serial link is used to send a read command, read in the data and put it into a FIFO.  However, I also wanted the VI to support sending data to the device, so I added an array control to put the data you want to send, and a boolean control to tell it you want to send it.
    Since sending and receiving data are done using the same FPGA IO, they cannot be independent operations, because they would garble each other. Therefore, in the subVI I have a loop in which I first read data if there is any to read, then check the boolean write control to see if there is data to write.
    As I mentioned, this works perfectly for talking to a single device.  However, we run into the issue of this topic when trying to replicate this for several devices.
    One easy solution is to not have the loop in the subVI, and have it in the calling VI (I am favoring this simple solution right now).  The only reason why I have not done this yet, is that the subVI has more than one loop, so I am going to have to create several subVIs.  I just posted to see if there was an even simpler solution...
    There have been some other possibly good solutions proposed here, though I am not sure if they work in LV FPGA.
    Thanks for all your responses.
    AlejandroZ

  • My iphone 4S has problem in making and receiving the calls. While making the call , call fails and netwrok disappears. Like wise no voice is heard for incoming calls. This happened after return from the overseas travel.

    My iphone 4S has problem in making and receiving the calls. While making the call , call fails and netwrok disappears. Like wise no voice is heard for incoming calls. This happened after return from the overseas travel.

    Hello SamSax
    Check out the assist page below for troubleshooting call connectivity.
    Calls and connection issues
    http://www.apple.com/support/iphone/assistant/calls/
    Thanks for using Apple Support Communities.
    Regards,
    -Norm G.

  • Cisco Unity 7: Voice mail cann't get the name or Number phone of the caller

    Hi,
    I have installed Cisco Unity Messaging Unified version 7 and integrated with Exchange 2010.
    I have two scenario, and I want to know if are normal or not:
    1.       If the 2 IP phones are subscribed with Cisco Unity: the first IP phone call the other IP phone and let a voice mail. When the second IP phone check his message vocal it can get the name of the caller or his number phone (the message is: You have One message from XXXX) and he get e-mail as objet: Voice Mail from XXXX.
    2.       If one IP phone is not subscriber with cisco unity call other Ip phone subscribed with cisco unity and let him a voice mail. The second IP phone when check his message vocal it can’t get the name of the caller or his number phone: The message is: You have one voice mail xxxx; without indicate from!! and he get a e-mail as object: Voice mail from Unknown.
    Please, I want to know if the second scenario is normal ? if not, who to resolve this problem? I want that he indicate the number of caller same he isn't subscriber with cisco unity?
    Thanks a lot,
    Best regards,
    Omar YUNSI

    So for the 2nd scenerio you would want to check what your Message Subjects were set to.  For Unity 7 open Web SA, click Configuration and then Message Subjects.  Make sure that the Outside Caller Message has %CALLERID% in it somewhere.  The value %CALLERNAME% will return unknown if we do not receive a name from the PSTN.
    Try setting the Outside Caller Message to:
    %U% %P% Voice Message from %CALLERID%
    and that should get you your desired results.
    The default Message subject is:
    %U% %P% Voice Message from %CALLERNAME% (%CALLERID%).  So with that it would say Voice Message fom Unknown (xxxx) if it was not able to determine the name of the user which is usually normal from a PSTN call.
    Just to note, the From address is always going to say from Unity Messaging System, it will only be the subject that has the extension in it.
    Bryan

Maybe you are looking for

  • Read-Only Problem during Boot

    Hi, I tried to update my system today, like every week, with the standard command pacman -Syu. After installing all updates, my window manager (gnome3) crashed and i tried to restart my System. After the grub window appeared and I choosed my kernel t

  • SIMPLE APEX PRINTING IN 4.0

    Question: Using APEX 4.0 I am finding that I am having a world of hurt trying to get very BASIC printing setup. I am not using BI and do not need PDF or RFT formats. Essentially, I would like to be able to create Interactive reports that do three thi

  • Missing conditions in my query

    Hi all I am trying to develop custom report Following are the columns which I required while running the query its showing incorrect data and duplicates too Not sure where I am missing Pls suggest me whether the conditions which I gave are correct or

  • I need to download iMac 12,1 windows 7 compatibility software, because i can't get it from boot camp 4.0, please!!

    When im trying to download the compatibility software for window 7 from boot camp 4.0 appears an error  and the download could not finish. I need to download the compatiblity software or driver for windows 7 from somewhere.......

  • Quantity based pricing

    Hi ! We have a requirement where we require the price to be determined based on certain qty in the sales order. For example for a material, 1. For 100 nos price to be determined  - Rs 50 (per unit price) 2. For 200 nos price to be determined - Rs 25