Some times we get this error in flex –
Reference error 1056 :Cannot create property myname on mycustomobject.
You will get this error if you are setting/accessing any property that dose not exist on any object which is not declared as dynamic.The base class ‘Object’ is a dynamic class.
What is dynamic class? – below declaration will make mycustomeobject as dynamic and allows addition/deletion of properties at runtime.
Public dynamic class mycustomeobject{
}
You can do –
mycustomeobject[‘prop1’] = value1;
Prop1 need not be present at compile time. Same statemne will give us this reference error if we do not declare that class as dynamic.
Also you can delete the properties at runtime-
delete mycustomeobject.prop1;
If you are planning to use dynamic objects, its always good you check property existance before you use it –
mycustomobject.hasOwnProperty(‘prop1’)
Hope this helps … Have fun!