More use of objects leads to performance issue?
hi
I am developing a game using MVC. In which i need to send mulitple parameter to the addEventListener. So i have created a customEvent class with a parameter as object type.
Below is code flow
my custom Event class:
public function CustomEvent(type:String, customData:Object = null,bubbles:Boolean=false,cancelable:Boolean=false) {
//constructor
super(type,bubbles,cancelable);
this.customData = customData;
}
Adding listener
_myController.addEventListener(CustomEvent.UPDATE_MY_METHOD, doSomething);
function doSomething(myObj:Object){
var param1 = myObj.param1;
var param2 = myObj.param2 ;
var param3 = myObj.param2 ;
}
To call my custom event.
var dispObj = new Object();
dispObj.param1 = "ONE";
dispObj.param2 = 100;
dispObj.param3 = "PLAYER";
dispatchEvent(new CustomEvent(CustomEvent.UPDATE_MY_METHOD, dispObj);
This idea makes me to use more objects in my game.
Now my doubt is, whether this will leads to memory leakage or any other performance issue? If it is can I replace dictionary object or any other best option.
Any suggestions? Please.
Thanks in advance
