Re: [flexcoders] Design Pattern/Best Practices for generic record 'list' and 'detail' view Component

2006-12-11 Thread Steve Hindle

Hi Lachlan,

 Sorry I couldn't get back to you sooner - its been a zoo here.  Thanks to
Matt, I've removed 1 set of problems (can't initialize [Bindable]'s during
declaration).  I think I've narrowed down what my remaining problem is, its
related to my no 'SHOW' event problem I posted about a while back.

 Basically, it appears that in nested containers, 'SHOW' and 'HIDE' are not
fired for every component or even every container.  The show/hide
fires on the outermost container only.  for instance, with the code below:

 When you 'tab' between 'component 1' and 'component 2', neither Canvas A
or B generates show Events
 When you switch between 'Canvas A' and 'Canvas B', neither 'embedded view'
generates show Events

I can understand this for performance reasons - it cuts down on the number
of events to be processed. However, it makes it hard for me to develop
'components' that don't have to be aware of their containment structure.  I
end up having to hard-code calls to 'showMe()' and 'hideMe()' in the parent
container(s).

I tried having the component listen for 'SHOW' events on its parent
container, but it can get very difficult to determine _what_ container you
should be listening to.  For instance, should emedded component 1 listen for
'SHOW' on Canvas A, or Component 2?  I've had instances where it should be
either or both!

Are there some patterns for developing reusable components like this, that
can be dropped anywhere? I'd like to just be able to add the component, give
it a dataProvider, and let it run.  Having to 'tweak' its display from the
parent container just seems wrong.  The component should be able to maintain
its own view state without outside help.

Steve

Code Follows:

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; width=400
height=400 
mx:Script
 ![CDATA[
   import flash.events.Event;
   public function H1(e:Event):void { trace(Component1 SHOW fired); }
   public function H2(e:Event):void { trace(Component2 SHOW fired); }
   public function H3(e:Event):void { trace(Canvas A SHOW fired); }
   public function H4(e:Event):void { trace(Canvas B SHOW fired); }
   public function H5(e:Event):void { trace(Embedded View Component 1 SHOW
fired); }
   public function H6(e:Event):void { trace(Embedded View Component 2 SHOW
fired); }
 ]]
/mx:Script
mx:TabNavigator width=100% height=100%
  mx:Canvas label=Component 1 show=H1(event)mx:Label text=Component
1 //mx:Canvas
  mx:Canvas label=Component 2 show=H2(event)
 mx:LinkBar dataProvider={foo} /
  mx:ViewStack id=foo top=25
 mx:Canvas label=Canvas A show=H3(event)
   mx:Label text=Component2 Canvas A /
   mx:Canvas top=25 show=H5(event)
  mx:Label text=Embedded View Component 1 /
   /mx:Canvas
 /mx:Canvas
 mx:Canvas label=Canvas B show=H4(event)
   mx:Label text=Component2 Canvas B /
   mx:Canvas top=25 show=H6(event)
  mx:Label text=Embedded View Component 2 /
   /mx:Canvas
 /mx:Canvas
  /mx:ViewStack
  /mx:Canvas
/mx:TabNavigator
/mx:Application


On 12/8/06, Lachlan Cotter [EMAIL PROTECTED] wrote:


  Hi Steve,

Is your problem to do with your rules about which view to display? If it's
getting a bit complicated or 'crufty', then you probably need another level
of abstraction. Encapsulate your rules about which view should be displayed
inside a getter called currentView. Bind your view stack to this.

Now you need to work out how that variable gets updated when appropriate.
One way is to make this a bindable property with a custom event type. Now
dispatch that event type when the length of dataProvider changes. Obviously,
your getter method for currentView has to contain the logic you described
for deciding which view to use.

Is that what you were looking for?

Cheers,
Lach




On 06/12/2006, at 5:27 AM, Steve Hindle wrote:

Hi All,

I'm trying to create a component to use as an example or 'template'
of how to achieve a record list and detail view in flex. I'm starting
with a simple 'contact' record (model) that has name, address, phone,
email, etc. The list of records is held in _dataProvider, and the
specific record to be displayed in the detail view is held in _model.
My goal is to have a nice clean skeleton of how to handle this sort of
display.

My component is a viewstack with 2 views:
View 0: a datagrid displaying summary info of a list of records
(title, first, last). Double click on an entry should
open it in the
'detail' view. dataProvider is bound to _dataProvider, an
arrayCollection.
View 1: a custom component that displays all my model fields.
It has a 'model' property that is used to set the
record to be displayed.
model is a single static instance of my record type, and
all fields in the
view are bound to it ( eg text='{_model.last_name}' )

The logic for the component is pretty simple:
1. Initial view is determined by _dataProvider.length
2. if _dataProvider.length = 1

Re: [flexcoders] Databinding eventlistner Toy, Unexplained errors and insights... Adobe Please Confirm

2006-12-11 Thread Steve Hindle

Hi Matt!

 Thanks for the reply.  Trying to look at the code again, I relized that
I've got to stop using gmail to read this list :-P  It does nasty things to
code listings.

 Anyway, I think I just explained things backwards as I was thinking more
about the final outcome.
 given:
   foo.addEventListener( // Add a listener to current foo object
   foo = bar  // reference assignment, foo is now an alias to
the bar object
   foo.setter = 'blah'  // This calls function set setter on the BAR
object, events are dispatched by BAR

 This means that the listener in line 1 never sees the event, as it was
generated by BAR.

 Clearing up the initializers on [Bindable] declarations, seemed to fix the
databinding not tracking properly,
 So THANKS! for that tip - its not something I would have guessed
(especially since it doesn't get flagged as
 error).

 I think you could have objects track assingment of themselves by having an
'AddressOf' hook internally...
   foo = bar translates to :  foo = bar.AddressOf
 This would let 'bar' keep track of when its being aliased.  I believe some
script languages such as Python and
  Ruby do it this way.  Might be overkill, but it can come in handy at
times...

 Thanks Again for the Help!
 Steve


On 12/7/06, Matt Chotin [EMAIL PROTECTED] wrote:


   Assuming your setters are all normal bindings should listen based on
how the references line up and should update to always accurately listen on
the objects referenced by the expression.  So however foo.bar evaluates,
that's what should be listened to.  If it's listening on the prior version
of _bar you have a bug somewhere.  It may be that the way you dispatch
events is not notifying the bindings correctly.



I'm pretty sure the initializer code won't work, though maybe we were able
to somehow fix that issue.



You have to remember that foo is a reference to some object, it is not
the object itself.  So when I say foo = bar, if foo was assigned to some
other object that other object will have no idea that foo no longer points
to it.  This isn't C++ with your own operator overloading for ref-counting
pointers J   The only object that can know that foo is being re-assigned
is that class that declares the foo variable.  That's the one where you can
have a setter, and it's in that setter that you know the re-assignment is
taking place.



We don't have a cheatsheet, that may be a good idea.



Matt


 --

*From:* [EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups.com] *On
Behalf Of *Steve Hindle
*Sent:* Wednesday, December 06, 2006 11:42 PM
*To:* flexcoders@yahoogroups.com
*Subject: *Re: [flexcoders] Databinding  eventlistner Toy, Unexplained
errors and insights... Adobe Please Confirm





Hi Matt,



  Thanks for the quick response!   I really appreciate the help and info.
I realize the dispatch in the ModelBase1.mxml  setter was a very crude
hack - I did it that way as 'this' in the mxml refers to the application
root tag, and not the component/object. Since I was binding the listeners to
'foo','bar','baz' - having the event fire on the application level didn't
get me anywhere... It just seemed like the quickest/easiest way to get the
'right' object to fire the event. I'll remember to steer clear of this in
the future...



The above code says that any instance of Foo will dispatch an event

called barChanged when that instance's bar references has been
reassigned.

That makes sense - but what happens to items that were databound or
listening to foo.bar ?  They continue to use the prior version/prior
object that was stored in _bar, don't they?  (ie. they don't get updated to
listen to the 'b:object' you passed in to 'set bar()' )  This was the real
crux of it for me - I use a 'temp' or 'currRec' in mxml's just for binding.
I have an accessor based property called 'model' on the mxml's that just
does currRec = blah.  It was _supposed_ to simplify my databinding, but I
think its causing a lot of subtle bugs.

var myFoo:Foo = new Foo(); //note that this probably doesn't work in real
code,

assigning in the initializer to a [Bindable] doesn't work



Really?!?! Acck - I do that allover the place!  This is gonna save me some
grief! Thanks!!



Also, having to listen explicitly sub-components(foo.bar)  was something I
hadn't considered.  I've prolly got a bunch of bugs related to that as well.


It would be kinda of nice if the object could 'listen to itself' - so if
you said foo = bar, the 'foo' object/class could throw an event directly,
instead of having the

calling component do it (ie - my setter hack in ModelBase1.mxml was due to
trying to catch explicit assignments.  If foo just thru the event for me, I
could have gotten rid of the getter/setter all together and still been
notified of assignments.)



There seems to be a bunch of restrictions on DataBinding - is there a
'cheatsheet' listing them? I've seen one about Collections not automatically
firing if an entire element

Re: [flexcoders] Re: BindSetter?

2006-12-06 Thread Steve Hindle

Thank You Lachlan!!!

I can't believe this isn't documented somewhere.
Seems like a pretty basic thing.

Anyway, glad to know I'm not going crazy..



On 12/5/06, Lachlan Cotter [EMAIL PROTECTED] wrote:


  I think you're right Steve. I have asked myself the same question in the
past and ended up using bindProperty… When you say *function set ():void*or 
function
*get ():Something *you're really telling the method to masquerade as a
property, so it makes sense that you can treat it as such. I have used *
BindingUtils.bindProperty* to bind a setter method and it seems to work.

Cheers,
Lach


On 04/12/2006, at 4:31 PM, Steve Hindle wrote:

Sorry for reply to myself - but this is driving me _nuts_! I can't
find an example of bindSetter with a 'real' accessor function with
either yahoo or google. And the example on the 'bindUtils' page at
adobe.com (stuck in the comments at the bottom) - doesn't bind to a
'function set blah'... (isn't that the _required_ to consider a
funciton/method a 'setter' ??) It just binds to a 'normal' function.

Anyway, I'm starting to think that 'bindSetter' is really a poorly
named 'bindFunction' and that _all_ properties - var OR accessor based
should be using bindProperty.

Can someone confirm/refute this and save my sanity please!

Thanks


 



[flexcoders] Base Classes, Bindable, and dispatchEvent

2006-12-06 Thread Steve Hindle
Hi All,

  I have a base class I use for models (ModelBase, original eh?) that
contains a 'set' function.  set(source:Model) - it simply copies
fields from the source model to 'this'.  Works great, except I'm not
sure how to let everyone know the model changed.

  The base class currently uses dispatchEvent(new
Event(ModelChanged)) to signal the change. Since I import
flash.events.*, I'm guessing this throws a flash.events.Event.

  Derived classes don't throw any events.

  Application code has:

 [Bindable (event=ModelChanged)]
 private var _model:DerivedClass;

and getter/setter for model.  The setter also uses dispatchEvent(new
Event(ModelChanged)).

Problem is, the setter in the application code trips the event
listener I added...
but set() in the base class doesn't cause it to fire..

Anyone have any ideas what the problem might be?


Re: [flexcoders] Date Fields and Data Binding.

2006-12-06 Thread Steve Hindle

Just a guess here - I just use vanilla Flex
Sounds like the field is not being assigned.  Since the field starts out as
blank in your model,
and your selecting another model with a blank field - perhaps Flex is
'short-circuiting' the
assignment.

I've noticed that for an assignment like foo = bar, Flex always seems to
call the getter for foo,
_before_ calling the setter.  I can only surmise this it to allow it to
short circuit the assignment
if foo = bar already.

So in your case, blank == blank, and no assignment is done, hence no event
fires ?


On 12/6/06, jsscardinal [EMAIL PROTECTED] wrote:


  I am attempting to do something I thought was pretty simple. Using the
cairngorm model, basically I have a data instance object attached to
the model, and it has a Data Object attached to it.

So think of it this way. I am running an application that tracks a
list of canidates. So there is a CanidateVO actionscript object, and
it has a member variable attached to it called interview date, and its
of type Date.

I am running a java backend retrieving these using spring and
hybernate, and the conversion works fine.

The problem I am having is with data binding in a grid and details
panel. The grid has an array collection which is attached to the
model, and that array contains a list of all the canidates, some that
have dates and some that dont. All have member variables, but since
all instances have not interviewed they may not have a value in the
date field, thus those member vars are null.

So the problem is that when I have a particular grid object selected,
I see the details of that canidate in the details panel, which is just
a panel that contains text fields and a dateField component. Well all
the other bindings are working fine, but not the dateField binding.

I have set the dateFields text bound to the attribute of the object,
and that does not work, and I have set the dataProvider and that does
not work, and I have even set a data attribute on the dateField and
that does not work.

Whats happening is, when I am looking at a particular canidate without
an interview date, and I select the dateField, then put a date in it
and DONT save the record but go to a different instance on the grid,
all the fields are updated except the dateField. The dateField text
remains there regardless of the fact that the selectedItem has
changed, and the new selectedItem has no date in it.

Conversly if I select a canidate who does have a date, the date is
displayed, but once I go to one without a date, the date stays in the
field. Why is data binding not working for dates?

Please help.

Jeremy.

 



[flexcoders] Databinding eventlistner Toy, Unexplained errors and insights... Adobe Please Confirm

2006-12-06 Thread Steve Hindle
Ok - I think I'm making some headway now.  Here's hoping this helps
someone else with similar problems.

For ages I've been plagued by 'odd' databinding problems.  Things
would work most of the time - then fail for 'no reason'...

Playing around tonight, I noticed some behaviors that I think explain
a bunch of the problems I've been having.  Perhaps others have had the
same problems, so here it is in a nutshell:  It appears eventlisteners
and databinding bind to the object - and _not_ the identifier/label.
This holds true even for accessor based properties.

This means that having a 'currentRec', that gets reset to point to
each object in a list for instance, can be very dangerous.  for
instance, if you have
  var currRec:MyRecord
and you use it in mxml databindings, the bindings get applied to the
object currRec reference when the component was initialized!  If you
later move another record into currRec, your databindings still point
to the FIRST object.

Could someone from Adobe confirm this?

Below is a little toy I wrote to test this stuff.  The trace output
supports the statement above.  Notice how after the assignment: baz =
bar, we start getting
trace output from the 'bar' eventlisteners. The 'baz' eventlisteners
no longer fire.
Play around with some of the commented out statements, and see how the
output changes - I was really surprised that statement ordering in the
setter made a difference!

Btw, If anyone can tell me why the PropertyChange handler doesn't
fire, I'd appreciate it!  I thought 'PropertyChange' was the default
event used by databinding?

Trace output:
Assign 1 model to another
BAZ:Model Changed Event Generated!  Event type: ModelChanged

Assign to accessorType
BAR:Model Changed Event Generated!  Event type: ModelChanged

Assign to var based property - Why doesn't the 'PropertyChange' handler fire?
call ModelBase.set()
BAR:Model Changed Event Generated!  Event type: ModelChanged

Test completed baz.accessorType: Steve
BAR:Model Changed Event Generated!  Event type: ModelChanged



==
ModelBase1.mxml
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
layout=absolute creationComplete=setup()
  mx:Script
![CDATA[
 import ModelBase;
 import DerivedClass;
 import mx.binding.utils.BindingUtils;
 import flash.events.*;

private var _baz:DerivedClass = new DerivedClass();

[Bindable (event=ModelChanged)]
public function get baz():DerivedClass { return _baz; }
public function set baz(v:DerivedClass):void {
  // Notice you get different handlers depending on which dispatch you use
  // also, the 'this.baz' is needed because 'this.dispatch' or
'dispatch' would
  // dispatch on the root tag (this = mx:Application)
  this.baz.dispatchEvent( new Event(ModelChanged));
  _baz = v;
  //this.baz.dispatchEvent( new Event(ModelChanged));
}

[Bindable (event=ModelChanged)]
private var foo:DerivedClass = new DerivedClass();
[Bindable (event=ModelChanged)]
private var bar:DerivedClass = new DerivedClass();

 public function setup():void {

   foo.addEventListener('ModelChanged',   foomodelChanged);
   foo.addEventListener('PropertyChange', foopropertyChanged);
   bar.addEventListener('ModelChanged',   barmodelChanged);
   bar.addEventListener('PropertyChange', barpropertyChanged);
   baz.addEventListener('ModelChanged',   modelChanged);
   baz.addEventListener('PropertyChange', propertyChanged);

   trace(Assign 1 model to another);
   baz = bar;

   trace(\nAssign to accessorType);
   baz.accessorType = Steve;

   trace(\nAssign to var based property - Why doesn't the
'PropertyChange' handler fire?);
   baz.varType = 'Whee!';

   trace(call ModelBase.set());
   baz.set(foo);

   trace(\nTest completed baz.accessorType:  + baz.accessorType);
 }

public function changeit():void {
  //bar.accessorType = 'Changed';
  baz.accessorType = 'Changed';
}

public function propertyChanged(e:Event):void {
  trace(BAZ:Binding detected a change!);
}
public function modelChanged(e:Event):void {
  trace(BAZ:Model Changed Event Generated!  Event type:  + e.type);
}

public function barpropertyChanged(e:Event):void {
  trace(BAR:Model Changed Event Generated!  Event type:  + e.type);
}
public function barmodelChanged(e:Event):void {
  trace(BAR:Model Changed Event Generated!  Event type:  + e.type );
}

public function foopropertyChanged(e:Event):void {
  trace(FOO:Model Changed Event Generated!  Event type:  + e.type );
}
public function foomodelChanged(e:Event):void {
  trace(FOO:Model Changed Event Generated!  Event type:  + e.type );
}

]]
  /mx:Script
  !-- I'd have expected this to work, but it doesn't as the object referenced
   by baz changes  --
  !--mx:Button id='b1' 

Re: [flexcoders] Databinding eventlistner Toy, Unexplained errors and insights... Adobe Please Confirm

2006-12-06 Thread Steve Hindle

Hi Matt,

 Thanks for the quick response!   I really appreciate the help and info.  I
realize the dispatch in the ModelBase1.mxml  setter was a very crude hack -
I did it that way as 'this' in the mxml refers to the application root tag,
and not the component/object. Since I was binding the listeners to
'foo','bar','baz' - having the event fire on the application level didn't
get me anywhere... It just seemed like the quickest/easiest way to get the
'right' object to fire the event. I'll remember to steer clear of this in
the future...


The above code says that any instance of Foo will dispatch an event
called barChanged when that instance's bar references has been

reassigned.

That makes sense - but what happens to items that were databound or
listening to foo.bar ?  They continue to use the prior version/prior object
that was stored in _bar, don't they?  (ie. they don't get updated to listen
to the 'b:object' you passed in to 'set bar()' )  This was the real crux of
it for me - I use a 'temp' or 'currRec' in mxml's just for binding.  I have
an accessor based property called 'model' on the mxml's that just does
currRec = blah.  It was _supposed_ to simplify my databinding, but I think
its causing a lot of subtle bugs.

var myFoo:Foo = new Foo(); //note that this probably doesn't work in real

code,

assigning in the initializer to a [Bindable] doesn't work


Really?!?! Acck - I do that allover the place!  This is gonna save me some
grief! Thanks!!

Also, having to listen explicitly sub-components(foo.bar)  was something I
hadn't considered.  I've prolly got a bunch of bugs related to that as well.
It would be kinda of nice if the object could 'listen to itself' - so if you
said foo = bar, the 'foo' object/class could throw an event directly,
instead of having the
calling component do it (ie - my setter hack in ModelBase1.mxml was due to
trying to catch explicit assignments.  If foo just thru the event for me, I
could have gotten rid of the getter/setter all together and still been
notified of assignments.)

There seems to be a bunch of restrictions on DataBinding - is there a
'cheatsheet' listing them? I've seen one about Collections not automatically
firing if an entire element of the underlying array was replaced.  And I
think there's one hiding in the short-circuit evaluation used with setters
(no store/event if value is already = new value).  Are there any more
'subtle' ones hiding out there ?

Thanks Again!







On 12/6/06, Matt Chotin [EMAIL PROTECTED] wrote:


   I'm having trouble following some of your logic, but I think you're
somewhat off track.  I didn't run your code but in looking at your
ModelBase1.mxml the setter for baz is very wrong.  Your setter should not
be telling the sub object to dispatch an event, the setter always dispatches
an event on the class itself.  When you write [Bindable] metadata you are
creating a contract that the watchers will then interpret.



Class Foo extends EventDispatcher

{



  Private var _bar:Object;

  [Bindable(event=barChanged)]

Public function get bar:Object{ return _bar; }



Public function set bar(b:Object):void

{

  _bar = b;

  dispatchEvent(new Event(barChanged));

}

}



The above code says that any instance of Foo will dispatch an event called
barChanged when that instance's bar references has been reassigned.



[Bindable]

var myFoo:Foo = new Foo(); //note that this probably doesn't work in real
code, assigning in the initializer to a [Bindable] doesn't work



mx:Binding source=myFoo destination=myOtherFoo /



The only time that the above binding will fire is when I do something like
myFoo = someOtherFoo.  That binding should not fire if I do myFoo.bar =
someOtherBar.



Now if I have a binding like this:



mx:Binding source=myFoo.bar destination=myOtherFoo.bar /



The binding will fire under two conditions:

1)   when myFoo is re-assigned to something else, myFoo = someOtherFoo

2)   when the bar instance on myFoo is re-assigned: myFoo.bar =
someValue.

a.   Var mySecondFoo = myFoo; mySecondFoo.bar = someValue.  Note here
that mySecondFoo == myFoo.  So a change to the bar property is a change to
the same object, and therefore the bindings will fire.



I hope this helps clarify a little.  To re-iterate, when you write a
setter, for the purpose of binding you should never dispatch on the
sub-object, the only way you should see dispatchEvent is either on its own
or this.dispatchEvent.  Never this.anything.dispatchEvent.



Matt


 --

*From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
Behalf Of *Steve Hindle
*Sent:* Wednesday, December 06, 2006 9:50 PM
*To:* flexcoders@yahoogroups.com
*Subject:* [flexcoders] Databinding  eventlistner Toy, Unexplained errors
and insights... Adobe Please Confirm



Ok - I think I'm making some headway now. Here's hoping this helps
someone else with similar problems.

For ages I've been plagued by 'odd' databinding problems. Things
would work most

[flexcoders] Design Pattern/Best Practices for generic record 'list' and 'detail' view Component

2006-12-05 Thread Steve Hindle
Hi All,

  I'm trying to create a component to use as an example or 'template'
of how to achieve a record list and detail view in flex.  I'm starting
with a simple 'contact' record (model) that has name, address, phone,
email, etc.  The list of records is held in _dataProvider, and the
specific record to be displayed in the detail view is held in _model.
My goal is to have a nice clean skeleton of how to handle this sort of
display.

  My component is a viewstack with 2 views:
   View 0: a datagrid displaying summary info of a list of records
   (title, first, last). Double click on an entry should
open it in the
   'detail' view.  dataProvider is bound to _dataProvider, an
   arrayCollection.
   View 1: a custom component that displays all my model fields.
   It has a 'model' property that is used to set the
record to be displayed.
  model is a single static instance of my record type, and
all fields in the
  view are bound to it ( eg text='{_model.last_name}' )

  The logic for the component is pretty simple:
 1. Initial view is determined by _dataProvider.length
 2. if _dataProvider.length = 1, default to 'detail' view of that record
 3. if _dataProvider.length  2, default to 'list' view
 4. if _dataProvider.length = 0, add a new empty record and
default to 'detail'
view to allow data entry.

This mostly works - however, I run into 'odd' problems with
dataBinding and Initialization, etc.  As my script gets cruftier with
all sorts of special case logic, and
manually poking stuff to get dataBindings updated, I wonder if perhaps
others have a better Design Pattern or template for this ??

I'd appreciate any feedback...


Re: [flexcoders] Re: Feature request? Ability to apply multiple states or views at once..

2006-12-03 Thread Steve Hindle

I don't think so...
I'm not sure how splitting this up would help...I'd just end up scattering
the stuff all over?
It also seems like it would be a P.I.T.A. to have to manually select the
correct view for
8 child components vs 1 call to an 'enhanced' state function that
could 'run' multiple states on a single component.

I have multiple items that really 'feel' like they belong in the component:
 editable fields/display-only, saveButton/NoSaveButton,
deleteButton/noDeleteButton, notes/noNotes,
and updatedBy/updatedAt are some off the top of my head.  So I'd end up with
6+ 'sub-components' for each form?  Seems like it would get unwieldy
quickly?

Thinking about it - Flexbuilder could probably 'dummy it up' by generating
all the view combinations, so that the standard player state functions would
work. (hehe - a pure, brute force combinatorial approach would sure make for
some large source files though :-P )



On 12/2/06, Mark Shepherd [EMAIL PROTECTED] wrote:


  Each component (in other words, each MXML file, including the main
application) can have its own states. So if your Notes area is in a
separate MXML file, then it can have its own set of states. Same for
any other discrete area of the screen that needs to have separate states.

Does this help?

Mark Shepherd
Adobe FlexBuilder Engineering
mark-shepherd.com





[flexcoders] BindSetter?

2006-12-03 Thread Steve Hindle
I've got to be missing something silly here:

  _model:Model;

BindSetter(_model.title,...   ? String to Function coercion error
BindSetter(_model.title()...  ? Inaccessible method title error

I thought about _model.title as Function - but that seems like it
would interpret the title string as a function name ?  So what is the
right syntax for this?

I also noticed the same problem with setters defined in the same AS
file - I get a 'blah to Function coercion error' ??

TIA!


Re: [flexcoders] Simple Question - Array to ArrayCollection - Best Practice/CFusion

2006-12-03 Thread Steve Hindle

I didn't think you could do that (cast) - I thought you needed to create a
new ArrayCollection _based_ on the array? (ie  var ac:ArrayCollection = new
ArrayCollection(myArray) )



On 12/3/06, lostinrecursion [EMAIL PROTECTED] wrote:


  Hi all,

This is a best practice question really.

I use Cairngorm for the larger apps I build. I also use Coldfusion and
the nifty class mapping that it can perform between DTOs (or VOs,
whatever you call them)

Here's the conundrum. A lot of my top level classes have
ArrayCollections of other supporting classes.

For example: Workplace class has a collection called Employees, which
very possibly could have its own set of collections called Vehicles,
all custom VO classes.

So, when i get them back from Coldfusion and they come in as an Array,
I know that in order to use them as a dataProvider, you need to cast
them as ArrayCollection.

So far, so good.

But if I just do this: {model.workplace.employees as ArrayCollection}
in the dataProvider property, sometimes I receive coercion errors if
the returning array is one element.

Bottom Line: In a Cairngorm app, where is the best place to do my
casting or conversion of arrays??





Re: [flexcoders] Re: Feature request? Ability to apply multiple states or views at once..

2006-12-03 Thread Steve Hindle

Hi Dustin,

 It's very gracious of you to offer, and I'd appreciate the help.  However,
I've 'worked around' this using 'copy and paste' coding to replicate the
state info, and moving some of the button stuff out to the application bar.
I really won't have anytime to spend on improving this till I get the rest
of the app. in shape.

I'm not sure a 'snippet' will really work - because it only becomes
valuable when you have lots of stuff to track...
If it was just a 1 button sort of thing, you could just inline it.  Let me
see if I can come up with something.

Steve


On 12/3/06, Dustin Mercer [EMAIL PROTECTED] wrote:


   Steve, I would love to help you with this, would you mind posting a
small snippet of code that we can work with.  I have some ideas to help
simplify this, but want to make sure I understand exactly what you are
working with before getting too detailed.  You don't have to post anything
too elaborate, just something small.  I am thinking we can get a hybrid
approach with binding / states to do what you want.  I have had some
situations like this arise as well, and that seemed to be the best way to
get what I wanted.



Dustin Mercer


 --

*From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
Behalf Of *Steve Hindle
*Sent:* Sunday, December 03, 2006 1:56 PM
*To:* flexcoders@yahoogroups.com
*Subject:* Re: [flexcoders] Re: Feature request? Ability to apply multiple
states or views at once..





I don't think so...

I'm not sure how splitting this up would help...I'd just end up scattering
the stuff all over?

It also seems like it would be a P.I.T.A. to have to manually select the
correct view for

8 child components vs 1 call to an 'enhanced' state function that
could 'run' multiple states on a single component.



I have multiple items that really 'feel' like they belong in
the component:

  editable fields/display-only, saveButton/NoSaveButton,
deleteButton/noDeleteButton, notes/noNotes,

and updatedBy/updatedAt are some off the top of my head.  So I'd end up
with 6+ 'sub-components' for each form?  Seems like it would get unwieldy
quickly?



 Thinking about it - Flexbuilder could probably 'dummy it up' by
generating all the view combinations, so that the standard player state
functions would work. (hehe - a pure, brute force combinatorial approach
would sure make for some large source files though :-P )





On 12/2/06, *Mark Shepherd* [EMAIL PROTECTED] wrote:

Each component (in other words, each MXML file, including the main
application) can have its own states. So if your Notes area is in a
separate MXML file, then it can have its own set of states. Same for
any other discrete area of the screen that needs to have separate states.

Does this help?

Mark Shepherd
Adobe FlexBuilder Engineering
mark-shepherd.com







[flexcoders] Re: BindSetter?

2006-12-03 Thread Steve Hindle
Sorry for reply to myself - but this is driving me _nuts_!  I can't
find an example of bindSetter with a 'real' accessor function with
either yahoo or google.  And the example on the 'bindUtils' page at
adobe.com (stuck in the comments at the bottom) - doesn't bind to a
'function set blah'... (isn't that the _required_ to consider a
funciton/method a 'setter' ??)  It just binds to a 'normal' function.

Anyway, I'm starting to think that 'bindSetter' is really a poorly
named 'bindFunction' and that _all_ properties - var OR accessor based
should be using bindProperty.

Can someone confirm/refute this and save my sanity please!

Thanks

On 12/3/06, Steve Hindle [EMAIL PROTECTED] wrote:
 I've got to be missing something silly here:

  _model:Model;

 BindSetter(_model.title,...   ? String to Function coercion error
 BindSetter(_model.title()...  ? Inaccessible method title error

 I thought about _model.title as Function - but that seems like it
 would interpret the title string as a function name ?  So what is the
 right syntax for this?

 I also noticed the same problem with setters defined in the same AS
 file - I get a 'blah to Function coercion error' ??

 TIA!



[flexcoders] Feature request? Ability to apply multiple states or views at once..

2006-12-02 Thread Steve Hindle
Hi All,

  I've been working on some basic CRUD screens, where it would be
really useful to be able to apply either multiple states or multiple
views at once (I think states would be better...)

  for instance, I have a 'show' state that goes thru and makes all my
text entry fields non-editable. This gives me a nice 'display only'
version of my input record.  I also have a large text-area for 'notes'
on the records - which I don't always want to show (to conserve screen
space).  So I have a 'noNotes' view state.  Unfortunately, if I want
to have a 'show,noNotes' state I have to replicate both the previous
states to achieve it...

  It would be great to be able to specify that both the show and
noNotes states should be applied.


Re: [flexcoders] Feature request? Ability to apply multiple states or views at once..

2006-12-02 Thread Steve Hindle

Hi Dustin,

 It's 'based on' that actually 'teased' me with this...
As you start having more 'optional' things in the component
('noNotes','noSaveButton',etc), you end up with a 'states explosion'...
'based on' gets about half-way there, so I figured it could be enhanced to
handle the rest?
I could do it all by manually adding/removing child components, but that
seems like overkill.

Thanks!


Re: [flexcoders] building reusable, 'stacking' components

2006-12-01 Thread Steve Hindle

Hi Igor,

  Sizes are fine - I'm already using percentage widths.  The problem is
sometimes I want the component to use a tabNavigator and sometimes I want it
to use a linkBar, etc.  The basic criteria is the 'outermost' component on
the page should use a TabNavigator, and components inside that should use a
linkbar.   Having mulitple tabNavigator components 'inside' each other is
just looking nasty - and is rather confusing.  So if I'm using the component
'stand-alone' - it should have a tabNav, but if I stack it inside another
component, it should use a more discreet nav.

 The problem boils down to:  How can I make the components container
'selectable' at run-time?  So I can
something like: ns:MyComponent nav_interface=tab / or ns:MyComponent
nav_interface=buttons /
I've thought about using addChild to build the components dynamically - but
that seems like over killl


On 12/1/06, Igor Costa [EMAIL PROTECTED] wrote:


  Steve

Nope you don't have to create 2 or 3 types of version, you just be more
reusable as possible just setting the width and height size for percentage.
Due to you can uses in other containers that you specifies the sizes and
positions.


Best.


On 11/30/06, Steve Hindle [EMAIL PROTECTED] wrote:

   Hi All,

 Anyone got any good design patterns for building components that can
 be stacked inside other components and still look good visually? I'm
 ending up in nested tabNavigator hell...

 When you build components that can be used both stand-alone (top
 level) or included _inside_ another component - how do you organize
 the component, and what nav containers do you use ?

 Do I really have to create 2 or 3 versions of the component (with
 tabs,with linkbar, with...)
 or is there a way of switching the container at runtime? ( I thought
 about building dynamically with addChild, getting the navcontainer to
 use from a property...)

 Thanks!




--

Igor Costa
www.igorcosta.com

 



Re: [flexcoders] Component behavior when child of navigation container

2006-12-01 Thread Steve Hindle

This sort of thing drove me batty with Flex...
I finally ended up doing all init. in createComplete methods for each child
container (ie, when a child builds itself, it initializes itself)

This means I have to sprinkle if (child != null)... around the parent
container
though

Another problem I ran into related to using properties (getters/setters)
in the mxml (ns:MyComponent CoolProperty=fooby /) :
1.) 'getters' are called before the setter
  I guess this is for optimization - don't set the value if its already
set?
 Anyway, it meant my 'getters' had to work with un-initialzed data
2.) 'setters' called from the mxml could fire before initialization
completes
   it appears from 'trace' data that the call ordering is less then
intuative -
   if I recall correctly, the exact problem was that 'set' function could
   be called before the object and its children are fully initialized.
   Ended up having to handle null pointers in the setters too
3.) !!!  bad trace() calls are silently swallowed!
  This one really bugged me - if I stuck:
  trace(fooby.name:  + fooby.name)
  in a function, and fooby was null - then the Trace statement failed
  silently AND THE REST OF THE FUNCTION DIDN'T EXECUTE!!
  It was like the exception caused the function to return...
  Not exactly intuative behavior for a debugging function

Steve

On 12/1/06, Sergey Kovalyov [EMAIL PROTECTED] wrote:


  Hi All!

I create the component using code behind technique (MXML inherited
from ActionScript class inherited from framework class, Box in my
case). The component contains children defined in MXML and has some
properties that have influence on children behavior. I call
invalidateProperties() in setters and then assign some cached values
to particular children properties in commitProperties(). Everything
works ok, until you place this component instance as a child of
navigation container, ViewStack in my case - createChildren() and
commitProperties() are called when ViewStack is created, though its
grandchildren are not created, so null pointer exception is thrown.
How to fix it?

Sergey.
 



[flexcoders] building reusable, 'stacking' components

2006-11-30 Thread Steve Hindle
Hi All,

  Anyone got any good design patterns for building components that can
be stacked inside other components and still look good visually?  I'm
ending up in nested tabNavigator hell...

  When you build components that can be used both stand-alone (top
level) or included _inside_ another component - how do you organize
the component, and what nav containers do you use ?

  Do I really have to create 2 or 3 versions of the component (with
tabs,with linkbar, with...)
or is there a way of switching the container at runtime? ( I thought
about building dynamically with addChild, getting the navcontainer to
use from a property...)

Thanks!


Re: [flexcoders] Re: to form or not to form that is my question

2006-11-29 Thread Steve Hindle

I'd love an explanation too - I skipped them myself.


On 11/29/06, bghoward3 [EMAIL PROTECTED] wrote:


  that is my main issue as well layout seems to be a hassle

please someone in the know add somthing here, my development is
stalled until i have a clear understanding of why to use or not use

thanks
--- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Ben
Marchbanks [EMAIL PROTECTED] wrote:

 I was wondering the same - everything seems to
 work just fine without using form and formItems.

 I found that the form component seem to make it
 more difficult to create and size the layout objects.

 I am not using either and have no problems using
 just textInput and labels instead.

 Ben Marchbanks

 ::: alQemy ::: transforming information into
 intelligence
 http://www.alQemy.com

 ::: magazooms ::: digital magazines
 http://www.magazooms.com

 Greenville, SC
 864.284.9918

 bghoward3 wrote:
  can somone enlighten me on the benefit to using
 forms and form items instead of simply using text
 input boxes
 
  thanks
 


 



Re: [flexcoders] To Adobe - new release improvements??

2006-11-29 Thread Steve Hindle

Will 2.0.1 have Flex builder on a more recent eclipse?
I'd also love an eclipse 'quick fix' or whatever they call it for
changing a property from variable based to getter/setter based!


On 11/29/06, David Mendels [EMAIL PROTECTED] wrote:


   Hi,

It may be worth adding however that we are of course working on
significant Flex Builder improments (and SDK and FDS) that will show up in
releases after Flex 2.0.1.

I wouldn't want you to think we are resting where we are.

Regards,
David
Adobe

 --
*From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
Behalf Of *Matt Chotin
*Sent:* Wednesday, November 29, 2006 1:17 AM
*To:* flexcoders@yahoogroups.com
*Subject:* RE: [flexcoders] To Adobe - new release improvements??

  The performance is on par with 2.0, we didn't make any major
improvements, sorry.  Nor are project path issues addressed.  Number of bugs
fixed between SDK and Flex Builder is over 500 though.

Matt

 --

*From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
Behalf Of *Daniel Wabyick
*Sent:* Tuesday, November 28, 2006 9:35 AM
*To:* flexcoders@yahoogroups.com
*Subject:* [flexcoders] To Adobe - new release improvements??

  Hey Adobe guys,

Is it possible for you to address some of the major (or non-major)
improvements in the coming Flex release?

In particular, I am keen to know if there were significant improvements
made to Flexbuilder itself. Stuff like increased compiler performance,
ease of use with relative paths, etc would be of interest to me. A
close second would be roughly the number of bugs fixed in the actually
Flex UI framework.

As my project continues to grow, I am definitely getting antsy for a new
release!

Thanks,
-Daniel

  



[flexcoders] Bug? - field not visible?

2006-11-29 Thread Steve Hindle
I just spent _hours_ chasing this one down...
I have an mxml component that displays a model.  Text fields are
editable to allow data entry.  If I enter text in field 'a' and hit
tab to go to field 'b' - all  text in field 'b' is now highlighted.
If I then load a new model into the component (I have a 'return to
list' button at the bottom of the app), text in field 'b' is invisible
until I click inside field 'b'...Once I click on it, the proper text
is displayed.

Very odd...


[flexcoders] DataBinding Vs. Procedural Model Updates

2006-11-25 Thread Steve Hindle
Hi All,

  Anyone know the performance implications of using databinding to
update a model vs an 'updateModel()' type call?

  I can use basic databinding to bind a form to the model
(source={foo.customer_name}) and databinding calls to bind
foo.customer_name back to the form control (so your model is updated
everytime a form field is updated).  This has the advantage that your
model is always up to date with respect to the form - no extra
processing required.

 I could also just use the basic databinding to bind the form controls
to the model, and an UpdateModel(m:Model) call to grab the contents of
all the fields and shove them back into the model.  This requires an
extra function call to 'sync' the model with the form, but skips all
the event handling (for instance, if you update the 'customer_name'
control 3 times, you only update the model once at the end)

  Anyone know how much of a load data binding/event processing puts on
the system with a moderately complicated app?  I'm figuring 10-20
tables of 20-40 fields each.  This is for a data entry app, so users
will be in all parts of the app all day long.  Should I be looking at
un-binding models when they are not used/active (ie, if you switch
from clients to vendors, should I unbind the fields on the 'clients'
model ?)

steve


Re: [flexcoders] multi-form data sharing

2006-11-16 Thread Steve Hindle

I think my basic problem is I'm trying to dynamically add components at
run-time.  Therefore, I don't have a mx component to reference in the
file.  I'm using static vars to grab a 'handle' to all the components at
start-up. (private static var DES:DataEntryScreen = new DataEntryScreen() ).
I then use addChild to add the component to the mainForm.  But this makes it
rather cumbersome to access stuff ...

I'm working through it though...

Thanks for the help!
Steve

On 11/14/06, Dimitrios Gianninas [EMAIL PROTECTED]
wrote:


   1) Look into FDS, it will manage your entity for you, and you can just
take the model and send it back to the server for update. If your binding is
setup properly the screen will refresh accordingly.

1b) Just use inline binding, ex: mx:TextInput  text={someModel.lastName
}/



*Dimitrios Gianninas*
*RIA Developer*
*Optimal Payments Inc.*


 --
*From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
Behalf Of *Steve Hindle
*Sent:* Monday, November 13, 2006 9:31 PM
*To:* flexcoders@yahoogroups.com
*Subject:* [flexcoders] multi-form data sharing

 Hi All,

I have a couple of questions regarding flex and a 'typical' business
app. I have a number of databases I perform CRUD operations on
(client,manufacturer, productt,etc.). So I created a model and a set
of 'views' for each database (mfgNew,mfgFind,mfgEdit, etc). A number
of the 'views' have a 'model' attribute that allow me to pass in the
'current record' to edit, etc.

My 'main' application creates a menubar with an entry for each record
type and a drop down to select add,find,edit, etc. It also creates
'current record' holders for each model.

My questions are:

1.) How do I pass back the changed record to update 'current record'
I understand this should be done using events/listeners, but this
seems to require cluttering up the 'main' app with lots of
'boilerplate' code. Shouldn't the component be able to handle this
itself?

1b.) Instead of EventListeners I've been expermenting with Binding
for instance before switching to the Mfg. 'find' screen, I execute:
BindingUtils.bindProperty(this, currMfgRec, mfgFind, selectedItem);
This seems to work - but I'm worried it happens every time the menu
entry is selected...
Will I end up with 'multiple' bindings of currMfgRec to
mfgFind.selectedItem?
If I used EventListeners -
Do I need to remove the old listener when I don't want it anymore (How?)
Or do I just assign a different listener to the same component/event ?

2.) How do you easily switch components from the menu ?
my current code requires a helper function, knowledge of the internal
structure of the component, and calls to mainMenu.getChildByName() to
find all the required bits...
before finally calling mainMenu.SelectedChild(). This seems like it
would be slow but is needed because some of my components are view
stacks with TabNavigators that need to be set back to the first tab on
a 'switch'. Do you just create helper functions in the component for
all the views/states/etc combinations you call often?

Sorry this got so long - its just feeling like I'm doing too much
'housekeeping' and I must have missed something along the way. Do
flex apps really require so much 'internal' knowlege of components?
Do they really require so much 'housekeeping' code to wire everything
together?

Steve

*AVIS IMPORTANT*

*WARNING*

Ce message électronique et ses pièces jointes peuvent contenir des
renseignements confidentiels, exclusifs ou légalement privilégiés destinés
au seul usage du destinataire visé. L'expéditeur original ne renonce à aucun
privilège ou à aucun autre droit si le présent message a été transmis
involontairement ou s'il est retransmis sans son autorisation. Si vous
n'êtes pas le destinataire visé du présent message ou si vous l'avez reçu
par erreur, veuillez cesser immédiatement de le lire et le supprimer, ainsi
que toutes ses pièces jointes, de votre système. La lecture, la
distribution, la copie ou tout autre usage du présent message ou de ses
pièces jointes par des personnes autres que le destinataire visé ne sont pas
autorisés et pourraient être illégaux. Si vous avez reçu ce courrier
électronique par erreur, veuillez en aviser l'expéditeur.

This electronic message and its attachments may contain confidential,
proprietary or legally privileged information, which is solely for the use
of the intended recipient. No privilege or other rights are waived by any
unintended transmission or unauthorized retransmission of this message. If
you are not the intended recipient of this message, or if you have received
it in error, you should immediately stop reading this message and delete it
and all attachments from your system. The reading, distribution, copying or
other use of this message or its attachments by unintended recipients is
unauthorized and may be unlawful. If you have received this e-mail in error,
please notify the sender.

 



[flexcoders] Event fired _every_ time a component is made visible/active

2006-11-16 Thread Steve Hindle
Hi All,

  There was a discussion recently about how to detect when a component
becomes visible/active.  It basically proposed 3 methods:
creationComplete(), show()/hide(), and UpdateDisplayList().  However,
these all seem to have problems:
  creationComplete() - only fires when the component is created
  show()/Hide() - not applicable if your using selectedChild
to switch views
  UpdateDisplayList - Eek - gotta go to 'internals' to accomplish this
?? scary...
Really seems like overkill for this
particular usage.

Are there any other/simpliar methods for determining when a child is
made active/visible?

For example, I'd like to re-initialize a component each time I switch to it...
First time - no problem, creationComplete is called and my init runs.
However, if I switch to a different component using a menubar (and
selectedChild)
and then come back to the original component, how do I get my init
function called again?

Steve


Re: [flexcoders] [ADV] New version of Flexible Rails book available (Alpha version 5)

2006-11-16 Thread Steve Hindle

Hi Peter,

 Could I suggest making a full table of contents available in an easy to
spot place on the website?

Also, does the book cover Flex and Rails login/auth systems (AAA, etc),
sessions, etc?
It appears 'iteration03' might cover some of this?

I'm currently building a rails app with a flex front end, and would probably
buy the book if it
covered these topics.  BTW, I'm basically using a RESTFul approach as you
mention -
I use the trestle scaffold generator and :render xml for flex-Rails comms.

Steve

On 11/9/06, Peter Armstrong [EMAIL PROTECTED] wrote:


  Hi all,

I've uploaded the fifth Alpha version of Flexible Rails. See
http://www.flexiblerails.com for details.

This is an in-progress, PDF-only book about using Rails 1.1 and Adobe
Flex 2 to build Rich Internet Applications (RIAs).

The two main highlights of this version are:

1. I have added a new iteration (Iteration 19: Validation), which
explains how to integrate Rails Validation with Flex Validation.

2. I have reformatted almost all the code samples in the book, based
on feedback from readers of earlier versions.

Since posting the initial announcement to this list two months ago,
the book has grown from 214 pages (169 pages + Preface and Appendices)
to 309 pages (264 pages + Preface and Appendices). My current
estimate is that the book is about half done.

Readers of earlier versions can, of course, download their free
updates via the usual method.

Thanks,
Peter Armstrong
 



Re: [flexcoders] Event fired _every_ time a component is made visible/active

2006-11-16 Thread Steve Hindle

well - show event doesn't appear to fire unless I manually twiddle with
.visible

Using the parents change event means I can't just add my component to a
plain old canvas as Canvas doesn't fire change..
So my component needs to know more about how its being used then really
seems proper for a reusable component ?

Am I missing something here? Surely other people have run across the same
situation ?  Mostly I just want my component to reset its
tab navigator to the first tab each time its shown (I do other stuff too).
It really can't be this unusual can it ?

Steve

On 11/16/06, Steve Hindle [EMAIL PROTECTED] wrote:



Hi Matt,

  Hmm - that might work, if I use the .parent field to find the components
parent I could avoid hard coding parent names,etc...
But it feels like it violates encapsulation - the component really
shouldn't need to 'poke' its parent just
to find out when its being used/viewed.

 I'll also experiment more with show/hide - maybe I missed something in
the docs...

Thanks!
Steve

On 11/16/06, Matt Chotin [EMAIL PROTECTED] wrote:

Could you use the CHANGE event from the view stack instead?  Though I
 would have expected the SHOW event to fire on the component anyway.


  --

 *From:* [EMAIL PROTECTED] ups.com [mailto:[EMAIL PROTECTED] ups.com]
 *On Behalf Of *Steve Hindle
 *Sent:* Thursday, November 16, 2006 1:01 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] Event fired _every_ time a component is made
 visible/active



 Hi All,

 There was a discussion recently about how to detect when a component
 becomes visible/active. It basically proposed 3 methods:
 creationComplete(), show()/hide(), and UpdateDisplayList(). However,
 these all seem to have problems:
 creationComplete() - only fires when the component is created
 show()/Hide() - not applicable if your using selectedChild
 to switch views
 UpdateDisplayList - Eek - gotta go to 'internals' to accomplish this
 ?? scary...
 Really seems like overkill for this
 particular usage.

 Are there any other/simpliar methods for determining when a child is
 made active/visible?

 For example, I'd like to re-initialize a component each time I switch to
 it...
 First time - no problem, creationComplete is called and my init runs.
 However, if I switch to a different component using a menubar (and
 selectedChild)
 and then come back to the original component, how do I get my init
 function called again?

 Steve

  






Re: [flexcoders] Event fired _every_ time a component is made visible/active

2006-11-16 Thread Steve Hindle

Hi Matt,

 Hmm - that might work, if I use the .parent field to find the components
parent I could avoid hard coding parent names,etc...
But it feels like it violates encapsulation - the component really shouldn't
need to 'poke' its parent just
to find out when its being used/viewed.

I'll also experiment more with show/hide - maybe I missed something in the
docs...

Thanks!
Steve

On 11/16/06, Matt Chotin [EMAIL PROTECTED] wrote:


   Could you use the CHANGE event from the view stack instead?  Though I
would have expected the SHOW event to fire on the component anyway.


 --

*From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
Behalf Of *Steve Hindle
*Sent:* Thursday, November 16, 2006 1:01 PM
*To:* flexcoders@yahoogroups.com
*Subject:* [flexcoders] Event fired _every_ time a component is made
visible/active



Hi All,

There was a discussion recently about how to detect when a component
becomes visible/active. It basically proposed 3 methods:
creationComplete(), show()/hide(), and UpdateDisplayList(). However,
these all seem to have problems:
creationComplete() - only fires when the component is created
show()/Hide() - not applicable if your using selectedChild
to switch views
UpdateDisplayList - Eek - gotta go to 'internals' to accomplish this
?? scary...
Really seems like overkill for this
particular usage.

Are there any other/simpliar methods for determining when a child is
made active/visible?

For example, I'd like to re-initialize a component each time I switch to
it...
First time - no problem, creationComplete is called and my init runs.
However, if I switch to a different component using a menubar (and
selectedChild)
and then come back to the original component, how do I get my init
function called again?

Steve

 



SOLVED:Re: [flexcoders] Event fired _every_ time a component is made visible/active

2006-11-16 Thread Steve Hindle

Ok - This is still a bit more work then it should be, but seems to be the
least invasive method:
 Hook this.added and this.removed.
These events will fire once for each sub-component in your component, so you
need to use a state flag  and _only_ perform your setup/cleanup when the
state transitions.

But - on the plus side, it will fire each time your component is made
visible, and it doesnt require knowing anything about your parent, or what
type of container you embedded in, etc.

Thanks All,
Steve

On 11/16/06, Steve Hindle [EMAIL PROTECTED] wrote:



well - show event doesn't appear to fire unless I manually twiddle with
.visible

Using the parents change event means I can't just add my component to a
plain old canvas as Canvas doesn't fire change..
So my component needs to know more about how its being used then really
seems proper for a reusable component ?

Am I missing something here? Surely other people have run across the same
situation ?  Mostly I just want my component to reset its
tab navigator to the first tab each time its shown (I do other stuff
too).  It really can't be this unusual can it ?

Steve

On 11/16/06, Steve Hindle [EMAIL PROTECTED] wrote:


 Hi Matt,

   Hmm - that might work, if I use the .parent field to find the
 components parent I could avoid hard coding parent names,etc...
 But it feels like it violates encapsulation - the component really
 shouldn't need to 'poke' its parent just
 to find out when its being used/viewed.

  I'll also experiment more with show/hide - maybe I missed something in
 the docs...

 Thanks!
 Steve

 On 11/16/06, Matt Chotin [EMAIL PROTECTED] wrote:
 
 Could you use the CHANGE event from the view stack instead?  Though
  I would have expected the SHOW event to fire on the component anyway.
 
 
   --
 
  *From:* [EMAIL PROTECTED] ups.com [mailto: [EMAIL PROTECTED]
  *On Behalf Of *Steve Hindle
  *Sent:* Thursday, November 16, 2006 1:01 PM
  *To:* flexcoders@yahoogroups.com
  *Subject:* [flexcoders] Event fired _every_ time a component is made
  visible/active
 
 
 
  Hi All,
 
  There was a discussion recently about how to detect when a component
  becomes visible/active. It basically proposed 3 methods:
  creationComplete(), show()/hide(), and UpdateDisplayList(). However,
  these all seem to have problems:
  creationComplete() - only fires when the component is created
  show()/Hide() - not applicable if your using selectedChild
  to switch views
  UpdateDisplayList - Eek - gotta go to 'internals' to accomplish this
  ?? scary...
  Really seems like overkill for this
  particular usage.
 
  Are there any other/simpliar methods for determining when a child is
  made active/visible?
 
  For example, I'd like to re-initialize a component each time I switch
  to it...
  First time - no problem, creationComplete is called and my init runs.
  However, if I switch to a different component using a menubar (and
  selectedChild)
  and then come back to the original component, how do I get my init
  function called again?
 
  Steve
 
   
 






Re: [flexcoders] Re: unable to load wsdl?? flex, you're pissing me off...

2006-11-03 Thread Steve Hindle



Works fine in FF 1.5.0.7 Win here...On 11/1/06, Jason [EMAIL PROTECTED]
 wrote:












  



Can anyone out there can confirm that the example here:
http://blog.wrench.com.au/wp-content/uploads/Flex/converter2/Converter.html

 actually works in Firefox (I'm using 1.5.0.7 and the 
9.0.16.0 debug
version of the flash player) ???


__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Software development tool
  
  
Software development
  
  
Software development services
  
  


Home design software
  
  
Software development company
  

   
  






  
  Your email settings: Individual Email|Traditional 
  Change settings via the Web (Yahoo! ID required) 
  Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured 
   
Visit Your Group 
   |
  
Yahoo! Groups Terms of Use
   |
  
   Unsubscribe 
   
 

  




__,_._,___