Works fine here.
Allthough you should consider making the class the MovieClipLoader listener 
object, rather than creating a seperate object (and 
using nested functions etc..);

I also prefer initializing EventDispatcher outside the constructor (through a 
static property), because then the mixin only occurs 
once (instead of each time the constructor is run).

If loading the image doesn't work, check to make sure the Library Symbol is 
setup properly (Linkage)


import mx.data.binding.ObjectDumper;
import mx.events.EventDispatcher;
import mx.utils.Delegate;

class TowerVideoPlayer extends MovieClip {

 private static var dispatcherInit = 
EventDispatcher.initiliaze(Object(TowerVideoPlayer.prototype));

 //------------------------------------------------------
 // PROPERTIES
 //------------------------------------------------------

 // Class variables for EventDispatcher
 private var dispatchEvent:Function;
 public var addEventListener:Function;
 public var removeEventListener:Function;
 // String values of class name and class version
 public var sClassName:String;
 public var sVersion:String;
 // Sound object for the video
 private var sndVideo:Sound;
 // Value of the video's sound object
 private var bSound:Boolean;
 // Data for loading of SWFs
 private var xmlVideo:XML;
 // Holder clip for the loaded SWF
 private var mcHolder:MovieClip;
 // MovieClipLoader for the SWF
 private var mclLoader:MovieClipLoader;
 //------------------------------------------------------
 // CONSTRUCTOR
 //------------------------------------------------------
 public function TowerVideoPlayer() {
  setup();
 }
 //------------------------------------------------------
 // FUNCTIONS
 //------------------------------------------------------
 private function setup():Void {
  trace("TowerVideoPlayer.setup()");
  sClassName = "TowerVideoPlayer";
  sVersion = "0.0.1";
  bSound = true;
  createEmptyMovieClip("mcHolder", this.getNextHighestDepth());
  mclLoader = new MovieClipLoader();
  mclLoader.addListener(this);
  mclLoader.loadClip("http://www.w3.org/Icons/w3c_main.png";, mcHolder);
  trace(ObjectDumper.toString(this));
 }
 //
 function onLoadComplete(mcTarget:MovieClip, httpStatus:Number):Void {
  trace(">> loadListener.onLoadComplete()");
 }
 //
 function onLoadInit(mcTarget:MovieClip):Void {
  trace(">> loadListener.onLoadInit()");
 }
}


----- Original Message ----- 
From: "Stephen Ford" <[EMAIL PROTECTED]>
To: <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, April 04, 2007 8:27 AM
Subject: [Flashcoders] MovieClipLoader ...


Can anyone see why the callback events on the oLoadListener object in the 
following class aren't firing:import 
mx.data.binding.ObjectDumper;import mx.events.EventDispatcher;import 
mx.utils.Delegate;class TowerVideoPlayer extends MovieClip 
{    //    
------------------------------------------------------------------------    //  
  PROPERTIES 
//    ------------------------------------------------------------------------  
   // String values of class name and class version 
public var sClassName:String;    public var sVersion:String;        // Class 
variables for EventDispatcher    private var 
dispatchEvent:Function    public var addEventListener:Function;    public var 
removeEventListener:Function;        // Sound object 
for the video    private var sndVideo:Sound;        // Value of the video's 
sound object    private var bSound:Boolean;        // 
Data for loading of SWFs    private var xmlVideo:XML;        // Holder clip for 
the loaded SWF    private var mcHolder:MovieClip; 
// MovieClipLoader for the SWF    private var mclLoader:MovieClipLoader;        
// Load listener for SWFs    private var 
oLoadListener:Object;        //    
------------------------------------------------------------------------    //  
  CONSTRUCTOR 
//    ------------------------------------------------------------------------  
       public function TowerVideoPlayer() 
{        setup();    }        //    
------------------------------------------------------------------------    //  
  FUNCTIONS 
//    ------------------------------------------------------------------------  
       private function setup():Void    { 
trace("TowerVideoPlayer.setup()");                sClassName = 
"TowerVideoPlayer";        sVersion = "0.0.1";        bSound = true; 
oLoadListener = new Object();        mcHolder = 
createEmptyMovieClip("mcHolder", this.getNextHighestDepth());        mclLoader 
= new 
MovieClipLoader();                // Initialise event dispatcher        
EventDispatcher.initialize(this); 
oLoadListener.onLoadComplete = function(mcTarget:MovieClip, 
httpStatus:Number):Void        {            trace(">> 
loadListener.onLoadComplete()");                    }            
oLoadListener.onLoadInit = function(mcTarget:MovieClip):Void 
{            trace(">> loadListener.onLoadInit()");                    }        
        mclLoader.addListener(oLoadListener); 
mclLoader.loadClip("http://www.w3.org/Icons/w3c_main.png";, mcHolder); 
            trace(ObjectDumper.toString(this));    }    
}_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to