dcsimg
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: ArgumentError: Error #2025:...HELP!!

  1. #1
    Junior Member
    Join Date
    May 2008
    Posts
    17

    ArgumentError: Error #2025:...HELP!!

    I have searched, searched, and....searched for a solution and just about stayed up all night dealing with this. So this is my last resort.

    I have a navigation which has 5 buttons and each loads a different external SWF. There is a simple transition created with the Caurina Tween's that takes place before the current SWF is removed (unloaded) and the next is loaded. However, the past external SWF does not seem to be unloading, and they just stack up everytime the button is pressed. I am also getting this error everytime the script gets to the loader.unload(); action.
    Code:
    ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    	at flash.display::Loader/unload()
    	at MethodInfo-164()
    It seems that the loader.content just doesn't want to be removed and created as a null. Does anyone one have any ideas? Thanks

    Code:
    		//Content Switch transition
    
    		private function startSwitch(thePage) {
    			Tweener.addTween(loader.content, {_blur_blurX:10,_blur_blurY:10, time:0.9, onComplete:moveAway, transition:"easeOut"});
    
    
    			addEventListener(Event.ENTER_FRAME, launchPage);
    			
    			//if the content container is empty load new swf when tranisition is finished
    			function launchPage(e:Event):void {
    				trace(loader.content);
    				if (loader.content == null) {
    					mainContent();
    					load(new URLRequest(thePage));
    					removeEventListener(Event.ENTER_FRAME, launchPage);
    				}
    			}
    		}
    		
    		private function moveAway() {
    			Tweener.addTween(loader.content, {_blur_blurX:50,_blur_blurY:10, time:0.3});
    			Tweener.addTween(loader.content, {x:1000, time:0.5, transition:"easeInBack", onComplete:removePrevious});
    		}
    		private function removePrevious() {
    			loader.unload();
    		}
    	}

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    This seems to indicate that the content is not a child of loader. Have you done traces?
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  3. #3
    Junior Member
    Join Date
    May 2008
    Posts
    17
    Yeah, I practically have the entire code traced out heres the loader script.

    Code:
    // **Loader**
    		private function mainContent() {
    			createLoader();
    			createProgressIndicator();
    		}
    		private function createLoader():void {
    			loader = new Loader();
    			loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener);
    			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeListener);
    			loader.contentLoaderInfo.addEventListener(Event.INIT, initListener);
    			loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorListener);
    		}
    		private function createProgressIndicator():void {
    			addChild(loader_mc);
    			loader_mc.addEventListener(Event.ENTER_FRAME, removeLoader);
    		}
    		private function load(urlRequest:URLRequest):void {
    			trace("Load the content");
    			loader.load(urlRequest);
    			if (!contains(loader_mc)) {
    				addChild(loader_mc);
    			}
    		}
    		private function progressListener(e:ProgressEvent):void {
    			loader_mc.percent_txt.text = Math.floor(e.bytesLoaded / 1024) + "/" + Math.floor(e.bytesTotal / 1024);
    			trace("Doing Math");
    		}
    		private function initListener(e:Event):void {
    			trace("Launch Content");
    			addChild(loader.content);
    			loader.content.y = 130;
    			loader.content.x = 80;
    		}
    		private function completeListener(e:Event):void {
    			Tweener.addTween(loader_mc, {alpha:0, time:1});
    
    			var loadSound:loadBleep = new loadBleep();
    			loadSound.play();
    
    			trace("Complated");
    		}
    		private function ioErrorListener(e:IOErrorEvent):void {
    			loader_mc.percent_txt.text = "69";
    		}
    		private function removeLoader(e:Event):void {
    			if (loader_mc.alpha == 0) {
    				trace("loader removed");
    				removeChild(loader_mc);
    				loader_mc.removeEventListener(Event.ENTER_FRAME, removeLoader);
    			}
    		}
    		// ** End Loader**

    and heres what it returns in the out put

    Code:
    Load the content
    Doing Math
    Doing Math
    Doing Math
    Launch Content
    Complated
    loader removed
    
    //That worked good
    //but this is after i clicked a button to load a new swf
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    [object About]
    ## [Tweener] Error: : [object About] raised an error while executing the'onComplete'handler. 
     ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    	at flash.display::Loader/unload()
    	at WaiaStudios/::removePrevious()
    	at Function/http://adobe.com/AS3/2006/builtin::apply()
    	at caurina.transitions::Tweener$/::updateTweenByIndex()
    	at caurina.transitions::Tweener$/::updateTweens()
    	at caurina.transitions::Tweener$/onEnterFrame()
    null
    Load the content
    Doing Math
    Doing Math
    loader removed
    Launch Content
    Complated
    Last edited by peteWaia; 05-07-2008 at 01:04 PM.

  4. #4
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    I am talking about the removePrevious() function. I am not using the Caurina tweens, since I made my own. Is that function correct? Usually these listener functions have a event parameter. Have you trace the loader content in there? That seems to be the problem spot.
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  5. #5
    Junior Member
    Join Date
    May 2008
    Posts
    17
    removePrevious() isn't a caurina function. It's just a function to try and remove the loaded swf. I got it to work however. I just had to end the event listener before unloading the movie. So my code looks like this.

    PHP Code:
            // **Content Switch Transition**

            
    private function startSwitch(thePage) {
                
    addEventListener(Event.ENTER_FRAME,launchPage);

                
    Tweener.addTween(loader.content,{_blur_blurX:10,_blur_blurY:10,time:0.9,onComplete:moveAway,transition:"easeOut"});//blur out
                
    Tweener.addTween(loader.content,{scaleX:0.88,scaleY:0.88,x:140,y:150,time:1,transition:"easeOut"});//move back

                //if the content container is empty load new swf when tranisition is finished
                
    function launchPage(e:Event):void {
                    
    trace("loader.content contains: " loader.content);//this happens until content is unloaded
                    
    if (loader.content == null) {
                        
    trace("loader.content contains: " loader.content);
                        
    addEventListener(Event.ENTER_FRAME,newPage);
                    }
                }
                function 
    moveAway() {
                    
    Tweener.addTween(loader.content,{_blur_blurX:50,_blur_blurY:10,time:0.3});//motion blur
                    
    Tweener.addTween(loader.content,{x:1000,time:0.5,transition:"easeInBack",onComplete:removePrevious});//move to the right and launch terminating method
                
    }
                function 
    removePrevious() {
                    
    trace("old SWF should be removed");
                    
    removeChild(loader.content);
                    
    removeEventListener(Event.ENTER_FRAME,launchPage);
                    
    newPage();
                }
                function 
    newPage() {
                    
    trace("launch new page");
                    var 
    loader:Loader=new Loader  ;
                    
    mainContent();
                    
    load(new URLRequest(thePage));
                    
    removeEventListener(Event.ENTER_FRAME,newPage);
                }
            }

            
    // **END Content Switch Transition** 
    Thanks for the help though.
    Last edited by cancerinform; 05-08-2008 at 03:12 AM.

  6. #6
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    It sounds like you're trying to removeChild (ie. unload()) something from the wrong parent...try traching

    PHP Code:
    this.contains(loader.content
    And if that's coming up false, break it down to see which piece is not adding up to what you thought it should be. Also, if it's happening on the very first one, make sure you've initialized the loader for the first time and that you're not hitting an edge case while trying to operate on an empty object.


    @Cancer: you built your own tween engine? Is it posted anywhere?

  7. #7
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Quote Originally Posted by neznein9
    @Cancer: you built your own tween engine? Is it posted anywhere?
    It is just some classes. Click on Flashscript classes on my footer or go directly to the documentation.

    http://flashscript.biz/flashas3/biz/index.html

    ApplyTweens and ApplyTweensTimer are the two classes.
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center