-
1. Re: How to remove xml loaded jpgs on EXIT_FRAME?
kglad Dec 22, 2012 5:21 AM (in response to nikolaig)in the ide, add a movieclip (with no content or with its visible property assigned to false) to the frame where you add your image scroller and assign it an instance name (eg, dummy_mc). make sure it exists in no other frame except the one that contains your image scroller code.
you can then use:
dummy_mc.addEventListener(Event.REMOVED_FROM_STAGE,removeScrollerF);
and change your removeScrollerF code from:
function removeScrollerF():void{
//whatever
}
to:
function removeScrollerF(e:Event=null):void{
//whatever
}
-
2. Re: How to remove xml loaded jpgs on EXIT_FRAME?
nikolaig Dec 22, 2012 8:37 AM (in response to kglad)Unfortunately the code came back with an argument error like this:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
this error references this line in the code:
removeChild(scroller);
Here is my full set up:
dummy_mc.visible = false;
function removeScrollerFF(e:Event=null):void{
if(scroller){//prevents a problem if you were to use the same navigation code after the scroller is removed
scroller.removeEventListener(Event.ENTER_FRAME, moveScrollerThumbs);
removeChild(scroller);
scroller=null; // if, when you want to re-create your scroller, it fails to be re-created, remove this line of code.
}
}
dummy_mc.addEventListener(Event.REMOVED_FROM_STAGE,removeScrollerFF);
-
3. Re: How to remove xml loaded jpgs on EXIT_FRAME?
kglad Dec 22, 2012 9:54 AM (in response to nikolaig)the movieclip need to be added to the keyframe that contains your code that adds the scroller.
-
4. Re: How to remove xml loaded jpgs on EXIT_FRAME?
nikolaig Dec 22, 2012 12:22 PM (in response to kglad)It doesn't work.
I guess again I am missing something basic.
Here is my set up:
My flash site is segmented into several labeled sections. Each section is at 10 frames long, so I can read what it is titled and know where I am on the main time frame. Each section is separated by a keyframe, i.e. at each tenth frame I inserted a keyframe, and then another one after next ten frames. AS3 layer mimics the same segmentation. In case with the scroller - it is located on frames 80-90 and section is labeled "AppPopUps". There is a key frame on frame 80 marking the begining of the section labeled "AppPopUps" and a keyframe on the frame 90 marking the beginning of the next section with other page. Keyframes are also inserted at 80 and 90 count on AS3 layer and layer with visual elements.
So my symbol with little "a" for AS3 on AS3 layer is on frame 80, and layer with visual elements starts at frame 80. All of the layers segmented by the keyframe on frame 90. After frame 90 there is another code and another group of visual elements for the next page.
For argument sake I seperated the AS3 layer into one singular keyframe and made another layer underneath it with a singular keyframe which contains dummy_mc.
That makes the code and the movieclip to be on the same keyframe?
What else can I try?
-
5. Re: How to remove xml loaded jpgs on EXIT_FRAME?
kglad Dec 22, 2012 11:29 PM (in response to nikolaig)there's a typo in your code. your code should match my code (removeScrollerF is not the same as removeScrollerFF)
if it does match and if dummy_mc does NOT exist on the frames where you want the scroller removed, the code will work.
-
6. Re: How to remove xml loaded jpgs on EXIT_FRAME?
nikolaig Dec 23, 2012 12:43 AM (in response to kglad)I put an extra "F" to differentiate between the two methods. One on click and another one on the removed from stage.
I thought as long as I reference the function correctly I could change the code? In any case I changed it to one "F", the "dummy_mc" exists only on the frames with the scroller and not on the frames where I want the scroller to be removed. It still throughs this error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
which refers to this line in the code: "removeChild(scroller);"
Here is the code in its entirety, did I miss anything? I deleted all the previus set up, this is the only thing I have for removing the scroller:
dummy_mc.visible = false;
function removeScrollerF(e:Event=null):void{
if(scroller){//prevents a problem if you were to use the same navigation code after the scroller is removed
scroller.removeEventListener(Event.ENTER_FRAME, moveScrollerThumbs);
removeChild(scroller);
scroller=null; // if, when you want to re-create your scroller, it fails to be re-created, remove this line of code.
}
}
dummy_mc.addEventListener(Event.REMOVED_FROM_STAGE,removeScrollerF);
-
7. Re: How to remove xml loaded jpgs on EXIT_FRAME?
kglad Dec 23, 2012 7:17 AM (in response to nikolaig)there should be only one function removeScrollerF and there should not be any buttons that call it. that code is unnecessary because of dummy_mc.
that was the only point of using dummy_mc: to avoid coding for your 75+ buttons.
if you already added code for some of their listener functions, remove the removeScrollerF calls from those listener functions.
if you want to code all your buttons, you don't need dummy_mc and the code to do that was given to you previously. if you want to code none of your buttons, use dummy_mc and remove the other calls to removeScrollerF. if you want to code some of your buttons and not code some of your buttons, explain why?
-
8. Re: How to remove xml loaded jpgs on EXIT_FRAME?
nikolaig Dec 23, 2012 6:54 PM (in response to kglad)I did not want to code any buttons at all. I put an extra F in the function description just to differentiate between the two methods you were helping me with.
There is only one function "removeScrollerF" and there are no buttons that call it. There are no other listener functions for "removeScrollerF". I want to use only "dummy_mc" to remove the scroller from stage. I still get this errror:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
what does it mean?
-
9. Re: How to remove xml loaded jpgs on EXIT_FRAME?
kglad Dec 23, 2012 11:29 PM (in response to nikolaig)copy and paste your code.
click file>publish settings>swf and tick "permit debugging". retest.
copy and paste the full error message and in your pasted code indicate the topmost line number (mentioned in the error message) triggering the error.
-
10. Re: How to remove xml loaded jpgs on EXIT_FRAME?
nikolaig Dec 25, 2012 7:37 AM (in response to kglad)I copied and pasted the code into a separate Flash file and did the testing as you suggested. Everything works perfectly and gives me no errors. Scroller is being terminated as it is supposed to when I navigate to another frame (without dummy_mc).
However, in the original flash file with many sections and pages, where scroller is a part of the complex layout I still have the errors in Output panel:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at acolyte51_AppsPopUpsThumbs_fla::mainsite_mc_2/removeScrollerF()[acolyte51_AppsPopUpsThumb s_fla.mainsite_mc_2::frame82:360]
at flash.display::MovieClip/gotoAndPlay()
at acolyte51_AppsPopUpsThumbs_fla::mainsite_mc_2/gotoFrame2()[acolyte51_AppsPopUpsThumbs_fla .mainsite_mc_2::frame82:348]
here is what on line 360:
removeChild(scroller);
here is what on line 348:
gotoAndPlay("contactus"); The above error code always comes up in combination with the navigation error on a button I used to navigate out of the page with the scroller. In other words there always be the error on line 360 and then an additinal error with navigation line gotoAndPlay depending on which button I clicked. So line number of 348 may change if I use another button to navigate out of the frames with the scroller. But the navigation related error of gotoAndPlay will come back with another error line number, indicating the code location for the button I just used.
-
11. Re: How to remove xml loaded jpgs on EXIT_FRAME?
kglad Dec 25, 2012 8:02 AM (in response to nikolaig)replace line 360 with:
if(scroller){
if(scroller.stage){
removeChild(scroller);
}
}
-
12. Re: How to remove xml loaded jpgs on EXIT_FRAME?
nikolaig Dec 25, 2012 9:20 AM (in response to kglad)I still have the same error.
Here is how the code set up looks in its entirety:
dummy_mc.visible = false;
dummy_mc.addEventListener(Event.REMOVED_FROM_STAGE, removeScrollerF);
function removeScrollerF(e:Event=null):void{
if(scroller){
if(scroller.stage){
removeChild(scroller);
}
}
}
Here is the full error description:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at acolyte51_AppsPopUpsThumbs_fla::mainsite_mc_2/removeScrollerF()[acolyte51_AppsPopUpsThumb s_fla.mainsite_mc_2::frame82:360]
at flash.display::MovieClip/gotoAndPlay()
at acolyte51_AppsPopUpsThumbs_fla::mainsite_mc_2/gotoFrame2()[acolyte51_AppsPopUpsThumbs_fla .mainsite_mc_2::frame82:348]
frame82:360 refers to the same line of code:
removeChild(scroller);
-
13. Re: How to remove xml loaded jpgs on EXIT_FRAME?
kglad Dec 25, 2012 9:23 AM (in response to nikolaig)use:
dummy_mc.visible = false;
dummy_mc.addEventListener(Event.REMOVED_FROM_STAGE, removeScrollerF);
function removeScrollerF(e:Event=null):void{
if(scroller){
if(scroller.stage){
scroller.parent.removeChild(scroller);
}
}
}
-
14. Re: How to remove xml loaded jpgs on EXIT_FRAME?
nikolaig Dec 25, 2012 11:41 AM (in response to kglad)I replaced the code, the error still reads the same:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at acolyte51_AppsPopUpsThumbs_fla::mainsite_mc_2/removeScrollerF()[acolyte51_AppsPopUpsThumb s_fla.mainsite_mc_2::frame82:360]
at flash.display::MovieClip/gotoAndPlay()
at acolyte51_AppsPopUpsThumbs_fla::mainsite_mc_2/onClick_HowTo_btn()[acolyte51_AppsPopUpsThu mbs_fla.mainsite_mc_2::frame1:663]
Line 360 refers to this line:
scroller.parent.removeChild(scroller);
---------------------------------------------
I also tried parent.parent but it did not work as well as parent.parent.parent
-
15. Re: How to remove xml loaded jpgs on EXIT_FRAME?
kglad Dec 25, 2012 11:44 AM (in response to kglad)what's displayed in the output panel using:
dummy_mc.visible = false;
dummy_mc.addEventListener(Event.REMOVED_FROM_STAGE, removeScrollerF);
function removeScrollerF(e:Event=null):void{
if(scroller){
trace(scroller);
if(scroller.stage){
trace(scroller.stage);
trace(scroller.parent);
scroller.parent.removeChild(scroller);
}
}
}
-
16. Re: How to remove xml loaded jpgs on EXIT_FRAME?
nikolaig Dec 25, 2012 11:49 AM (in response to kglad)[object MovieClip]
[object Stage]
[object mainsite_mc_2]
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at acolyte51_AppsPopUpsThumbs_fla::mainsite_mc_2/removeScrollerF()[acolyte51_AppsPopUpsThumb s_fla.mainsite_mc_2::frame82:363]
at flash.display::MovieClip/gotoAndPlay()
at acolyte51_AppsPopUpsThumbs_fla::mainsite_mc_2/onClick_HowTo_btn()[acolyte51_AppsPopUpsThu mbs_fla.mainsite_mc_2::frame1:663]


