Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Removing Movieclips from an Array Displayed on stage

Guest
Nov 04, 2014 Nov 04, 2014

Hi Everyone ,

I am new to AS3 so please forgive me in advance if I end up annoying anyone ;(

I need some help in removing Movie Clips from the stage , these were initially loaded off an array

Here is the Code with the NEXT Button , : for both ARRAYS , Notes and Notes15 ( referring to 15th frame)

function nextframepop2(Event:MouseEvent):void{

trace("Mouse Enabled");

removeChild(notes15[4]);

removeChild(notes15[3]);

removeChild(notes15[2]);

removeChild(notes15[1]);

removeChild(notes15[0]);

nextFrame();

function nextframepop1(Event:MouseEvent):void{

trace("Mouse Enabled");

removeChild(notes[1]); // This is Line 635 , but I am not sure what I am doing wrong here.

removeChild(notes[0]);

nextFrame();

}

I am calling this Function with an If Statement , I need to make sure all the Movie Clips are loaded before the End User decides to move to next slide.

Here is what I get when I run the Next Button ,

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

at flash.display::DisplayObjectContainer/removeChild()

at PORTDemoPresent_fla::MainTimeline/nextframepop1()[PORTDemoPresent_fla.MainTimeline::frame2:635]

Can anyone please help ?

TOPICS
ActionScript
236
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 05, 2014 Nov 05, 2014

Based on what you show it is likely that some other function (like the one before it as shown) has already removed the object.  What you should do is learn to use the trace function to troubleshoot your code.  In this case put in a trace anywhere you add or remove the same object that tells you whether it is added or removed and which line of code it is, realizing that you might be storing the same object with different references to it.  That way you should be able to isolate where things are being removed when you don't expect them to be.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 05, 2014 Nov 05, 2014
LATEST

Thank you so much Ned for your guidance all the way  - I am trying Trace method on various Locations will try to fix it myself , in case I run in to any troubles , I will discuss with you.

Thanks once again.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines