[flexcoders] Applying a filter to part of a DisplayObject

2009-08-12 Thread mauricen
I'd like to apply a ColorMatrixFilter to one rectangular area of a 
DisplayObject, leaving the rest untouched.  To solve this problem, I've seen 
suggestions of cropping a bitmap snapshot of the DisplayObject and overlaying 
it on the original, but that hack won't work for me.  

You'd think this would be either a generally useful enhancement of filters, or 
else a small tweak to the behaviour of ColorMatrixFilter.  Am I missing 
something obvious?

Maurice



[flexcoders] Re: DateFormatter problem

2009-02-04 Thread mauricen
Sigh Yes, I was missing something all right.  H is hour in day
(1-24) whereas J is hour in day (0-23), which actually fits with 
the standard and might therefore be some use.  Java offers this choice
too, but at least it makes H the sensible option.

Maurice 

--- In flexcoders@yahoogroups.com, mauricen maur...@... wrote:

 The following code
 
 var formatter :DateFormatter = new DateFormatter();
 formatter.formatString = DD-MMM- HH:NN:SS;
 var newDate : Date = new Date(2009,01,04);
 trace(newDate.toDateString() + +  newDate.toTimeString());
 trace(formatter.format(newDate));
 
 produces this output
 
 Wed Feb 4 2009 00:00:00 GMT+
 04-Feb-2009 24:00:00
 
 These two date-times differ by 24 hours, according to the 
 standard (ISO 8601, 4.2.3 note 2):
 
  The end of one calendar day [24:00] coincides with [00:00] at 
  the start of the next calendar day, e.g. [24:00] on 12 April 
  1985 is the same as [00:00] on 13 April 1985.
 
 This looks like a (pretty significant) bug in DateFormatter to 
 me.  Or am I missing something?
 
 Maurice





[flexcoders] DateFormatter problem

2009-02-03 Thread mauricen
The following code

var formatter :DateFormatter = new DateFormatter();
formatter.formatString = DD-MMM- HH:NN:SS;
var newDate : Date = new Date(2009,01,04);
trace(newDate.toDateString() + +  newDate.toTimeString());
trace(formatter.format(newDate));

produces this output

Wed Feb 4 2009 00:00:00 GMT+
04-Feb-2009 24:00:00

These two date-times differ by 24 hours, according to the 
standard (ISO 8601, 4.2.3 note 2):

 The end of one calendar day [24:00] coincides with [00:00] at 
 the start of the next calendar day, e.g. [24:00] on 12 April 
 1985 is the same as [00:00] on 13 April 1985.

This looks like a (pretty significant) bug in DateFormatter to 
me.  Or am I missing something?

Maurice



[flexcoders] Re: Do states and transitions behave differently depending on the context?

2009-01-20 Thread mauricen
Thanks very much!  It looks as though the transition will work - or not -
depending on when it's invoked in the component creation process.
And invoking it at the wrong time (ie as part of initialisation, as I 
did) prevents it from working later, as in your solution.

Transitions seem to have a very steep learning curve.  The solution
for the toy example /still/ doesn't work in my real application!  So
there must be some other inexplicable glitch to be isolated...

--- In flexcoders@yahoogroups.com, Haykel BEN JEMIA hayke...@... wrote:

 I don't know why it's behaving like that, but it seems to work if
you set
 the state after the form item has been created, like this:
 
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 mx:Form
 mx:FormItem label=Type
creationComplete=st.currentState='taskQueue'
 view:SectionTypeControl id=st /
 /mx:FormItem
 /mx:Form
 /mx:Application
 
 Anyone has an explanation?
 
 Haykel Ben Jemia
 
 Allmas
 Web  RIA Development
 http://www.allmas-tn.com
 
 
 
 
 On Mon, Jan 19, 2009 at 5:59 PM, mauricen maur...@...wrote:
 
I have a component which can appear initially in one of two
states, and
  can subsequently be switched between them. When this switch takes
place,
  I want a transition to occur. Here's a tiny model of my component:
 
  mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml;
  mx:states
  mx:State name=state1
  mx:AddChild
  mx:HBox
  mx:Text id=text1 text=t1:/
  mx:Text id=text2 text=t2:/
  /mx:HBox
  /mx:AddChild
  /mx:State
  /mx:states
  mx:transitions
  mx:Transition
  mx:Move targets={[text1, text2]}/
  /mx:Transition
  /mx:transitions
  /mx:Canvas
 
  If I embed this component (call it MyComp) like this:
 
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
  view:MyComp currentState=state1/
  /mx:Application
 
  the transition takes place as the component appears, and everything is
  fine. But if I put it inside a FormItem, like this:
 
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
  mx:Form
  mx:FormItem label=Type
  view:SectionTypeControl currentState=taskQueue/
  /mx:FormItem
  /mx:Form
  /mx:Application
 
  the transition never takes place and the two labels remain
superimposed.
 
  In fact the problem is a little worse than this. In the toy
  application above, you can replace FormItem by a container like HBox
  and it works again. But in my real app I can't use it inside a Form
  at all. What gives?
 
  Maurice
 
   
 





[flexcoders] Re: Do states and transitions behave differently depending on the context?

2009-01-20 Thread mauricen
There may well be...

It's part of a dialog for creating or editing Foos.  A Foo can be 
either red or green; green Foos also have a pressure and a temperature, 
which red Foos don't have.  When you're creating a Foo, you can select
one of two radio buttons labelled Red/Green.  You can't edit the 
colour of a Foo once it has been created.  

I'm trying to declutter the creation dialog by having it initially
appear with Red selected.  If the user selects Green, the temperature
and pressure controls slide out - that's what the transition is for.
That transition should be reversible, and repeatable.

When editing an existing Foo, the dialog should appear with Red or
Green selected as appropriate, and disabled.  If it's a green Foo
that's being edited, then the pressure and temperature controls should
be available for editing - that's the problem situation at the moment.

A general comment: transitions between states offer a huge potential
win for UI designers; they should make possible much more complex
interfaces than we would previously have dared to consider, because
they support progressive reveals, as in my example.  But if they're 
really as hard to use as this makes it seem, that win may be an
illusion.  I know they are working on a better language for states in
Gumbo - let's hope it improves the experience of programming transitions
as well.

Maurice

--- In flexcoders@yahoogroups.com, Haykel BEN JEMIA hayke...@... wrote:

 Why do you need the one state? Is it only to make the transition
when the
 component is created or do you have other states? What do you want to
 achieve exactly? Perhaps there is a better solution!
 
 Haykel Ben Jemia
 
 Allmas
 Web  RIA Development
 http://www.allmas-tn.com
 
 
 
 
 On Tue, Jan 20, 2009 at 1:42 PM, mauricen maur...@...wrote:
 
Thanks very much! It looks as though the transition will work -
or not -
  depending on when it's invoked in the component creation process.
  And invoking it at the wrong time (ie as part of initialisation, as I
  did) prevents it from working later, as in your solution.
 
  Transitions seem to have a very steep learning curve. The solution
  for the toy example /still/ doesn't work in my real application! So
  there must be some other inexplicable glitch to be isolated...
 
 
  --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com,
Haykel
  BEN JEMIA haykelbj@ wrote:
  
   I don't know why it's behaving like that, but it seems to work if
  you set
   the state after the form item has been created, like this:
  
   mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
   mx:Form
   mx:FormItem label=Type
  creationComplete=st.currentState='taskQueue'
   view:SectionTypeControl id=st /
   /mx:FormItem
   /mx:Form
   /mx:Application
  
   Anyone has an explanation?
  
   Haykel Ben Jemia
  
   Allmas
   Web  RIA Development
   http://www.allmas-tn.com
  
  
  
  
   On Mon, Jan 19, 2009 at 5:59 PM, mauricen maurice@wrote:
 
  
I have a component which can appear initially in one of two
  states, and
can subsequently be switched between them. When this switch takes
  place,
I want a transition to occur. Here's a tiny model of my component:
   
mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml;
mx:states
mx:State name=state1
mx:AddChild
mx:HBox
mx:Text id=text1 text=t1:/
mx:Text id=text2 text=t2:/
/mx:HBox
/mx:AddChild
/mx:State
/mx:states
mx:transitions
mx:Transition
mx:Move targets={[text1, text2]}/
/mx:Transition
/mx:transitions
/mx:Canvas
   
If I embed this component (call it MyComp) like this:
   
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
view:MyComp currentState=state1/
/mx:Application
   
the transition takes place as the component appears, and
everything is
fine. But if I put it inside a FormItem, like this:
   
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
mx:Form
mx:FormItem label=Type
view:SectionTypeControl currentState=taskQueue/
/mx:FormItem
/mx:Form
/mx:Application
   
the transition never takes place and the two labels remain
  superimposed.
   
In fact the problem is a little worse than this. In the toy
application above, you can replace FormItem by a container
like HBox
and it works again. But in my real app I can't use it inside a
Form
at all. What gives?
   
Maurice
   
   
   
  
 
   
 





[flexcoders] Do states and transitions behave differently depending on the context?

2009-01-19 Thread mauricen
I have a component which can appear initially in one of two states, and
can subsequently be switched between them.  When this switch takes place,
I want a transition to occur.  Here's a tiny model of my component:

mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml;
  mx:states
mx:State name=state1
  mx:AddChild
mx:HBox
  mx:Text id=text1 text=t1:/
  mx:Text id=text2 text=t2:/
/mx:HBox
  /mx:AddChild  
/mx:State
  /mx:states
  mx:transitions
mx:Transition
  mx:Move targets={[text1, text2]}/
/mx:Transition
  /mx:transitions
/mx:Canvas

If I embed this component (call it MyComp) like this:

mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
  view:MyComp currentState=state1/
/mx:Application

the transition takes place as the component appears, and everything is
fine.  But if I put it inside a FormItem, like this:

mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
  mx:Form
mx:FormItem label=Type
  view:SectionTypeControl currentState=taskQueue/
/mx:FormItem
  /mx:Form
/mx:Application

the transition never takes place and the two labels remain superimposed.

In fact the problem is a little worse than this.  In the toy
application above, you can replace FormItem by a container like HBox
and it works again.  But in my real app I can't use it inside a Form
at all.  What gives?

Maurice



[flexcoders] Re: Best Practice Data Binding

2008-07-02 Thread mauricen
Thanks to everyone who replied to this.  Since I think my biggest
problem is understanding the translation of the MXML tag, the way to
go for me is to look at the MXML documentation and to read the
generated code (thanks - I'd forgetten about that).

My overall comment is that the documentation is rather recipe-based -
and that can be very useful - but it's good to also have a more formal
and complete definition of what a language feature means (in the way,
for example, that the Java Language Specification says what Java
programs mean).

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

 Thanks very much for your time in writing this; it's very helpful. But
 my question still stands: if there are parts of your answer that I
 don't understand fully, or that raise more questions in my mind (and
 both of these are in fact the case), how do I resolve these
 difficulties?  How did you learn about this (aside from the LiveDocs,
 I mean)?  The implementation must be defined *somewhere*, surely, even
 if only in code?




[flexcoders] Re: Best Practice Data Binding

2008-07-01 Thread mauricen
Thanks very much for your time in writing this; it's very helpful. But
my question still stands: if there are parts of your answer that I
don't understand fully, or that raise more questions in my mind (and
both of these are in fact the case), how do I resolve these
difficulties?  How did you learn about this (aside from the LiveDocs,
I mean)?  The implementation must be defined *somewhere*, surely, even
if only in code?

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

 The authoritive story is pretty much as Daniel said:
 
 [Bindable]
 public var myField:String;
 
 The above will generate something the equivalent of:
 
 mx_internal var _myField:String; //Might be private, can't be arsed
to check
 
 [Bindable event=propertyChangeEvent]
 public function get myField():String {
   return _myField;
 }
 
 public function set myField(value:String):void {
   if (value != _myField) {
 var oldVal:* = _myfield;
 _myField = value;
dispatchEvent(new PropertyChangeEvent(this, myField, oldVal,
newVal));
   }
 }
 
 And if you put the generic [Bindable] on a getter _or_ a setter, you'll
 re-generate the above code, but _myField will be the original get/set
 functions renamed, not a private or mx_internal var.
 
 As a rule, I don't use the generic [Bindable] on getter/setter
functions.
 It's just not that hard to dispatch an event.
 
 However if you're going to put generic [Bindable] on a getter/setter
pair,
 put it on the *setter*. Otherwise the debugger will hilight the getter
 method when you're single-stepping through foo.myField = someValue
- it's
 not a law or anything, but it's confusing even when you know why it
does it.
 
 When you're using a custom event, put the
[Bindable(event=myEventName)] on
 the *getter*. That way you always know it's bindable, as not every
getter
 needs a setter. You can dispatch the event from anywhere you please,
either
 a setter method or something else. Don't know about performance, but
when
 you're not using a PropertyChangeEvent, bindings will fire for anything
 matching that name, since it can't use the fieldName and object
properties
 of PropertyChangeEvent to know exactly which field should re-fire
bindings.
 
 One last thing, you can specify
[Bindable(event=PropertyChangeEvent)] on a
 getter, and you'll still need to dispatch your own
PropertyChangeEvents from
 the setter or from anywhere else. It lets you be a specific as to what's
 changed in the object without having a bunch of custom named events.
 
 Disclaimer: I'm 99% sure that's all correct. YMMV ;-)
 
 -Josh
 
 On Tue, Jul 1, 2008 at 8:19 AM, mauricen [EMAIL PROTECTED] wrote:
 
  Where *is* the authoritative story on binding?  As a newcomer to Flex
  I'm finding it hard to form a coherent picture of how the various
  binding features fit together.  What's the mechanism, for example,
  that allows me to call addEventListener on a Bindable property?  If
  there's no formal documentation, I'd be happy to look at code -
but where/
 
  Maurice
 
  --- In flexcoders@yahoogroups.com, securenetfreedom nv1000@ wrote:
  
   I found this page to be helpful but not authoritative (This is
where I
   found the use of binding the setter);
  
 
http://livedocs.adobe.com/flex/3/html/help.html?content=databinding_8.ht\http://livedocs.adobe.com/flex/3/html/help.html?content=databinding_8.ht%5C
   ml
  
 
http://livedocs.adobe.com/flex/3/html/help.html?content=databinding_8.h\http://livedocs.adobe.com/flex/3/html/help.html?content=databinding_8.h%5C
   tml
 
 
 
  
 
  --
  Flexcoders Mailing List
  FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Search Archives:
  http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
  Links
 
 
 
 
 
 
 -- 
 Therefore, send not to know For whom the bell tolls. It tolls for
thee.
 
 :: Josh 'G-Funk' McDonald
 :: 0437 221 380 :: [EMAIL PROTECTED]





[flexcoders] Re: Best Practice Data Binding

2008-06-30 Thread mauricen
Where *is* the authoritative story on binding?  As a newcomer to Flex
I'm finding it hard to form a coherent picture of how the various
binding features fit together.  What's the mechanism, for example,
that allows me to call addEventListener on a Bindable property?  If
there's no formal documentation, I'd be happy to look at code - but where/

Maurice

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

 I found this page to be helpful but not authoritative (This is where I
 found the use of binding the setter);

http://livedocs.adobe.com/flex/3/html/help.html?content=databinding_8.ht\
 ml

http://livedocs.adobe.com/flex/3/html/help.html?content=databinding_8.h\
 tml




[flexcoders] Re: Profiler problems

2008-06-26 Thread mauricen
Answering my own question: I've installed another instance of FB on a 
virtual machine and set it to profile the application both importing 
the project and also remotely, with no difficulties.  So the problem 
is not the project but a screwed-up installation.  Obviously the next
step is to reinstall FB.

Maurice

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

 I have just started working with FB3 Pro, but can't get the profiler
 to work - or rather, it can work, but never where I really need it.
...



[flexcoders] Profiler problems

2008-06-25 Thread mauricen
I have just started working with FB3 Pro, but can't get the profiler
to work - or rather, it can work, but never where I really need it.
On one ActionScript project it works fine.  On a Flex project, it
malfunctions in two different ways: with most apps it starts ok but
the session is terminated after a couple of seconds with the console
message socket closed.  The app itself continues to function
normally, however.

One application in this project has a different failure mode: the
profiler just doesn't start at all - the app just starts normally.

I'm running in IE without tabbed windows.  I've tried deleting the
contents of mm.cfg and creating a new project in a new workspace a la
bug 12649 http://bugs.adobe.com/jira/browse/FB-12649?rc=1  but with no
improvement.  (All new projects fail in the
second way; the profiler doesn't start at all.)  The only thing I
haven't tried (that I can think of) is to reinstall FB.  But why would
that help when there seems to be some difference within my
projects and apps?

Any advice would be most welcome.  This has cost a day so far :(

Maurice