Hi,
Here is my daily question.
I have a class that handles Form + HTTPService (a subclass called
Service w/ events complete and fail) automatically called ServiceForm.
Since most code is replicated in extended classes if you are editing
one item (another HTTPService subclass that retrieves it and assign to
an XML Bindable variable), I optimized in a subclass of ServiceForm.
The name of this class is ServiceEditForm.
Here is the code:
package core.containers
{
public class ServiceEditForm extends ServiceForm
{
[Bindable] public var item:XML;
public function ServiceEditForm()
{
super();
}
override public function getParamObject(httpFormat:Boolean =
false):Object
{
var params:Object = super.getParamObject(httpFormat);
params.itemId = item.hasOwnProperty('id') ?
XML(item.id).toString()
: XMLList([EMAIL PROTECTED]).toString();
return params;
}
}
}
And then I have my classes that build EditForms... like
EditCenterForm, for example:
<?xml version="1.0" encoding="utf-8"?>
<ServiceEditForm xmlns="core.containers.*"
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:parton_controls="parton.controls.*"
url="{Environment.getInstance().MODULE_URL}Center/Edit"
complete="handleFormComplete(event)">
<mx:Script>
<![CDATA[
import core.Environment;
import core.events.DynEvent;
import mx.controls.Alert;
protected function
handleFormComplete(event:DynEvent):void
{
Alert.show(event.result.message.toString(),
"Edit Center");
}
]]>
</mx:Script>
<mx:FormItem label="Company:" width="600" direction="horizontal">
<parton_controls:CompanyComboBox id="company" width="100%"
selectedId="{item.hasOwnProperty('company_id') ?
XML(item.company_id).toString() :
XMLList([EMAIL PROTECTED]).toString()}"/>
</mx:FormItem>
<mx:FormItem label="Name:" width="600">
<mx:TextInput id="centerName" width="100%"
text="{item.hasOwnProperty('name') ? XML(item.name).toString() :
XMLList([EMAIL PROTECTED]).toString()}"/>
</mx:FormItem>
</ServiceEditForm>
Sorry for that much code... but it's quite simple.
When I do this and compile code, I get these errors:
Severity and Description Path Resource Location
Creation Time Id
Access of undefined property _bindings. [Generated code (use -keep to
save): Path: modules\center\forms\EditCenterForm-generated.as, Line:
420, Column: 21] Parton Unknown 1221744447894 17180
Access of undefined property _bindingsBeginWithWord. [Generated code
(use -keep to save): Path:
modules\center\forms\EditCenterForm-generated.as, Line: 432, Column:
21] Parton Unknown 1221744447900 17183
Access of undefined property _bindingsByDestination. [Generated code
(use -keep to save): Path:
modules\center\forms\EditCenterForm-generated.as, Line: 428, Column:
21] Parton Unknown 1221744447899 17182
Access of undefined property _documentDescriptor_. [Generated code
(use -keep to save): Path:
modules\center\forms\EditCenterForm-generated.as, Line: 91, Column:
13] Parton Unknown 1221744447893 17179
Access of undefined property _watchers. [Generated code (use -keep to
save): Path: modules\center\forms\EditCenterForm-generated.as, Line:
424, Column: 21] Parton Unknown 1221744447896 17181
Anyone has any ideas about how to solve it?
It seems it's an issue regarding the [Bindable] assignment in my
ServiceEditForm class.
Thanks in advance,
--
Guilherme Blanco - Web Developer
CBC - Certified Bindows Consultant
Cell Phone: +55 (16) 9166-6902
MSN: [EMAIL PROTECTED]
URL: http://blog.bisna.com
Rio de Janeiro - RJ/Brazil