You should use a debug build and post the full stack trace.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of txakin
Sent: Wednesday, April 23, 2008 12:16 AM
To: [email protected]
Subject: [flexcoders] Re: TypeError: Error #2007: The parameter listener must 
not be NULL + Cairngorm

 

Nobody can help me?????????????

I have more than 2 days trying to fix it....but i can not....
Maybe i have explained in wrong way my problem.

Thanks in advance.

--- In [email protected] <mailto:flexcoders%40yahoogroups.com> , 
"txakin" <[EMAIL PROTECTED]> wrote:
>
> 
> Hi all
> 
> I´m trying to display an image from database in my application 
using
> Cairngorm framework.
> 
> I always get the same error :
> 
> TypeError: Error #2007: The parameter listener must not be NULL
> 
> at flash.events::EventDispatcher/addEventListener
()
> 
> and I don´t know if is because my source is incorrect or because
> i´m forgetting some step.
> 
> Here I will send u my source....and my classes.
> 
> 
> 
> I´m going to try to explain my source step by step.
> 
> 1. First of all....i have one repeater it calls other component:
> 
> <mx:Repeater id="grdMovies" width="100%" height="100%"
> horizontalCenter="0" bottom="0">
> 
> 
> 
> <detail:detailMovie id="detailmovie"
> myMovie="{grdMovies.currentItem}"/>
> 
> <mx:HRule width="90%"/>
> 
> </mx:Repeater>
> 
> 
> 
> 1. My component detailMovie calls my event to get my image.
> 
> 
> 
> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml 
> <http://www.adobe.com/2006/mxml> " width="548"
> height="142"
> 
> backgroundColor="#FFFFFF" backgroundAlpha="0.0"
> creationComplete="loadData();">
> 
> 
> 
> <mx:Script>
> 
> <![CDATA[
> 
> public function loadData():void
> 
> {
> 
> var 
getCoverRepeaterEvent:GetCoverRepeaterEvent
> = new GetCoverRepeaterEvent(myMovie.movieId);
> 
> getCoverRepeaterEvent.dispatch();
> 
> }
> 
> 
> 
> public function
> loaderCompleteHandler(event:Event):void
> 
> {
> 
> this.movie_cover.source =
> event.currentTarget.content as Bitmap;
> 
> }
> 
> ]]>
> 
> </mx:Script>
> 
> 
> 
> <mx:Image x="10" y="31" width="91" height="101" id="movie_cover"/>
> 
> </mx:Canvas>
> 
> 
> 
> 
> 
> 1. SampleController :
> 
> 
> 
> package com.cairngorm.control {
> 
> 
> 
> import com.adobe.cairngorm.control.FrontController;
> 
> import com.cairngorm.commands.*;
> 
> import com.cairngorm.commands.movieimage.repeater.*;
> 
> import com.cairngorm.events.movieimage.repeater.*;
> 
> 
> 
> public class SampleController extends FrontController {
> 
> 
> 
> public function SampleController() {
> 
> this.initialize();
> 
> }
> 
> 
> 
> public function initialize():void {
> 
> 
> 
> // ADD COMMANDS
> 
> this.addCommand(
> GetCoverRepeaterEvent.GET_COVER_REPEATER, GetCoverRepeaterCommand);
> 
> 
> 
> ..............................other commands
> ............................
> 
> }
> 
> 
> 
> }
> 
> }
> 
> 
> 
> 1. MovieImageDelegate : Here i call the java class....and is
> correct....but i have taken it out my java class....because i 
think is
> not very important
> 
> 
> 
> package com.cairngorm.business.movieimage
> 
> {
> 
> import com.adobe.cairngorm.business.ServiceLocator;
> 
> 
> 
> import mx.rpc.IResponder;
> 
> 
> 
> public class MovieImageDelegate
> 
> {
> 
> private var responder : IResponder;
> 
> private var service : Object;
> 
> 
> 
> public function MovieImageDelegate(responder : 
IResponder)
> 
> {
> 
> this.responder = responder;
> 
> this.service =
> ServiceLocator.getInstance().getRemoteObject("movieImageObject");
> 
> }
> 
> 
> 
> public function getCover(pMovieImageId:String):void
> 
> {
> 
> var call:Object = service.getCover
(pMovieImageId);
> 
> call.addResponder(responder);
> 
> }
> 
> }
> 
> }
> 
> 
> 
> 1. GetCoverRepeaterEvent :
> 
> 
> 
> package com.cairngorm.events.movieimage.repeater
> 
> {
> 
> import com.adobe.cairngorm.control.CairngormEvent;
> 
> 
> 
> import flash.events.Event;
> 
> 
> 
> public class GetCoverRepeaterEvent extends CairngormEvent {
> 
> 
> 
> public static const GET_COVER_REPEATER:String =
> "GetCoverRepeater";
> 
> 
> 
> public var movieImageId:String;
> 
> 
> 
> public function
> GetCoverRepeaterEvent(submittedMovieImageId:String) {
> 
> movieImageId = submittedMovieImageId;
> 
> super(GET_COVER_REPEATER);
> 
> }
> 
> 
> 
> override public function clone():Event {
> 
> return new GetCoverRepeaterEvent(movieImageId);
> 
> }
> 
> 
> 
> }
> 
> }
> 
> 
> 
> 1. GetCoverRepeaterCommand : Here I get correctly my image
> 
> 
> 
> package com.cairngorm.commands.movieimage.repeater
> 
> {
> 
> import com.adobe.cairngorm.commands.ICommand;
> 
> import com.adobe.cairngorm.control.CairngormEvent;
> 
> import com.cairngorm.business.movieimage.MovieImageDelegate;
> 
> import
> com.cairngorm.events.movieimage.repeater.GetCoverRepeaterEvent;
> 
> import com.cairngorm.model.ViewModelLocator;
> 
> import com.cairngorm.vo.MovieImage;
> 
> 
> 
> import mx.controls.Alert;
> 
> import mx.rpc.IResponder;
> 
> 
> 
> public class GetCoverRepeaterCommand implements ICommand,
> IResponder
> 
> {
> 
> public var modelLocator:ViewModelLocator =
> ViewModelLocator.getInstance();
> 
> 
> 
> public function GetCoverRepeaterCommand() {
> 
> 
> 
> }
> 
> 
> 
> public function execute(event:CairngormEvent):void {
> 
> 
> 
> var getCoverRepeaterEvent:GetCoverRepeaterEvent 
=
> event as GetCoverRepeaterEvent;
> 
> var delegate:MovieImageDelegate = new
> MovieImageDelegate(this);
> 
> delegate.getCover
(getCoverRepeaterEvent.movieImageId);
> 
> }
> 
> 
> 
> public function result(event:Object):void
> 
> {
> 
> if (event.result == null)
> 
> {
> 
> Alert.show("The cover can not be
> displayed.","WARNING");
> 
> modelLocator.movieCoverRepeater = null;
> 
> }
> 
> else
> 
> {
> 
> var myMovieImage:MovieImage = 
event.result as
> MovieImage;
> 
> modelLocator.movieCoverRepeater =
> myMovieImage.cover;
> 
> modelLocator.displayImageRepeater();
> 
> }
> 
> }
> 
> 
> 
> public function fault(event:Object):void
> 
> {
> 
> trace("Service Error!!!!! " + event.toString());
> 
> Alert.show("Can not open the database connection. Inform to the
> administrator!!!!!" + event.toString().substr(0,600),"ERROR
> CONFIGURATION");
> 
> }
> 
> 
> 
> }
> 
> }
> 
> 
> 
> 
> 
> 1. ViewModelLocator :
> 
> 
> 
> package com.cairngorm.model {
> 
> 
> 
> import com.adobe.cairngorm.model.IModelLocator;
> 
> import com.cairngorm.vo.Movie;
> 
> 
> 
> import flash.display.DisplayObject;
> 
> import flash.events.Event;
> 
> import flash.utils.ByteArray;
> 
> 
> 
> import mx.events.IndexChangedEvent;
> 
> 
> 
> [Bindable]
> 
> public class ViewModelLocator implements IModelLocator {
> 
> 
> 
> private static var instance:ViewModelLocator;
> 
> 
> 
> public function ViewModelLocator
(enforcer:SingletonEnforcer)
> {
> 
> if (enforcer == null) {
> 
> throw new Error( "You Can Only Have One
> ViewModelLocator" );
> 
> }
> 
> }
> 
> 
> 
> public static function getInstance() : 
ViewModelLocator {
> 
> if (instance == null) {
> 
> instance = new ViewModelLocator( new
> SingletonEnforcer );
> 
> }
> 
> return instance;
> 
> }
> 
> 
> 
> // DEFINE YOUR VARIABLES HERE
> 
> .............. other variables .....................
> 
> public var movieCoverRepeater:ByteArray;
> 
> 
> 
> public var workflowState:uint = 0;
> 
> 
> 
> // DEFINE VIEW CONSTANTS
> 
> public static const LOGIN_SCREEN:uint = 0;
> 
> public static const MAIN_SCREEN:uint = 1;
> 
> 
> 
> 
> 
> import flash.display.Loader;
> 
> 
> 
> public function displayImageRepeater():void {
> 
> if (this.movieCoverRepeater != null &&
> this.movieCoverRepeater.length > 0)
> 
> {
> 
> var loader:Loader = new Loader();
> 
> loader.loadBytes(this.movieCoverRepeater);
> 
> loader.contentLoaderInfo.addEventListener
(Event.COMPLETE,
> 
Application.application.repeatermovies.detailmovie.loaderCompleteHand
ler\
> );
> 
> }
> 
> }
> 
> }
> 
> }
> 
> 
> 
> // Utility Class to Deny Access to Constructor
> 
> class SingletonEnforcer {}
> 
> 
> 
> 
> 
> 
> 
> Then when I execute the addEventListener....i always get the
> error:
> 
> TypeError: Error #2007: The parameter listener must not be NULL
> 
> at
> flash.events::EventDispatcher/addEventListener()
> 
> 
> 
> I don´t know why....... Maybe I need to call my
> functions after execute one event in my application or I lose some
> source in my classes? I must tell.....untill call the
> addEventListener....all the values are correct......and my image has
> value.
> 
> 
> 
> I hope someone can help me....because i have 2 
days....blocked....and
> i´m going to become crazy.
> 
> 
> 
> Sorry if my englisg is not so good....but i´m spanish.
> 
> 
> 
> Thanks is advance.....
>

 

Reply via email to