[flexcoders] DataGridColumn backgroundColor bug?

2009-05-19 Thread Ben Reynolds
Hi guys,

   This seems like an awfully simple thing for nobody to have picked up
before, so hopefully someone can point me in the right direction as to
what I'm doing wrong. I have gone way heaps hardcore and simplified the
issue to the following using SDK3.2:


 
 
 


With either showHeaders="false" or headerHeight="0" the code is
generating the following error found in DataGrid's drawColumnBackground
function:

TypeError: Error #1010: A term is undefined and has no properties.
 at
mx.controls::DataGrid/drawColumnBackground()[C:\autobuild\3.2.0\framewor\
ks\projects\framework\src\mx\controls\DataGrid.as:3012]
 at
mx.controls::DataGrid/drawLinesAndColumnGraphics()[C:\autobuild\3.2.0\fr\
ameworks\projects\framework\src\mx\controls\DataGrid.as:3311]
 at
mx.controls::DataGrid/drawLinesAndColumnBackgrounds()[C:\autobuild\3.2.0\
\frameworks\projects\framework\src\mx\controls\DataGrid.as:3207]
 at
mx.controls::DataGrid/updateDisplayList()[C:\autobuild\3.2.0\frameworks\\
projects\framework\src\mx\controls\DataGrid.as:1506]
 at
mx.controls.listClasses::ListBase/validateDisplayList()[C:\autobuild\3.2\
.0\frameworks\projects\framework\src\mx\controls\listClasses\ListBase.as\
:3280]
 at
mx.managers::LayoutManager/validateDisplayList()[C:\autobuild\3.2.0\fram\
eworks\projects\framework\src\mx\managers\LayoutManager.as:622]
 at
mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\fr\
ameworks\projects\framework\src\mx\managers\LayoutManager.as:677]
 at Function/http://adobe.com/AS3/2006/builtin::apply()
 at
mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\framework\
s\projects\framework\src\mx\core\UIComponent.as:8628]
 at
mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\
\projects\framework\src\mx\core\UIComponent.as:8568]

Line 3012 is:

var xx:Number = columnHeader.rendererArray[columnIndex].x

There appears to be no rendererArray. Can someone shed some light on
this? Is it something fixed in 3.3 (which is something I'm unable to
test at this point)?

MrB



[flexcoders] Re: specify services-comfig.xml in either MXML or AS?

2009-05-05 Thread Ben Reynolds
It's actually really simple (at least for the most basic implementation)
to get rid of services-config.xml and the need for the -services
compiler argument. I've had no problems using it with amfphp or granite.

In the Application's creationComplete() I have something along the lines
of

channelSet = new ChannelSet();
var uri = "http://path.to.your/amfphp/gateway.php";;
channelSet.addChannel(new AMFChannel("whatever", uri));

And I pass the channelSet to Services.mxml as a bindable variable.



Within Services.mxml:


http://www.adobe.com/2006/mxml";
 xmlns:cairngorm="com.universalmind.cairngorm.business.*">
 
 
 

 



MrB

--- In flexcoders@yahoogroups.com, dnk  wrote:
>
> Hi there,
>
> I was wondering if it was possible to specify my services-comfig.xml
> in either MXML or AS?
>
> I just wanted to include that in my actual code (as opposed to a
> compiler arg) for portability.
>
> I have been searching google, and nothing yet...
>
> Thanks!
>
> / D
>



[flexcoders] Re: Trigger DateFormatter bindings

2009-05-03 Thread Ben Reynolds
Hey TH,

  I'd tried binding the formatString but I hadn't considered reinstantiation. 
Thanks. Of course I was hoping for a panacea for all my problems without any 
code whatsoever. :P 

  This actually relates to a larger problem regarding dynamic resource 
switching that I'd got no help on before, and this is the latest in a series of 
kludges to get there.

Thanks again,

  MrB.

--- In flexcoders@yahoogroups.com, "Tim Hoff"  wrote:
>
> 
> Hi Ben (MrB),
> 
> Looks like you're going to have to do a little trickery.  Binding the
> formatString doesn't seem to change the date formats.  However, if you
> re-instantiate the DateFormatter it works:
> 
> [Bindable] private var myDate:Date = new Date();
> [Bindable] private var formatString:String = "-MM-DD";
> 
> private function changeFormat():void
> {
>df = new DateFormatter();
>formatString = "MM/DD/";
> }
> 
> 
> 
> 
> 
> -TH
> 
> --- In flexcoders@yahoogroups.com, "Ben Reynolds"  wrote:
> >
> > Hey guys,
> >
> > Is there a way to trigger the binding on all related items when
> > changing the DateFormatter's formatString? eg.  becomes MMM, 
> > via actionscript in the following:
> >
> > 
> > 
> >
> > I'd prefer not to be manually injecting the new format into each of
> the
> > text objects every time.
> >
> > Regards,
> >
> > MrB.
> >
>




[flexcoders] Trigger DateFormatter bindings

2009-04-30 Thread Ben Reynolds
Hey guys,

   Is there a way to trigger the binding on all related items when
changing the DateFormatter's formatString? eg.  becomes MMM, 
via actionscript in the following:




I'd prefer not to be manually injecting the new format into each of the
text objects every time.

Regards,

   MrB.



[flexcoders] Re: DateFormatter and dynamic resource management errror

2009-04-19 Thread Ben Reynolds
Maybe all this will help someone else here looking for a solution to
this problem (and maybe some kindly bots will run across it at some
point too). In short, you have to compile your own SWCs for each of the
languages, and not just the resource library SWFs every other
instruction set tells you about. This means finding out on your lonesome
all the translations for days of the week and months of the year, and
anything else pertinent like date and currency format defaults. The
steps are:

1) use the copylocale to copy the en_US files to your new language
directories.
2) edit the .properties files located in your equivalent of
C:\Program Files\Adobe\Flex Builder
3\sdks\3.2.0\frameworks\projects\framework\bundles\es_ES\src. The
dayNames and monthNames key/value pairs are located in
SharedResources.properties
3) recompile the framework_rb.swc file. From within C:\Program
Files\Adobe\Flex Builder 3\sdks\3.2.0\frameworks\ I used the following
command (taken from the build.xml script, which I'm still struggling to
get working - seriously damaging my cred).

compc
   -locale=es_ES
   -output="locale/{locale}/framework_rb.swc"
   -include-resource-bundles SharedResources collections containers
controls core effects formatters logging skins states styles utils
validators
  
-source-path="projects\framework\bundles\{locale}\src","projects\framewo\
rk\src"
   -external-library-path="libs\player\9\playerglobal.swc"

4) from your project's root directory, re-run your language compiler for
each of the languages. Again using Spanish as an example, use:

mxmlc
   -locale=es_ES
   -source-path=locale/{locale}
  
-include-resource-bundles=LanguageResource,SharedResources,collections,c\
ontainers,controls,core,effects,formatters,logging,messaging,rpc,skins,s\
tyles,utils
   -output=src/Resources_es_ES.swf

Formatters will now do their internationally spelled magic. Hopefully
this will all become useless very soon, with Adobe just handing over all
these languages by default.

A man can dream. A man can dream.

- MrB

--- In flexcoders@yahoogroups.com, "Ben Reynolds"  wrote:
>
> Okay, I have what I suppose is a solution to this, but I'm still short
a coupla answers.
>
> 1) I ran the resource-bundle-list option again on my application
>
> mxmlc -locale= -resource-bundle-list=myresources.txt
-include-libraries+=..\libs\CairngormWithExtensions.swc app.mxml
>
> which came up with:
>
> CairngormMessages LanguageResource SharedResources collections
containers controls core effects formatters logging messaging rpc skins
styles utils
>
> The difference is the SharedResources and formatters, which wasn't in
the original.
>
> 2) I recompiled the resource bundles (skipping CairngormMessages,
which I'm not using) over the 15 languages. ie.
>
> mxmlc -locale=da -source-path=locale/{locale}
-include-resource-bundles=LanguageResource,SharedResources,collections,c\
ontainers,controls,core,effects,logging,messaging,rpc,skins,styles,utils
-output=src/Resources_da.swf
>
> So now it doesn't fall over on MMM or .
>
>
> However, I have but face. Also, I'm about to make some assumptions...
The copylocale that I used earlier to create the resources seems to do
exactly that: copies. It doesn't actually create a proper locale for all
those places. So "January" in en_US is still "January" in it_IT when,
according to Babelfish, it should be "Gennaio" etc. etc.
>
> What can I do about this?
> Where can I get proper versions of these locales?
> Is there a way to get the names from the operating system and apply
them to DateBase or is this already happening and I just can't see it
because I'm running an English machine?
>
>
> Danke for any light you can shed on this.
>
> --- In flexcoders@yahoogroups.com, "Ben Reynolds" mrben1@ wrote:
> >
> > Hey guys,
> >
> >I have a Flex 3 app that employs dynamic resource management -
pretty
> > much a cut-n-paste job from the Adobe sample - with the ComboBox to
> > switch languages. I did all the copylocale rigmarole and it's all
> > working perfectly with the languages I've set up.
> >
> >However, when I try to call a DateFormatter with a full month
(MMM or
> > ) in the formatString it crashes and burns with the following
error:
> >
> > TypeError: Error #1009: Cannot access a property or method of a null
> > object reference.
> >  at
> >
mx.formatters::DateBase$/http://www.adobe.com/2006/flex/mx/internal::ext\
\
> > ractTokenDate()
> >
> > This is probably referring to the DateBase.monthNamesLong array;
> > formatting is not an issue with M or MM.  Am I perhaps missing
something
> > in the creation of my resource files? This is a sample of the
command I
> > used:
> >
> > mxmlc -locale=es_ES -source-path=locale/{locale}
> >
-include-resource-bundles=LanguageResource,collections,containers,contro\
\
> > ls,core,effects,logging,messaging,rpc,skins,styles,utils
> > -output=src/Resources_es_ES.swf
> >
> > But it even dies when the locale is set to en_US.
> >
> > Help? :)
> >
>



[flexcoders] Re: Need help- cannot insert multiple statements in one SQL transaction.

2009-04-17 Thread Ben Reynolds
Okay...

1) use a synchronous connection as async won't work for transactions.
2) yep, use transactions
3) put your statements in an array, not a semi-colon separated string
4) here's the key part of the code I use


  connection.begin();
 for each (var sqlString:String in sqlArray)
 {
 statement.text = sqlString;
 try
 {
 statement.execute(-1);
 }
 catch(error:SQLError)
 {
 connection.rollback(responder);
 }
 }
 connection.commit(responder);
 connection.close();

  --- In flexcoders@yahoogroups.com, "icodeflex"  wrote:
>
> Air and Flex experts-
>
> I am having a heck of a time getting multiple insert and update
statements to run within one transaction against my Air applications
SQLite db. Only the first INSERT, UPDATE, or DELETE makes it in. I am
not seeing errors, but it seems like it is failing. If I run the same
SQL in another SQL editor, my SQL works fine.
>
> Example code is:
>
> Var myInsert: String = "Insert into EMPLOYEES ( NAME ) VALUES ("Bob");
";
> myInsert += "Insert into EMPLOYEES ( NAME ) VALUES ("John"); ";
> myInsert +=  "Insert into EMPLOYEES ( NAME ) VALUES ("Fred"); ";
>
>
>var localConnection : SQLConnection = new SQLConnection();
>   localConnection.open("myDatabase");
>   localConnection.begin();
>
> var statement: SQLStatement = new SQLStatement();
>statement.sqlConnection = localConnection;
>   statement.text = myInsert;
>  statement.execute();
>
> localConnection.commit();
>
> I have tried in synchronous and async mode with the same results.
>
> Please tell me what I am doing wrong! :)
>
> Thanks!
> Dustin
>



[flexcoders] Re: DateFormatter and dynamic resource management errror

2009-04-17 Thread Ben Reynolds
Okay, I have what I suppose is a solution to this, but I'm still short a coupla 
answers.

1) I ran the resource-bundle-list option again on my application

mxmlc -locale= -resource-bundle-list=myresources.txt 
-include-libraries+=..\libs\CairngormWithExtensions.swc app.mxml

which came up with:

CairngormMessages LanguageResource SharedResources collections containers 
controls core effects formatters logging messaging rpc skins styles utils

The difference is the SharedResources and formatters, which wasn't in the 
original.

2) I recompiled the resource bundles (skipping CairngormMessages, which I'm not 
using) over the 15 languages. ie.

mxmlc -locale=da -source-path=locale/{locale} 
-include-resource-bundles=LanguageResource,SharedResources,collections,containers,controls,core,effects,logging,messaging,rpc,skins,styles,utils
 -output=src/Resources_da.swf

So now it doesn't fall over on MMM or .


However, I have but face. Also, I'm about to make some assumptions... The 
copylocale that I used earlier to create the resources seems to do exactly 
that: copies. It doesn't actually create a proper locale for all those places. 
So "January" in en_US is still "January" in it_IT when, according to Babelfish, 
it should be "Gennaio" etc. etc.

What can I do about this?
Where can I get proper versions of these locales?
Is there a way to get the names from the operating system and apply them to 
DateBase or is this already happening and I just can't see it because I'm 
running an English machine?


Danke for any light you can shed on this.

--- In flexcoders@yahoogroups.com, "Ben Reynolds"  wrote:
>
> Hey guys,
> 
>I have a Flex 3 app that employs dynamic resource management - pretty
> much a cut-n-paste job from the Adobe sample - with the ComboBox to
> switch languages. I did all the copylocale rigmarole and it's all
> working perfectly with the languages I've set up.
> 
>However, when I try to call a DateFormatter with a full month (MMM or
> ) in the formatString it crashes and burns with the following error:
> 
> TypeError: Error #1009: Cannot access a property or method of a null
> object reference.
>  at
> mx.formatters::DateBase$/http://www.adobe.com/2006/flex/mx/internal::ext\
> ractTokenDate()
> 
> This is probably referring to the DateBase.monthNamesLong array;
> formatting is not an issue with M or MM.  Am I perhaps missing something
> in the creation of my resource files? This is a sample of the command I
> used:
> 
> mxmlc -locale=es_ES -source-path=locale/{locale}
> -include-resource-bundles=LanguageResource,collections,containers,contro\
> ls,core,effects,logging,messaging,rpc,skins,styles,utils
> -output=src/Resources_es_ES.swf
> 
> But it even dies when the locale is set to en_US.
> 
> Help? :)
>




[flexcoders] Re: Making ComboBox stay open after item select?

2009-04-17 Thread Ben Reynolds
Still not too much to do on that. All the functionality appears to be in
the close function. I've kludged up this to do what you want. There's a
"_calling" variable in there as the close function gets called twice on
every change (for reasons I don't care to examine)  that'll allow it to
dispatch the change event once per frame.

package
{
 import flash.events.Event;
 import mx.controls.ComboBox;
 import mx.events.ListEvent;

 public class ComboBoxNoClose extends ComboBox
 {
 private var _calling:Boolean = false;

 public function ComboBoxNoClose()
 {
 super();
 }

 public override function close(trigger:Event = null):void
 {
 if (trigger != null)
 super.close();
 else if (dropdown != null && !_calling)
 {
 _calling = true;
 dispatchEvent(new ListEvent("change"));
 callLater(function():void { _calling = false} );
  }
 }
 }
}

  --- In flexcoders@yahoogroups.com, "Sascha"  wrote:
>
> My problem is that writing a whole custom component is too involved
for the
> few time I have and your method seems to work quite well.
>
>
>
> The only trouble I have (as described in my previous reply) is that
the
> ComboBox should fire a change event everytime an item is selected
while it
> stays opened. By default the ComboBox is only firing this event after
it
> closes.
>
> However listening to the dropdown (the List component in the ComboBox)
> property's ListEvent.CHANGE seems not to cut it. It would be great if
you
> would have a workaorund for this!
>
>
>
> Best,
>
> Sascha
>
>
>
>
>
>
>
> From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com]
On
> Behalf Of Ben Reynolds
> Sent: Thursday, April 16, 2009 14:23
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: Making ComboBox stay open after item select?
>
>
>
> I'm by no means on Alex's level of Flex knowledge, but a Button
combined
> with a Menu component would work too. You wouldn't get into resizing
issues
> and you'd still be able to do styling without resorting to UIComponent
first
> principles. :)
>
> --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> ,
> "Sascha" sbalkau@ wrote:
> >
> > I've made a short test and that seems to work so far. Thanks for the
hint
> > Ben!
> >
> > I almost started to try writing a custom component from a Button and
a
> List
> > wrapped into a UIComponent as Alex Harui suggested in a message I've
found
> > but seems that that's not necessary.
> >
> >
> >
> > Sascha
> >
> >
> >
> >
> >
> > From: flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com>
> [mailto:flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> ]
> On
> > Behalf Of Ben Reynolds
> > Sent: Thursday, April 16, 2009 10:34
> > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
> > Subject: [flexcoders] Re: Making ComboBox stay open after item
select?
> >
> >
> >
> >
> >
> >
> >
> >
> > Something like:
> >
> > package
> > {
> > import flash.events.Event;
> > import mx.controls.ComboBox;
> >
> > public class ComboBoxNoClose extends ComboBox
> > {
> > public function ComboBoxNoClose()
> > {
> > super();
> > }
> >
> > public override function close(trigger:Event = null):void
> > {
> > if (trigger != null)
> > super.close();
> >
> >
> > }
> > }
> > }
> >
> > --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> ,
> "Sascha"  wrote:
> > >
> > > Does anyone know how to modify the ComboBox so that it stays open
after
> > > selecting an item?
> > >
> > > I need such a ComboBox for a client that opens/closes only if the
user
> > > clicks on the 'header area' of the ComboBox or that closes only if
> clicked
> > > outside the ComboBox.
> > >
> > > The use case for this is that the ComboBox will have custom item
> renderers
> > > that contain (for example) a CheckBox and a Label and the user
should be
> > > able to make several selections without the ComboBox closing
inbetween.
> > >
> > > I've made this before by wrapping all the stuff into a Panel and
> changing
> > > the Panels height on close so that only the header is visible but
that
> > > method is rather suboptimal, especially for skinning.
> > >
> > > Would be great if somebody has a workaround for this!
> > > Thanks in advance!
> > >
> > > Sascha
> >
>



[flexcoders] Re: Making ComboBox stay open after item select?

2009-04-16 Thread Ben Reynolds
I'm by no means on Alex's level of Flex knowledge, but a Button combined with a 
Menu component would work too. You wouldn't get into resizing issues and you'd 
still be able to do styling without resorting to UIComponent first principles. 
:)

--- In flexcoders@yahoogroups.com, "Sascha"  wrote:
>
> I've made a short test and that seems to work so far. Thanks for the hint
> Ben!
> 
> I almost started to try writing a custom component from a Button and a List
> wrapped into a UIComponent as Alex Harui suggested in a message I've found
> but seems that that's not necessary.
> 
>  
> 
> Sascha
> 
>  
> 
>  
> 
> From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
> Behalf Of Ben Reynolds
> Sent: Thursday, April 16, 2009 10:34
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: Making ComboBox stay open after item select?
> 
>  
> 
> 
> 
> 
> 
> 
> Something like:
> 
> package
> {
> import flash.events.Event;
> import mx.controls.ComboBox;
> 
> public class ComboBoxNoClose extends ComboBox
> {
> public function ComboBoxNoClose()
> {
> super();
> }
> 
> public override function close(trigger:Event = null):void
> {
> if (trigger != null)
> super.close();
>
> 
> }
> }
> }
> 
> --- In flexcoders@yahoogroups.com, "Sascha"  wrote:
> >
> > Does anyone know how to modify the ComboBox so that it stays open after
> > selecting an item?
> > 
> > I need such a ComboBox for a client that opens/closes only if the user
> > clicks on the 'header area' of the ComboBox or that closes only if clicked
> > outside the ComboBox.
> > 
> > The use case for this is that the ComboBox will have custom item renderers
> > that contain (for example) a CheckBox and a Label and the user should be
> > able to make several selections without the ComboBox closing inbetween.
> > 
> > I've made this before by wrapping all the stuff into a Panel and changing
> > the Panels height on close so that only the header is visible but that
> > method is rather suboptimal, especially for skinning.
> > 
> > Would be great if somebody has a workaround for this!
> > Thanks in advance!
> > 
> > Sascha
>




[flexcoders] Re: Making ComboBox stay open after item select?

2009-04-15 Thread Ben Reynolds
Something like:

package
{
 import flash.events.Event;
 import mx.controls.ComboBox;

 public class ComboBoxNoClose extends ComboBox
 {
 public function ComboBoxNoClose()
 {
 super();
 }

 public override function close(trigger:Event = null):void
 {
 if (trigger != null)
 super.close();


 }
 }
}

--- In flexcoders@yahoogroups.com, "Sascha"  wrote:
>
> Does anyone know how to modify the ComboBox so that it stays open
after
> selecting an item?
>
> I need such a ComboBox for a client that opens/closes only if the user
> clicks on the 'header area' of the ComboBox or that closes only if
clicked
> outside the ComboBox.
>
> The use case for this is that the ComboBox will have custom item
renderers
> that contain (for example) a CheckBox and a Label and the user should
be
> able to make several selections without the ComboBox closing
inbetween.
>
> I've made this before by wrapping all the stuff into a Panel and
changing
> the Panels height on close so that only the header is visible but that
> method is rather suboptimal, especially for skinning.
>
> Would be great if somebody has a workaround for this!
> Thanks in advance!
>
> Sascha
>



[flexcoders] DateFormatter and dynamic resource management errror

2009-04-15 Thread Ben Reynolds
Hey guys,

   I have a Flex 3 app that employs dynamic resource management - pretty
much a cut-n-paste job from the Adobe sample - with the ComboBox to
switch languages. I did all the copylocale rigmarole and it's all
working perfectly with the languages I've set up.

   However, when I try to call a DateFormatter with a full month (MMM or
) in the formatString it crashes and burns with the following error:

TypeError: Error #1009: Cannot access a property or method of a null
object reference.
 at
mx.formatters::DateBase$/http://www.adobe.com/2006/flex/mx/internal::ext\
ractTokenDate()

This is probably referring to the DateBase.monthNamesLong array;
formatting is not an issue with M or MM.  Am I perhaps missing something
in the creation of my resource files? This is a sample of the command I
used:

mxmlc -locale=es_ES -source-path=locale/{locale}
-include-resource-bundles=LanguageResource,collections,containers,contro\
ls,core,effects,logging,messaging,rpc,skins,styles,utils
-output=src/Resources_es_ES.swf

But it even dies when the locale is set to en_US.

Help? :)