Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
smscentral #1
error loading module using ModuleManager
Hi all,
I load a module using ModuleManager.getModule(modname) in a flex application.
module is loaded successfully.
and when i try to click the links in the module,it connects to HTTPService and
gets the data successfully but before showing data i get the following error:
#1009: Cannot access a property or method of a null object reference.
i try to debug and i see this in debug mode
TypeError: Error #1009: Cannot access a property or method of a null object
reference.
at mx.rpc::AbstractInvoker$cinit()
at global$init()
at global$init()
at mitto.core::MittoBackendRequest()
at mitto.core::MittoBackendRequest$/CreateBackendRequest()
at component.MXML::ListUsersComponent/entitiesList()
at UserModule/linkToListUsers()
at UserModule/__listUsers_click()
what is this at mx.rpc::AbstractInvoker$cinit()
at global$init()
at global$init() ??/
when i click continue when the error pops up, i get back to the list with my
data in datagrid.
Any suggestion would be helpful.
Thanks
smscentral Guest
-
Problem Dynamically Loading a Module
Hi all, I'm having some trouble with trying to dynamically load a module at runtime. The following example demonstrates the problem I'm... -
loading a module in parrentApplication from anothermodule
Hi, I have the following parrent application: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"... -
Module loading order
Hello, Description: package A; my $instance; sub new { my $class = shift; my %args = @_; return $instance if $instance; -
#24199 [Opn->Fbk]: problem with loading module in apache 2.0.46
ID: 24199 Updated by: sniper@php.net Reported By: keeper at fly dot srk dot fer dot hr -Status: Open +Status: ... -
loading a module dependant on the OS
I have a Perl script which runs under Windows and uses the module Win32::Process, I now have a need to run this on Linux. I can do produce two... -
atta707 #2
Re: error loading module using ModuleManager
can you show some working code that shows the problem?
atta707 Guest
-
smscentral #3
Re: error loading module using ModuleManager
thanks for ur time.
i am loading the module using module manager
public function loadModule(filePath:String):void {
mittoAppInstance = MittoApp.getInstance();
moduleInfo = ModuleManager.getModule(filePath);
moduleInfo.addEventListener(ModuleEvent.READY, modReadyEventHandler);
moduleInfo.addEventListener(ModuleEvent.PROGRESS,m odProgressEventHandler);
moduleInfo.addEventListener(ModuleEvent.ERROR, modErrorEventHandler);
moduleInfo.load();
MittoApp.getInstance().progressbar.visible = true;
}
//get the instance of module , call method on that object, add it to the main
application
private function modReadyEventHandler(e:ModuleEvent):void {
moduleInstance = this.getModuleInstance();
this.addToApplication();
}
//get the instance of the module
public function getModuleInstance():Object{
return moduleInfo.factory.create() as Object;
}
//add module to mitto application
public function addToApplication():void{
mittoAppInstance.main.addChild(moduleInstance as DisplayObject);
}
and my module has some links
<mx:ControlBar>
<mx:LinkButton id="addUser" label="Add User"
click="linkToAddUser();"/>
<mx:LinkButton id="listUsers" label="List Users"
click="linkToListUsers();"/>
<mx:LinkButton id="editpermissions" label="Edit Permission"
click="selectUser()"/>
</mx:ControlBar>
public function linkToListUsers():void{
listUsersInstance = new ListUsersComponent()
listUsersInstance.list_url="usermanagement";
listUsersInstance.action="listusers";
listUsersInstance.entitiesList();
this.remove();
usermain.addChild(listUsersInstance);
}
and as i click on list users..i get the exception 1009.
Thanks
<mx:Panel layout="horizontal" width="100%" height="100%" title="Welcome to
Mitto!"
horizontalAlign="center" paddingBottom="10" paddingLeft="10"
paddingRight="10" paddingTop="10">
<mx:VBox id="menu" width="10%" height="100%">
<mx:LinkButton label="{uixml.Permission.Description}"
click="loadModule()" />
<mx:LinkButton label="Logout" click="logout()"/>
<mx:TextArea id="log" width="250" height="300" y="600"/>
</mx:VBox>
smscentral Guest
-
atta707 #4
Re: error loading module using ModuleManager
So far so good! The exception source is actually going beyond this code: in the MittoBackendRequest.CreateBackendRequest() method.
have tried to debug this method?
atta707 Guest
-
smscentral #5
Re: error loading module using ModuleManager
hii
The problem seems not with the module or modulemanager..sorry for that..
but i have some renderers in mt listuserscomponents.
checkbox header : on selecting will select all checkboxes in datagrid.
this renderer seems to be causing that exception.I removed that renderer for a
while and check it..its running fine..
i attach my renderer code..
if i remove initialze method i get the exception
and if i dont remove the initialize method..i see an extra checkbox in the
datagrid's first column header..i dont know from where is this appearing..i
wish i could attach a screen shot...
aaaaaaaa...i think i confuse u a lot..
thanks once again
public class DatagridCheckboxRendererAS extends CheckBox
{
public function DatagridCheckboxRendererAS(){
super();
}
override public function initialize():void{
this.addEventListener(FlexEvent.CREATION_COMPLETE, checkDelPermission);
}
override public function set data(value:Object):void{
if(value != null){
super.data = value;
checkDelPermission(null);
}
}
/*check for the delete permission,if true delete checbox is enabled
called on CreationComplete event*/
public function checkDelPermission(event:FlexEvent = null):void{
var checkpermissioninstance:CheckPermission = new CheckPermission();
checkpermissioninstance.permissions = [8];
if(data.hasOwnProperty("permission")){
checkpermissioninstance.permBit = data.permission;
var delpermission:ArrayCollection =
checkpermissioninstance.getPermissions()
if(delpermission!=null){
if(delpermission[0]==true){
this.enabled = true;
}
else{
this.enabled=false
}
}
}
else{
this.enabled = false;
}
}
//if delete checkbox is disabled,then do not display the cehckbox
override protected function
updateDisplayList(unscaledWidth:Number,unscaledHei ght:Number):void
{
super.updateDisplayList(unscaledWidth,unscaledHeig ht);
if(this.enabled)
this.visible = true;
else
this.visible=false;
}
override public function validateProperties():void{
super.validateProperties();
if (listData)
{
var dg:DataGrid = DataGrid(listData.owner);
var column:CheckBoxHeaderColumn = dg.columns[listData.columnIndex];
column.addEventListener("click",columnHeaderClickH andler);
}
}
//click handler for checkbox renderers in each row
override protected function clickHandler(event:MouseEvent):void{
super.clickHandler(event);
var dg:DataGrid = DataGrid(listData.owner);
var data : Object = dg.dataProvider[listData.rowIndex];
var dataObj :Object = {id:data.id,check:event.target.selected};
parentDocument.toggleSelectedData(dataObj);
}
//click handler for the header checkbox of datagrid column
private function columnHeaderClickHandler(event:MouseEvent):void{
selected = event.target.selected;
var dg:DataGrid = DataGrid(listData.owner);
//the first header row has its index as neagtive value.Exclude the header
row.
if(dg.itemRendererToIndex(this) >= 0){
if(this.visible){
var data:Object = dg.dataProvider[dg.itemRendererToIndex(this)];
var dataObj :Object = {id:data.id,check:event.target.selected};
parentDocument.toggleSelectedData(dataObj);
}
}
}
smscentral Guest
-
smscentral #6
Re: error loading module using ModuleManager
hi...
i try to debug that mittobackendrequest but as and when i click my link..it
shows up the error..
at mx.rpc::AbstractInvoker$cinit()
at global$init()
at global$init()
at mitto.core::MittoBackendRequest()
at mitto.core::MittoBackendRequest$/CreateBackendRequest()
at component.MXML::ListUsersComponent/entitiesList()
at UserModule/linkToListUsers()
at UserModule/__listUsers_click()
mittobackend request class :
public static function CreateBackendRequest(url:String=null) :
MittoBackendRequest {
return new MittoBackendRequest(url);
}
public function MittoBackendRequest(url:String=null){
this.showBusyCursor = true;
this.useProxy = false;
this.method = "POST";
this.url = url;
this.curInstance = MittoBackendRequest.instanceCounter++;
httpservice = new HTTPService();
httpservice.addEventListener(FaultEvent.FAULT, handleFault);
httpservice.addEventListener(InvokeEvent.INVOKE, handleInvoke);
//httpservice.addEventListener(ResultEvent.RESULT, BackendResultHandler);
this.events = new EventDispatcher();
}
smscentral Guest



Reply With Quote

