That error usually means that you have two objects with the same name. -TH
--- In [email protected], "David" <[EMAIL PROTECTED]> wrote: > > Tim, > Wow! Thanks a bunch! I got pretty close but i got this one error: > > 1151: A conflict exists with definition linkedFormButton in namespace > internal. > > I'm really new to flex so alot of this is just a whole other OO level > then i'm use to. Below is my code for the whole page. IF you can take > a peek that would be awesome. Loved your site by the way. You guys do > amazing stuff with flex! i have a really good idea for a site if you > ever interested in packaging something. > Anyways, here's the code: > <?xml version="1.0" encoding="utf-8"?> > <cfComponents:SizeableTitleWindow > xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" > xmlns:cfComponents="com.adobe.ColdFusion.components.*" > creationComplete="initComponent()" > title="Archive Contents" > showCloseButton="true" close="WindowManager.remove(this);" > width="800" height="400" > > > <mx:Script> > <![CDATA[ > import com.adobe.windowedApplication.managers.WindowManager; > import mx.core.UIComponent; > import mx.collections.ArrayCollection; > import mx.utils.ObjectUtil; > import mx.controls.Alert; > import mx.rpc.events.FaultEvent; > import mx.rpc.events.ResultEvent; > import com.cfgenerated.views.detail.Archive_Content_Details; > import com.cfgenerated.views.masterdetail.Art_Details; > import com.cfgenerated.views.masterdetail.Recording_Details; > private var currentIndex:int = 0; > > private var _key:Object; > > [Bindable] > public function get key():Object > { > return this._key; > } > public function set key(key:Object):void > { > this._key = key; > } > > private function initComponent():void > { > refreshList(null); > } > > public function refreshList(event:Event):void > { > this.dataManager.getMasterQuery (this.key); > } > > private function deleteItem(key:Object):void > { > this.dataManager.deleteItem(key); > } > > private function getDetailComponent (key:Object):UIComponent > { > var view:Archive_Content_Details = new Archive_Content_Details(); > view.key = key; > view.addEventListener("change", refreshList); > return view; > } > > private function getArt_DetailsComponent (key:Object):UIComponent > { > var view:Art_Details = new Art_Details(); > view.key = key; > return view; > } > > private function getRecording_DetailsComponent(key:Object):UIComponent > { > var view:Recording_Details = new Recording_Details(); > view.key = key; > return view; > } > > /** > * RemoteObject result and error handlers > */ > private function server_fault (event:FaultEvent):void > { > // dump error message > Alert.show( ObjectUtil.toString (event.fault) ); > } > > private function getMasterQuery_result (event:ResultEvent):void > { > //Alert.show( ObjectUtil.toString (event.result) ); > this.masterList.dataProvider = event.result as ArrayCollection; > this.masterList.selectedIndex = this.currentIndex; > } > > private function deleteItem_result (event:ResultEvent):void > { > //Alert.show( ObjectUtil.toString (event.result) ); > refreshList(null); > } > > [Bindable] > private var linkedFormButtonVisible : Boolean = false; > > [Bindable] > private var linkedFormButton = ""; > > private static const ART_DETAILS_LABEL : String = "Art Details"; > > private static const RECORDING_DETAILS_LABEL : String = "Recording > Details"; > > private function handleMasterListChange():void{ > > linkedFormButtonVisible = false; > > linkedFormButtonLabel = ""; > > switch ( masterList.selectedItem.Format_Name ) > > { > case "Image" : > linkedFormButtonVisible = true; > linkedFormButtonLabel = > ART_DETAILS_LABEL; > break; > > case "Sketch" : > linkedFormButtonVisible = true; > linkedFormButtonLabel = > ART_DETAILS_LABEL; > break; > > case "Poster Art" : > linkedFormButtonVisible = true; > linkedFormButtonLabel = > ART_DETAILS_LABEL; > break; > > case "Cue" : > linkedFormButtonVisible = true; > linkedFormButtonLabel = > RECORDING_DETAILS_LABEL; > break; > > case "Track" : > linkedFormButtonVisible = true; > linkedFormButtonLabel = > RECORDING_DETAILS_LABEL; > break; > > case "Reel" : > linkedFormButtonVisible = true; > linkedFormButtonLabel = > RECORDING_DETAILS_LABEL; > break; > > default : > break; > > } > } > > private function addLinkedForm():void { > > switch ( masterList.selectedItem.Format_Name ) > > { > case "Image" : > > WindowManager.add(getArt_DetailsComponent (masterList.selectedItem.LocationContentID), > this, false); > break; > > case "Sketch" : > > WindowManager.add(getArt_DetailsComponent (masterList.selectedItem.LocationContentID), > this, false); > break; > > case "Poster Art" : > > WindowManager.add(getArt_DetailsComponent (masterList.selectedItem.LocationContentID), > this, false); > break; > > case "Cue" : > > WindowManager.add(getRecording_DetailsComponent (masterList.selectedItem.LocationContentID), > this, false); > break; > > case "Track" : > > WindowManager.add(getRecording_DetailsComponent (masterList.selectedItem.LocationContentID), > this, false); > break; > > case "Reel" : > > WindowManager.add(getRecording_DetailsComponent (masterList.selectedItem.LocationContentID), > this, false); > break; > > default : > break; > } > } > ]]> > </mx:Script> > > <mx:RemoteObject > id="dataManager" > showBusyCursor="true" > destination="ColdFusion" > source="tiomkin.admin.components.cfgenerated.Archive_Contents"> > <mx:method name="getMasterQuery" > result="getMasterQuery_result(event)" fault="server_fault (event)" /> > <mx:method name="deleteItem" result="deleteItem_result(event)" > fault="server_fault(event)" /> > </mx:RemoteObject> > > <mx:HBox id="addEditDeleteToolbar" horizontalAlign="left" > horizontalGap="20"> > <mx:Button id="addBtn" > icon="@Embed (source='../../../../images/add.png')" width="40" > click="WindowManager.add( getDetailComponent (null), this, false );" /> > <mx:Button id="editBtn" > icon="@Embed (source='../../../../images/edit.png')" width="40" > enabled="{this.masterList.selectedIndex>=0}" > click="WindowManager.add( > getDetailComponent(this.masterList.selectedItem.LocationContentID), > this, false );" /> > <mx:Button id="deleteBtn" > icon="@Embed (source='../../../../images/delete.png')" width="40" > enabled="{this.masterList.selectedIndex>=0}" > > click="this.deleteItem (this.masterList.selectedItem.LocationContentID)" /> > > <mx:Button id="linkedFormButton" > label="{ linkedFormButtonLabel }" > visible="{ linkedFormButtonVisible }" > click="addLinkedForm();"/> > > </mx:HBox> > > <mx:HBox width="100%" height="100%"> > <mx:DataGrid > id="masterList" > doubleClickEnabled="true" > doubleClick="this.currentIndex=this.masterList.selectedIndex; > if(this.masterList.selectedItem!=null) { WindowManager.add( > getDetailComponent(this.masterList.selectedItem.LocationContentID), > this, false ); }" > width="100%" height="100%" top="0" left="0" right="0" bottom="0" > change="handleMasterListChange();"> > <mx:columns> > <mx:DataGridColumn dataField="Format_Name" headerText="Format" > width="125" /> > <mx:DataGridColumn dataField="ContentTitle" headerText="Content > Title" /> > <mx:DataGridColumn dataField="Sequence" headerText="Sequence" > width="75" /> > </mx:columns> > </mx:DataGrid> > </mx:HBox> > > </cfComponents:SizeableTitleWindow> > > > Thanks again, > David > > --- In [email protected], "Tim Hoff" <Tim.Hoff@> wrote: > > > > > > Hi David, > > > > Here is one approach that uses binding. You could use if statements > > instead of case. Note the change event for masterList. This isn't > > tested code, but you should be able to get the ideas. > > > > > > > > -TH > > __________________________________ > > > > > > > > Tim Hoff > > Technical Lead > > Cynergy Systems, Inc. > > http://www.CynergySystems.com <http://www.cynergysystems.com/> > > > > > > > > > > > > > > <?xml version="1.0" encoding="utf-8"?> > > > > <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" > > height="300"> > > > > > > > > <mx:Script> > > > > <![CDATA[ > > > > > > > > [Bindable] > > > > private var linkedFormButtonVisible : Boolean = > false; > > > > > > > > [Bindable] > > > > private var linkedFormButton = ""; > > > > > > > > private static const ART_DETAILS_LABEL : String = > "Art > > Details"; > > > > private static const RECORDING_DETAILS_LABEL : String > > = "Recording Details"; > > > > > > > > private function handleMasterListChange():void > > > > { > > > > linkedFormButtonVisible = false; > > > > linkedFormButtonLabel = ""; > > > > > > > > switch ( masterList.selectedItem.Format_Name ) > > > > { > > > > case "Image" : > > > > linkedFormButtonVisible = > > true; > > > > linkedFormButtonLabel = > > ART_DETAILS_LABEL; > > > > break; > > > > > > > > case "Sketch" : > > > > linkedFormButtonVisible = > > true; > > > > linkedFormButtonLabel = > > ART_DETAILS_LABEL; > > > > break; > > > > > > > > case "Poster Art" : > > > > linkedFormButtonVisible = > > true; > > > > linkedFormButtonLabel = > > ART_DETAILS_LABEL; > > > > break; > > > > > > > > case "Cue" : > > > > linkedFormButtonVisible = > > true; > > > > linkedFormButtonLabel = > > RECORDING_DETAILS_LABEL; > > > > break; > > > > > > > > case "Track" : > > > > linkedFormButtonVisible = > > true; > > > > linkedFormButtonLabel = > > RECORDING_DETAILS_LABEL; > > > > break; > > > > > > > > case "Reel" : > > > > linkedFormButtonVisible = > > true; > > > > linkedFormButtonLabel = > > RECORDING_DETAILS_LABEL; > > > > break; > > > > > > > > default : > > > > break; > > > > } > > > > } > > > > > > > > private function addLinkedForm():void > > > > { > > > > switch ( masterList.selectedItem.Format_Name ) > > > > { > > > > case "Image" : > > > > > > > WindowManager.add(getArt_DetailsComponent (masterList.selectedItem.Locati\ > > onContentID), this, false); > > > > break; > > > > > > > > case "Sketch" : > > > > > > > WindowManager.add(getArt_DetailsComponent (masterList.selectedItem.Locati\ > > onContentID), this, false); > > > > break; > > > > > > > > case "Poster Art" : > > > > > > > WindowManager.add(getArt_DetailsComponent (masterList.selectedItem.Locati\ > > onContentID), this, false); > > > > break; > > > > > > > > case "Cue" : > > > > > > > WindowManager.add(getRecording_DetailsComponent (masterList.selectedItem.\ > > LocationContentID), this, false); > > > > break; > > > > > > > > case "Track" : > > > > > > > WindowManager.add(getRecording_DetailsComponent (masterList.selectedItem.\ > > LocationContentID), this, false); > > > > break; > > > > > > > > case "Reel" : > > > > > > > WindowManager.add(getRecording_DetailsComponent (masterList.selectedItem.\ > > LocationContentID), this, false); > > > > break; > > > > > > > > default : > > > > break; > > > > } > > > > } > > > > ]]> > > > > </mx:Script> > > > > > > > > <mx:Button id="linkedFormButton" > > > > label="{ linkedFormButtonLabel }" > > > > visible="{ linkedFormButtonVisible }" > > > > click="addLinkedForm();"/> > > > > > > > > <mx:List id="masterList" > > > > change="handleMasterListChange();"/> > > > > > > > > </mx:Canvas> > > > > > > --- In [email protected], "David" <envidobi@> wrote: > > > > > > Hi all, > > > I have an application generated by the CF wizard. On top of a datagrid > > > i have 2 buttons that go to 2 different detail pages based upon the > > > same column ID of the data grids' selected index. What i would like to > > > do is combine these buttons into one based upon a columns value in the > > > datagrid. Essentially, what i have is list of column names (things > > > like: cue, track, sketch, image, etc), and i would like the label of > > > the button to be "Recording Details" when the selected index is Cue, > > > Track or Reel, but if its Image, Sketch or Poster Art, then i want it > > > the label to be "Art Details". I would also need the click event to > > > change accordingly. I'm sure its just a simple if statement but I'm > > > rather new to flex. I'd also like the initial value to to be false so > > > that the button is invisible if there is nothing selected or available > > > in the data grid. > > > > > > Here's some code that i have now: > > > > > > <mx:Button id="linkedFormBtn1" label="Art Details" > > > visible="{this.masterList.selectedItem.Format_Name == 'Image' || > > > this.masterList.selectedItem.Format_Name == 'Sketch'}" > > > > > > click="WindowManager.add(getArt_DetailsComponent (this.masterList.selecte\ > > dItem.LocationContentID), > > > this, false);" /> > > > <mx:Button id="linkedFormBtn2" label="Recording Details" > > > visible="{this.masterList.selectedItem.Format_Name == 'Cue' || > > > this.masterList.selectedItem.Format_Name == 'Track' }" > > > > > > click="WindowManager.add(getRecording_DetailsComponent (this.masterList.s\ > > electedItem.LocationContentID), > > > this, false);" /> > > > > > > Thanks in advance, > > > David > > > > > >

