Current location: Hot Scripts Forums » General Web Coding » Flash & ActionScript » Parameter listener must be non-null


Parameter listener must be non-null

Reply
  #1 (permalink)  
Old 08-05-11, 04:57 PM
gigpacknaxe gigpacknaxe is offline
Newbie Coder
 
Join Date: Dec 2009
Posts: 5
Thanks: 5
Thanked 0 Times in 0 Posts
Parameter listener must be non-null

I am receiving a "Parameter listener must be non-null" output error. I do not receive any compile errors. In my DocRoot class, I added () to the end of the function call in the event listener. I know this is the problem, but when I correct the code my listeners do not function. The code below works up until finishLoadingSWF(). Both traces trigger and the clock.swf is added to the stage. Then I receive the output error. It does not appear finishLoadingXML() triggers or the script is ended prematurely.

I originally started a thread on actionscript.org but have not had much help. Here is that link:

Loop Through XML Data with a Pause - Fade in and Fade Out - ActionScript.org Forums

DocRoot Class:
Code:
package classes
{
    
    import flash.text.*;
    import flash.display.*;
    import flash.filters.*;
    import flash.events.*;
    import classes.FileLoader;
    
    
    public class DocRoot extends Sprite
    {      
        
        public function DocRoot()
        {      
            var Xpos:Number = 36;
            var Ypos:Number = 108;
            var fLoad:FileLoader = new FileLoader();
            var xml:XML;
            var xmlList:XMLList;
            var aTime1:TextField = arrive_time;
            
            fLoad.loadFile("appt-clock.swf", "swf");
            fLoad.addEventListener(Event.COMPLETE, finishLoadingSWF());
            
            fLoad.loadFile("appt-xml.php", "xml");
            fLoad.addEventListener("getXML", finishLoadingXML());
                        
            function finishLoadingSWF():void
            {
                fLoad.loadSWFObj.x = Xpos;
                fLoad.loadSWFObj.y = Ypos;
                addChild(fLoad.loadSWFObj);
                trace("finishLoadingSWF Works");
            }
            
            function finishLoadingXML():void
            {
                trace("finishLoadingSWF Works");
            }
        }      
        
    }
}
FileLoader Class:
Code:
package classes
{
    
    import flash.display.*;
    import flash.display.Stage;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.*;
    import classes.DocRoot;
    
    public class FileLoader extends MovieClip
    {
        public var loadSWFObj:Loader;   
        public var loadXObj:URLLoader;
        public var xml:XML;
        
        public function FileLoader()
        {
        }
        
        public function loadFile(url:String, fileType:String):void
        {         
            switch(fileType)
            {
                case "swf":
                    loadSWF(url);
                break;
                case "xml":
                    loadXML(url);
                break;
            }
        }
        
        public function loadSWF(url:String):void
        {
            loadSWFObj = new Loader();
            loadSWFObj.load(new URLRequest(url));
            trace("loadSWF Functioned Properly")
        }
        
        public function loadXML(url:String)
        {
            loadXObj = new URLLoader();
            loadXObj.load(new URLRequest(url));
            trace("loadXML Functioned Properly")
        }
            
    }
}
This is my first real attempt at AS3 and OOP. My final project will consist of a PHP script that generates XML data. The stage has 6 rows of of dynamic text boxes that will display the records from the XML. It will loop though all the records 6 at a time with a fade in / fade out between each set. Once it reaches the last record it will reload the XML (checking for new data) and repeat the process. I am no where near the finished product, but this is what I have so far. It took me about 8 hours of google to wrap my head aroung the OOP. I really believe I am on the top of the learning curve. Hopefully, it will be all down hill from here.

Thank you so much to anyone to all,

Joshua
Reply With Quote
Reply

Bookmarks

Tags
action script, action script 3, action script classes


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi ping check in same time deadManN Windows .NET Programming 60 10-15-10 01:33 PM
Keypad Login smithygotlost Script Requests 26 07-11-07 12:29 PM
MYSQL database countll Database 2 06-19-07 04:20 PM
What do you think of my database structure? Oskare100 Database 5 12-27-06 07:43 AM
picking random entries with a filter... Double selection problem dsumpter PHP 7 11-16-03 07:19 PM


All times are GMT -5. The time now is 07:00 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.