[flexcoders] Problems creating/updating DB record with selection from DropDownList

2012-02-05 Thread hermeszfineart
I have been trying to migrate certain form fields from s:TextInput/ to 
s:DropDownList/ where the DB columns have foreign keys to different tables 
(i.e. Status, Categories, Dimensions) so the user does not need to type the 
values. When I attempt to update the DB record it populates the field with 
[object Status]. This implementation is primarily for the back office 
management of the application but some of this type of functionallity will be 
used to drive the front end as well in the future.

I know I must be missing something very simple so any help is appreciated.

Here is the applicable code:

fx:Script

![CDATA[

import mx.binding.utils.BindingUtils;

import mx.collections.IList;

importmx.collections.errors.ItemPendingError;

import mx.controls.Alert;

import mx.events.FlexEvent;

import mx.rpc.AsyncResponder;

import mx.rpc.AsyncToken;

import mx.rpc.Fault;

import mx.rpc.events.FaultEvent;

import mx.rpc.events.ResultEvent;


import spark.events.GridItemEditorEvent;

import spark.events.GridSelectionEvent;

import spark.events.IndexChangeEvent;


import valueObjects.Categories;

import valueObjects.Dimensions;

import valueObjects.Editions;

import valueObjects.Mediums;

import valueObjects.Status;

import valueObjects.Styles;

import valueObjects.Subjects;

[Bindable] private var _selectedStatus:String = Available ;


private function statusChanged(event:IndexChangeEvent):void{

if (event.newIndex == -1) return;

_selectedStatus = statusList.getItemAt(event.newIndex) as String;

}

protected function button_clickHandler(event:MouseEvent):void{

originals.inventoryno = inventorynoTextInput.text;

originals.title = titleTextInput.text;

originals.price = priceTextInput.text;

originals.status = _selectedStatus;   // Original version -- originals.status = 
statusTextInput.text:

originals.category = categoryTextInput.text;

// Output omitted

if (originals.originalid==0){

createOriginalResult.token = artServices.createOriginal(originals);

}

else{

updateOriginalResult.token = artServices.updateOriginal(originals);

}

}

]]

/fx:Script

fx:Declarations

s:AsyncListView id=statusList 
list={getAllArtStatusResult.lastResult}/ !-- DataProvider --

/fx:Declarations

!-- output omitted for brevity --

s:FormItem label=Status styleName=formLabel

s:TextInput id=statusTextInput styleName=formContent 
text={originals.status}/ !-- this is one of the fields I am trying to 
replace --

s:DropDownList id=dropDownStatusList

labelField=status styleName=formContent 
skinClass=CustomSkins.CustomDropDownListSkin dataProvider={statusList}  
prompt={originals.status}

  change={_selectedStatus = dropDownStatusList.selectedItem} 
creationComplete=dropDownList_creationCompleteHandler(event)

  symbolColor=#FF borderColor=#c3c3c3   width=157 color=#00

/s:DropDownList

/s:FormItem




Re: [flexcoders] Problems creating/updating DB record with selection from DropDownList

2012-02-05 Thread Scott Fanetti
It looks like you are setting the status on the change in the drop down list 
but not casting it. Is that your issue? The change handler does not seem 
attached - what is triggering it?  When you debug it - what are the contents of 
the drop down list data provider?  

Sent from my iPhone

On Feb 5, 2012, at 8:31 AM, hermeszfineart hermeszfine...@comcast.net wrote:

 I have been trying to migrate certain form fields from s:TextInput/ to 
 s:DropDownList/ where the DB columns have foreign keys to different tables 
 (i.e. Status, Categories, Dimensions) so the user does not need to type the 
 values. When I attempt to update the DB record it populates the field with 
 [object Status]. This implementation is primarily for the back office 
 management of the application but some of this type of functionallity will be 
 used to drive the front end as well in the future.
 
 I know I must be missing something very simple so any help is appreciated.
 
 Here is the applicable code:
 
 fx:Script
 
 ![CDATA[
 
 import mx.binding.utils.BindingUtils;
 
 import mx.collections.IList;
 
 importmx.collections.errors.ItemPendingError;
 
 import mx.controls.Alert;
 
 import mx.events.FlexEvent;
 
 import mx.rpc.AsyncResponder;
 
 import mx.rpc.AsyncToken;
 
 import mx.rpc.Fault;
 
 import mx.rpc.events.FaultEvent;
 
 import mx.rpc.events.ResultEvent;
 
 import spark.events.GridItemEditorEvent;
 
 import spark.events.GridSelectionEvent;
 
 import spark.events.IndexChangeEvent;
 
 import valueObjects.Categories;
 
 import valueObjects.Dimensions;
 
 import valueObjects.Editions;
 
 import valueObjects.Mediums;
 
 import valueObjects.Status;
 
 import valueObjects.Styles;
 
 import valueObjects.Subjects;
 
 [Bindable] private var _selectedStatus:String = Available ;
 
 private function statusChanged(event:IndexChangeEvent):void{
 
 if (event.newIndex == -1) return;
 
 _selectedStatus = statusList.getItemAt(event.newIndex) as String;
 
 }
 
 protected function button_clickHandler(event:MouseEvent):void{
 
 originals.inventoryno = inventorynoTextInput.text;
 
 originals.title = titleTextInput.text;
 
 originals.price = priceTextInput.text;
 
 originals.status = _selectedStatus; // Original version -- originals.status = 
 statusTextInput.text:
 
 originals.category = categoryTextInput.text;
 
 // Output omitted
 
 if (originals.originalid==0){
 
 createOriginalResult.token = artServices.createOriginal(originals);
 
 }
 
 else{
 
 updateOriginalResult.token = artServices.updateOriginal(originals);
 
 }
 
 }
 
 ]]
 
 /fx:Script
 
 fx:Declarations
 
 s:AsyncListView id=statusList list={getAllArtStatusResult.lastResult}/ 
 !-- DataProvider --
 
 /fx:Declarations
 
 !-- output omitted for brevity --
 
 s:FormItem label=Status styleName=formLabel
 
 s:TextInput id=statusTextInput styleName=formContent 
 text={originals.status}/ !-- this is one of the fields I am trying to 
 replace --
 
 s:DropDownList id=dropDownStatusList
 
 labelField=status styleName=formContent 
 skinClass=CustomSkins.CustomDropDownListSkin dataProvider={statusList} 
 prompt={originals.status}
 
 change={_selectedStatus = dropDownStatusList.selectedItem} 
 creationComplete=dropDownList_creationCompleteHandler(event)
 
 symbolColor=#FF borderColor=#c3c3c3 width=157 color=#00
 
 /s:DropDownList
 
 /s:FormItem
 
 


[flexcoders] Modules, TabNavigator, Force Render...

2012-02-05 Thread jamesfin
Using a simple two tab TabNavigator, two modules are loaded via 
ModuleManager.load.  A bitmap is being generated for each tab as a preview to 
what content exists on each tab.

The first visible tab displays the bitmap normally.  The second tab (not yet 
clicked on or shown) bitmap comes up empty as it would appear as if it hasn't 
rendered yet.

The creationPolicy for all the associated containers is set to all.  

Clicking on the second tab instantly shows the content as expected.

Is there a manual method to forcing the second tab to render itself so that the 
preview bitmap can be generated without having to click on the second tab?

As a side-solution, if each tab (3 tabs in this scenario) are selected 
programmatically for one second, will that force a render to occur even though 
the next programmatically selected tab (tab three) has also been selected?

i.e.

first tab is visible
second tab is programmatically selected
wait 1 second
third tab is programmatically selected














[flexcoders] SWF Management...

2012-02-05 Thread jamesfin
A module is being loaded by a simple ModuleManager.load.

In debug mode, there is output like this...

[Unload SWF] View.swf/[[DYNAMIC]]/307 - 632 bytes after decompression
[Unload SWF] View.swf/[[DYNAMIC]]/308 - 632 bytes after decompression
[Unload SWF] View.swf/[[DYNAMIC]]/309 - 632 bytes after decompression
[Unload SWF] View.swf/[[DYNAMIC]]/310 - 632 bytes after decompression
[Unload SWF] View.swf/[[DYNAMIC]]/311 - 632 bytes after decompression

and

[SWF] View.swf/[[DYNAMIC]]/337 - 632 bytes after decompression
[SWF] View.swf/[[DYNAMIC]]/338 - 632 bytes after decompression
[SWF] View.swf/[[DYNAMIC]]/339 - 632 bytes after decompression
[SWF] View.swf/[[DYNAMIC]]/340 - 632 bytes after decompression
[SWF] View.swf/[[DYNAMIC]]/341 - 632 bytes after decompression

when interacting with the application.


Is this normal and why the all the loading and unloading messages?