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

}

Tags: Adobe Animate

Similar Questions

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

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

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

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

  • my Iphone 5 was automatically turned off, and then I couldn't go? What is the problem please help me?

    my Iphone 5 was automatically turned off, and then I couldn't go? What is the problem please help me?

    Have you tried to connect your iPhone to iTunes or the wall charger and let your iPhone for 5-10 minutes to charge its battery?

  • ON PAPER MESSAGEDU MY C510 SAME HP IF THERE IS ENOUGH PAPER IN THE TRAY, PLEASE HELP.

    ON PAPER MESSAGEDU MY C510 SAME HP IF THERE IS ENOUGH PAPER IN THE TRAY, PLEASE HELP.

    We recommend that you reset your C510 HP first. You can perform the reset by following the steps below:

    1. press the "Power button" to activate the product.

    2. with the product, unplug the power cord from the back of the product.

    3. disconnect the power cord from the wall outlet.

    4. wait at least 15 seconds.

    5. plug the power cord into the wall jack.

    6. reconnect the power cord to the back of the product.

    7. If the product does not light by itself, press the Power button to turn it on.

    Once done, print a self-test report by following the next steps:

    1 load plain white paper in the input tray.

    2. from the home screen on the control panel of the product, click "Menu" on the upper left side. A list of menu options screens. 3. click on "Settings" and then click on 'tools '. The maintenance of the printer menu displays.

    4. in the maintenance of the printer menu, click "Printer Status Report". The product prints the report.

    If the report is printed correctly, try again to print your original document.

    If the problem persists, you may need to check the status of documents in the status bar. To do this, follow these steps:

    1. remove the stack of paper from the status bar.

    2. check that the obstacles within the status bar. A flashlight to view the mechanism inside the status bar to make sure that nothing is blocking the paper to engage with the rollers. Even small pieces of paper can cause paper feeding problems. (Important: If any obstruction is detected in the paper path, you need to refer to "Cleaning the rollers" segment at http://h20566.www2.hp.com/portal/site/hpsc/template.PAGE/public/kb/docDisplay/?spf_p.tpst=kbDocDisplay&spf_p.prp_kbDocDisplay=wsrp-navigationalState%3DdocId%253Demr_na-c02248120-20%257CdocLocale%253D%257CcalledBy%253D&javax.portlet.begCacheTok=com.vignette.cachetoken&javax.portlet.endCacheTok=com.vignette.cachetoken)

    3. to review the status of the paper and then replace any paper torn, dusty, curled, wrinkled, or bent.

    4. ensure that all the papers in the stack are the same size and type. Never charge which coexist types of paper in the tray. The product can only process one type of paper at a time.

    5. press on the stack of paper on a flat surface to align the edges.

    6. make sure that the paper stack does not contain less than 10 and not more than 25 sheets paper.

    (Note: the limitation of the number of documents applies only during the phase of solving problems.) Once the problem is resolved, you can load the tray to its original capacity).

    Once you have checked the status of documents, reload the tray in the following way:

    1. lift output in open position and open the door of the feeder.

    2. slide the width guide to its outermost position paper.

    3. Insert the stack of paper into the paper tray with the short edge forward and the print down side.

    4. adjust the paper width guide so that it rests against the stack of paper.

    5. lower the output tray, and then close the tray door. Once this is done, print again an automatic test report by following the above steps. If this too does not resolve the issue, refer to some more solutions at HP support center link below: http://h20566.www2.hp.com/portal/site/hpsc/template.PAGE/public/kb/docDisplay/?spf_p.tpst=kbDocDisplay&spf_p.prp_kbDocDisplay=wsrp-navigationalState%3DdocId%253Demr_na-c02248120-20%257CdocLocale%253D%257CcalledBy%253D&javax.portlet.begCacheTok=com.vignette.cachetoken&javax.portlet.endCacheTok=com.vignette.cachetoken

    GuruAid.com

  • Windows95 CD-ROM - game Need for DCC Speed-No. pieces found - can not install the game - please help. ___

    Windows 95 CD-CD-ROM-game Need for DCC Speed-No. pieces found - can not install the game - please help.

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

  • put an item into the basket, made an empty recycle bin, need return the item, please help, I did nothing since the drain, so the machine is in the same condition as when I emptied

    put an item into the basket, made an empty recycle bin, need return the item, please help, I did nothing since the drain, so the machine is in the same condition as when I emptied

    If you have xp, you can do system restore

  • Lightroom stopped working would cut during use, update would not download through app cc, direct download installs, his record saying is corrupted to lose the battle, please help

    Lightroom has ceased to function and be cut during use, update wouldn't download through app cc, direct download, moved his record saying is corrupted, im losing the battle please help

    reset your preferences -: https://helpx.adobe.com/lightroom/help/setting-preferences-lightroom.html

    If this fails, uninstall and reinstall

  • The space bar has stopped working in text blocks. Iendupwithsentaceslikethis - I have reset the mac, but it is always the case please help!

    Iendupwithsentaceslikethis - I have reset the mac, but it is always the case please help!

    Latest version CC

    Richard

    Solved the problem - I just changed a Chinese document. I copied the milling guide in a new document.

  • I bought a single image, and after downloading my image always has the watermark please help.

    I bought a single image, and after downloading my image always has the watermark please help.

    Please follow the following steps

    I bought a stock image and I can't seem to upload the image under a license without the watermark? Please help

  • I'm using Dreamweaver CC and tries to install Dw CC (2014) at the first trial, but the problem come when it expired, both my installed dreamweaver has expired, and now I just enjoy the Bill every month without the product, please help me.

    I'm using Dreamweaver CC and tries to install Dw CC (2014) at the first trial, but the problem come when it expired, both my installed dreamweaver has expired, and now I just enjoy the Bill every month without the product, please help me.

    You have more than one Adobe ID and password - for creative cloud and the other for your trial period?

    Nancy O.

Maybe you are looking for