Skip to content

Commit

Permalink
Modified so that any provided handlers will receive the extra handler…
Browse files Browse the repository at this point in the history
…Args if provided
  • Loading branch information
bclinkinbeard committed Nov 30, 2010
1 parent 3ec08e1 commit f5a7aba
Showing 1 changed file with 42 additions and 18 deletions.
60 changes: 42 additions & 18 deletions src/org/swizframework/utils/services/SwizURLRequest.as
Original file line number Diff line number Diff line change
Expand Up @@ -73,36 +73,60 @@ package org.swizframework.utils.services
}
} );

loader.addEventListener( IOErrorEvent.IO_ERROR, function( e:IOErrorEvent ):void
{
if ( faultHandler != null )
faultHandler( e );
else {
// todo: what if there is no fault handler applied to dynamic url request
}
} );
loader.addEventListener( SecurityErrorEvent.SECURITY_ERROR, function( e:SecurityErrorEvent ):void
{
if ( faultHandler != null )
faultHandler( e );
else {
// todo: what if there is no fault handler applied to dynamic url request
}
} );
if( faultHandler != null )
{
loader.addEventListener( IOErrorEvent.IO_ERROR, function( e:IOErrorEvent ):void
{
if( handlerArgs == null )
{
faultHandler( e );
}
else
{
faultHandler.apply( null, [ e ].concat( handlerArgs ) );
}
} );

loader.addEventListener( SecurityErrorEvent.SECURITY_ERROR, function( e:SecurityErrorEvent ):void
{
if( handlerArgs == null )
{
faultHandler( e );
}
else
{
faultHandler.apply( null, [ e ].concat( handlerArgs ) );
}
} );
}

if( progressHandler != null )
{
loader.addEventListener( ProgressEvent.PROGRESS, function( e:ProgressEvent ):void
{
progressHandler( e );
if( handlerArgs == null )
{
progressHandler( e );
}
else
{
progressHandler.apply( null, [ e ].concat( handlerArgs ) );
}
} );
}

if( httpStatusHandler != null )
{
loader.addEventListener( HTTPStatusEvent.HTTP_STATUS, function( e:HTTPStatusEvent ):void
{
httpStatusHandler( e );
if( handlerArgs == null )
{
httpStatusHandler( e );
}
else
{
httpStatusHandler.apply( null, [ e ].concat( handlerArgs ) );
}
} );
}

Expand Down

0 comments on commit f5a7aba

Please sign in to comment.