[flexcoders] Re: Binding question

2009-06-01 Thread steve horvath
Weird, I had to use the event=albumToggledEvent for the includedAlbums
getter property and do project-clean.

Spent a whole lot of time on this.  So I guess the lesson learned here
is when you think you've got your bindings set up correctly and they
still don't work, project-clean.

ascii


--- In flexcoders@yahoogroups.com, steve horvath flexcod...@...
wrote:

 I am trying to bind the checkbox selected property as written below.
 The value of selected should be triggered whenever currentPresentation
 changes or whenever albumIncluded(data) returns a different value. 
The
 checkbox is in a List itemRenderer component.

 ItemRenderer
 
 mx:CheckBox id=albumEnabled
 selected={presentations.currentPresentation.albumIncluded(data as
 Album)} /

 mx:Script
 ![CDATA[
 [Bindable]
 private var presentations:PresentationCollection =
 PresentationCollection.getInstance();
 ]]
 /mx:Script

 The albumIncluded function is in a class called Media and is coded as
 follows:

 Media class (the class is marked [Bindable])
 -
 private var _includedAlbums:ArrayCollection /* of Albums */ =new
 ArrayCollection();

 public function includeAlbum(album:Album):void {
 _includedAlbums.addItem(album);
 if (!currentAlbum)
 currentAlbum = album;
 dispatchEvent(new Event(albumToggledEvent));
 }

 [Bindable(event=albumToggledEvent)]
 public function albumIncluded(album:Album):Boolean {
 return _includedAlbums.getItemIndex(album) = 0;
 }

 Apparently the albumIncluded function doesn't fire when includeAlbum()
 function is called.

 So I put a read-only property called includedAlbums in Media which is
 supposed to be triggered when _includedAlbums changes.

 Media class (class is Bindable)
 
 private var _includedAlbums:ArrayCollection /* of Albums */ =new
 ArrayCollection();

 public function includeAlbum(album:Album):void {
 _includedAlbums.addItem(album);
 if (!currentAlbum)
 currentAlbum = album;
 dispatchEvent(new Event(albumToggledEvent));
 }

 [Bindable(event=albumToggledEvent)]
 public function albumIncluded(album:Album):Boolean {
 return _includedAlbums.getItemIndex(album) = 0;
 }

 [Bindable(event=none)] // handles runtime binding warnings
 public function get includedAlbums():ArrayCollection /* of Albums */ {
 return _includedAlbums;
 }

 And added a helper function to the ItemRenderer component, with the
idea
 that if either currentPresentation or includedAlbums changed it would
 fire the helper function which would return the correct value for the
 checkbox selected property.

 ItemRenderer
 ---

 mx:CheckBox id=albumEnabled

selected={albumToggleHelper(presentations.currentPresentation.includedA\
\
 lbums)} /

 mx:Script
 ![CDATA[
 [Bindable]
 private var presentations:PresentationCollection =
 PresentationCollection.getInstance();

 private function albumToggleHelper(includedAlbums:ArrayCollection /*
of
 Albums */):Boolean {
 return presentations.currentPresentation.albumIncluded(data as Album);
 }
 ]]
 /mx:Script

 But it looks like the includedAlbums property is never firing an
event.
 How do I get my checkbox selected to set to the right value?

 (Note: I also tried setting the bindable event tag to
 event=albumToggledEvent for the includedAlbums getter property, and
it
 still didn't work.)

 ascii




[flexcoders] Re: Binding Question - ArrayCollection/ResourceBundle

2008-12-12 Thread securenetfreedom
Thanks, Alex.

So I assume a flex button listens for the locale change event and
therefore updates it's label?

Are you saying create say a LocaleArrayCollection class that dispatches
the locale change event?
Or are you saying create LocaleChangeDispatcher that dispatches the
locale change event and the ArrayCollection would then update by virtue
of the dispatched event?

Thanks in advance.

Jeff



--- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote:

 You are defining dynamic objects and they are not bindable.  If you
had a class that dispatched an event when the locale changed then it
should work.

\
-
 Is it possible to have an ArrayCollection value updated by a resource
bundle value.
 [Bindable]
 public var cbDP:ArrayCollection = new ArrayCollection();
 cbDP.addItem(
{label:ResourceManager.getInstance().getString('myResources','NAME') });

 When changing locales at runtime, all label fields of flex components
update but the ArrayCollection does not.

 Is the ResourceManager binding ignored on AC's? Is there another
solution?

 Thanks,

 Jeff





[flexcoders] Re: binding question?

2008-04-30 Thread emersonfcardoso
I guess it's needing [Bindable] somewhere in your code..

--- In flexcoders@yahoogroups.com, markflex2007 [EMAIL PROTECTED] 
wrote:

 I have two screens for testing.
 
 
 a) I set object values in screen 1 (for instance obj.value =abc) 
and
 go to screen 2
 b) I show the value in screen 2 with binding (for instance 
mx:Label
 x=37 y=46 text={obj.value}/ and go to screen 1
 
 
 it works fine when it excute first time.(from screen 1 to screen 2)
 
 Afater I change from screen 2 to screen 1,the binding value
 {obj.value} in screen 2 keep the previous value even if I change 
 the object values in screen 1 (for instance obj.value =xyz).
 
 but the binding value {obj.value}  should change to xyz,do you 
know
 why this happen.
 
 Thanks for your help.
 
 
 Mark





[flexcoders] Re: Binding Question to Value Object

2008-03-20 Thread Amy
--- In flexcoders@yahoogroups.com, donvoltz [EMAIL PROTECTED] wrote:

 Thanks for your help. I do not know why I thought updating a text
 field would automatically update the VO object. Your help is greatly
 appreciated. One more quick question about this, what is the best
 practice, to add the text fields to the value object when the form is
 submitted (button clicked) or to set up individual functions once each
 text field is changed?? I presented just a small portion of my form,
 in actuality I have about 35 fields that will contain user information

This is really strange.  I have pretty much exactly the same as you, 
where I have a ContactDetails object that has a firstName property that 
is bound to a textInput field's text property, and when I type into the 
field, it sets exactly as intended.  My class structure is that 
ContactDetails has a constructor that inits all the properties.  The 
firstName property has both a getter and setter, and it is of a data 
type that is also a custom class, DataItem.  DataItem has a constructor 
that sets it up with default values, and each property has a getter and 
setter.

Here are my classes in case you find them useful:

package com.magnoliamultimedia.vo
{
[Inspectable]
[Bindable]
public class ContactDetails
{
import com.magnoliamultimedia.vo.DataItem;

private var _fn:DataItem;//first name
private var _ln:DataItem;//last name
private var _country:DataItem;
private var _eMail:DataItem;
private var _phone:DataItem;
private var _aff:DataItem;//affiliation
private var _more:DataItem;
private var _allValid:Boolean;

public function ContactDetails(fn:String='', 
ln:String='', c:String='', e:String='', p:String='', aff:String='', 
m:String=''){
_fn=new DataItem(fn, 3, 50, true);  

_ln=new DataItem(ln, 3, 50, true);  

_country=new DataItem(c, 3, 50, true);  
_eMail=new DataItem(e, 3, 50, 
true, 'EMailValidator');
_phone=new DataItem(p, 7, 50);
_aff=new DataItem(aff, 0, 50);
_more=new DataItem(m, 0, 255);
}
public function get firstName():*{
return _fn;
}
public function set firstName(s:*):void{
if (s is String){
_fn.value = s;
} else if (s is DataItem){
_fn=s;
} else {
trace('invalid type at firstname');
}
}
public function get lastName():*{
return _ln;
}
public function set lastName(s:*):void{
if (s is String){
_ln.value = s;
} else if (s is DataItem){
_ln=s;
} else {
trace('invalid type at lastname');
}
}
public function get country():*{
return _country;
}
public function set country(s:*):void{
if (s is String){
_country.value = s;
} else if (s is DataItem){
_country=s;
} else {
trace('invalid type at country');
}
}
public function get eMail():*{
return _eMail;
}
public function set eMail(s:*):void{
if (s is String){
_eMail.value = s;
} else if (s is DataItem){
_eMail=s;
} else {
trace('invalid type at eMail');
}   
}
public function get phone():*{
return _phone;
}
public function set phone(s:*):void{
if (s is String){
_phone.value = s;
} else if (s is DataItem){
_phone=s;
} else {
trace('invalid type at phone');
}   
}
public function get aff():*{
return _aff;
}

[flexcoders] Re: Binding question

2005-03-23 Thread temporal_illusion


I tried something similar a while back as a quick and dirty way to 
change the web service between development and deployment, but could 
not get it to work.

I ended up creating a named service in the flex-config.xml and refer 
to that, so I only have to set up the service once and depending if 
my app was in dev, test, or production it would hit the correct 
internal service (also in dev, test, or production).

--- In flexcoders@yahoogroups.com, pilby1 [EMAIL PROTECTED] wrote:

 How can I then make my wsdl attribute in my mx:WebService a 
 variable?





 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/