Re: [flexcoders] ImageSnapshot.captureBitmapData with transparency on Windows (Vista)

2008-11-24 Thread Ian M. Jones

Hi all,

It's been a few days since I sent the message below, and with many  
people now back from MAX and the weekend, I thought I'd just bump it  
to see if anyone has any ideas?


Thanks,

Ian

On 21 Nov 2008, at 00:18, Ian M. Jones wrote:


Hi all,

I've noticed that using ImageSnapshot.captureBitmapData on Windows
with a component that has a transparent background returns a bitmap
that has a solid black fill where it should be transparent, whereas on
Mac OS X it correctly captures the transparency.

Does anyone know if there is any way to get the capture on Windows to
honour the transparency, or am I going to have to keep on temporarily
setting the background of the component to white (so it'll at least
print nicely) before the capture?

Is there maybe a way to use ImageSnapshot.captureImage with PNG
encoding and then convert the result to BitmapData for later setting
to the Clipboard?

Thanks in advance for any help.

Regards,

Ian

IMiJ Software
http://www.imijsoft.com
http://www.ianmjones.net (blog)





[flexcoders] ImageSnapshot.captureBitmapData with transparency on Windows (Vista)

2008-11-20 Thread Ian M. Jones
Hi all,

I've noticed that using ImageSnapshot.captureBitmapData on Windows  
with a component that has a transparent background returns a bitmap  
that has a solid black fill where it should be transparent, whereas on  
Mac OS X it correctly captures the transparency.

Does anyone know if there is any way to get the capture on Windows to  
honour the transparency, or am I going to have to keep on temporarily  
setting the background of the component to white (so it'll at least  
print nicely) before the capture?

Is there maybe a way to use ImageSnapshot.captureImage with PNG  
encoding and then convert the result to BitmapData for later setting  
to the Clipboard?

Thanks in advance for any help.

Regards,

Ian

IMiJ Software
http://www.imijsoft.com
http://www.ianmjones.net (blog)



Re: [flexcoders] how to give focus to a new browser window

2008-09-05 Thread Ian M. Jones

Have you tried the following?

navigateToURL(new URLRequest(theURL), _blank);

Ian

IMiJ Software
http://www.imijsoft.com
http://www.ianmjones.net (blog)


On 5 Sep 2008, at 09:42, Andrew Wetmore wrote:


Hi:

In my AIR project I need to pop a browser window and give it focus.
The current code is:

private function launchAFile():void{
var theURL:String = resourceContentsList.selectedItem.path;
navigateToURL(new URLRequest(theURL));
}

Is there a way to give that new window focus? At the moment, on some
platforms, it pops up behind the application, and if the user has
resized the app, it is easy to miss the new window.

Thanks in advance! Alpha release on Monday!!

a







Re: [flexcoders] Re: how to give focus to a new browser window

2008-09-05 Thread Ian M. Jones
Maybe minimize the application if it's still the front most  
application, possibly after showing an alert to say what you're up to?


Or maybe just throw up a dialog to say you've opened up a browser  
window, again maybe only if you're still front most?


Just some ideas.

Ian


On 5 Sep 2008, at 11:58, Andrew Wetmore wrote:


As it turns out, I already have that in use in a couple of places, and
it does not give focus to the new window in tabbed browser systems.
Seems to be okay if you don't already have a browser window open, or
if you do not use tabbed browser windows.

Any other thoughts?

a

--- In flexcoders@yahoogroups.com, Ian M. Jones [EMAIL PROTECTED] wrote:

 Have you tried the following?

 navigateToURL(new URLRequest(theURL), _blank);

 Ian
 
 IMiJ Software
 http://www.imijsoft.com
 http://www.ianmjones.net (blog)








Re: [flexcoders] How do I make sure container's child components have applied new style before ImageSnapshot?

2008-08-30 Thread Ian M. Jones

Thanks Alex for your response.

I tried all kinds of combinations of capturing the updateComplete  
event on different components as well as chaining callLaters with  
checking of properties etc, but couldn't get it to work without side  
effects.


Eventually I found that all I needed to do was validate the container  
and the Legend control before taking the snapshot, the important part  
being that the container must be validated before the Legend so that  
the Legend picks up the CSS changes when it's validateNow is called.


Here's my new method of saving pictures of charts etc for anyone that  
might come across the same problem, it's not particularly efficient  
what with all the validateNows (3 in total), but seeing as this is  
triggered from a button press or hot key, the user isn't doing  
anything else and must have the result as quickly as possible, it's  
not such a big deal. It's pretty responsive.


private function saveToFile():void
{
var crossPlatform:ICrossPlatform;
crossPlatform = CrossPlatform.getInstance();

if (mainTabs.selectedChild.id == casesTab)
{
var dataString:String = delimitedCaseListString();
		crossPlatform.saveStringToFile(dataString, currentFilter.sFilterName  
+ .txt);

}

if (mainTabs.selectedChild.id == pieChartTab)
{
pieChartContainer.styleName = forPrint;
		pieChartContainer.validateNow();	//*** Make sure container has style  
set and displayed.
		pieChartLegend.validateNow();		//*** Make sure troublesome child has  
style set and displayed.

callLater(saveSnapshotAndResetStyleName, [pieChartContainer]);
		pieChartContainer.validateNow();	//*** Kick off snapshot in timely  
fashion.

}
}

private function  
saveSnapshotAndResetStyleName(component:UIComponent):void

{
// Take snapshot and remove print style.
var dataBytes:ByteArray = byteArrayFromComponent(component);
pieChartContainer.styleName = null;

// Save image to file.
var crossPlatform:ICrossPlatform;
crossPlatform = CrossPlatform.getInstance();
	crossPlatform.saveByteArrayToFile(dataBytes,  
currentFilter.sFilterName + .png);

}

private function byteArrayFromComponent(component:UIComponent):ByteArray
{
	var imageSnapshot:ImageSnapshot =  
ImageSnapshot.captureImage(component);

return imageSnapshot.data;
}

It seems to work.

Thanks for trying to help, trying to implement something off your  
suggestion lead to the final fix.


Ian

IMiJ Software
http://www.imijsoft.com
http://www.ianmjones.net (blog)



On 29 Aug 2008, at 18:52, Alex Harui wrote:



Does the legend change color eventually?  Maybe waiting for  
updateComplete will be better.  You can always chain callLaters




From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]  
On Behalf Of Ian M. Jones

Sent: Friday, August 29, 2008 4:50 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] How do I make sure container's child  
components have applied new style before ImageSnapshot?




Hi,

I'm having a bit of a problem with capturing a snapshot of a VBox's
contents with a simple colour change applied through a styleName  
change.


The container layout is something like:

mx:VBox id=pieChartContainer width=100% height=100%
horizontalAlign=center
mx:Label id=pieChartTitle
text={currentFilter.sFilterName}
fontSize=14
fontWeight=bold
textDecoration=underline/
mx:PieChart id=pieChart width=100% height=100%
showDataTips=true dataTipFunction=pieChartDataTipFunction
resizeEffect={moveAndResize}
mx:series
// Some series, not relevant to problem.
/mx:series
/mx:PieChart
mx:Legend id=pieChartLegend
dataProvider={pieChart}
width=100%
visible={chkPieChartLegend.selected}
includeInLayout={chkPieChartLegend.selected}
direction=horizontal
resizeEffect={moveAndResize}/
/mx:VBox

Because by default my app has a dark theme with light text applied
through CSS, before capturing a snapshot, I set the style to:

.forPrint
{
color: #00;
}

This means the image should have black text which is good for print  
etc.


I call saveToFile() to start the capture, only when the referenced pie
chart is visible.

private function saveToFile():void
{
pieChartContainer.styleName = forPrint;
callLater(saveSnapshotAndResetStyleName, [pieChartContainer]);
pieChartContainer.validateNow();
}

private function
saveSnapshotAndResetStyleName(component:UIComponent):void
{
var dataBytes:ByteArray = byteArrayFromComponent(component); // The
bit that does all the real work!
var crossPlatform:ICrossPlatform;

pieChartContainer.styleName = null;

crossPlatform = CrossPlatform.getInstance();
crossPlatform.saveByteArrayFile(dataBytes, currentFilter.sFilterName
+ .png);
}

The problem is that although the pie chart gets the change in text
colour before the snapshot is taken, if the Legend control is included

[flexcoders] How do I make sure container's child components have applied new style before ImageSnapshot?

2008-08-29 Thread Ian M. Jones
Hi,

I'm having a bit of a problem with capturing a snapshot of a VBox's  
contents with a simple colour change applied through a styleName change.

The container layout is something like:

mx:VBox id=pieChartContainer width=100% height=100%  
horizontalAlign=center
mx:Label id=pieChartTitle
text={currentFilter.sFilterName}
fontSize=14
fontWeight=bold
textDecoration=underline/
mx:PieChart id=pieChart width=100% height=100%
showDataTips=true dataTipFunction=pieChartDataTipFunction
resizeEffect={moveAndResize}
mx:series
// Some series, not relevant to problem.
/mx:series
/mx:PieChart
mx:Legend id=pieChartLegend
dataProvider={pieChart}
width=100%
visible={chkPieChartLegend.selected}
includeInLayout={chkPieChartLegend.selected}
direction=horizontal
resizeEffect={moveAndResize}/
/mx:VBox

Because by default my app has a dark theme with light text applied  
through CSS, before capturing a snapshot, I set the style to:

.forPrint
{
color: #00;
}

This means the image should have black text which is good for print etc.

I call saveToFile() to start the capture, only when the referenced pie  
chart is visible.

private function saveToFile():void
{
pieChartContainer.styleName = forPrint;
callLater(saveSnapshotAndResetStyleName, [pieChartContainer]);
pieChartContainer.validateNow();
}

private function  
saveSnapshotAndResetStyleName(component:UIComponent):void
{
var dataBytes:ByteArray = byteArrayFromComponent(component); // The  
bit that does all the real work!
var crossPlatform:ICrossPlatform;

pieChartContainer.styleName = null;

crossPlatform = CrossPlatform.getInstance();
crossPlatform.saveByteArrayFile(dataBytes, currentFilter.sFilterName  
+ .png);
}

The problem is that although the pie chart gets the change in text  
colour before the snapshot is taken, if the Legend control is included  
in the container it still retains it's light label colour.

As you can see from the code above I've tried to delay the capture  
until the refresh happens by using a combination of callLater and  
validateNow, but that doesn't seem to help.

If I comment out the resetting of the container's styleName after the  
snapshot has been taken, the Legend control is shown with the required  
black text, so the change does happen, but not before I take the  
snapshot.

Has anyone got any advice on how to make sure a container and it's  
child controls have applied a new style before using ImageSnapshot?

Thanks in advance for your help,

Ian

IMiJ Software
http://www.imijsoft.com
http://www.ianmjones.net (blog)



[flexcoders] Capturing Cmd-C (or Ctrl-C) keyboard event from modular Flex application in browser or AIR.

2008-08-28 Thread Ian M. Jones
Hi,

It seems that it is impossible to capture the keyboard event normally  
used for copy when running a Flex application in the browser or as an  
AIR app, presumably because the browser or OS is intercepting it first.

Is there a way to tell the browser or OS to let the event through?

For example, on an AdvancedDataGrid I have set the keyUp event to  
handleCaseListKeyUp(event), which calls the following function:

private function handleCaseListKeyUp(event:KeyboardEvent):void
{
var char:String = String.fromCharCode(event.charCode).toUpperCase();

if (event.ctrlKey  char == C)
{
trace(Ctrl-C);
copyCasesToClipboard();
return;
}

if (!event.ctrlKey  char == C)
{
trace(C);
copyCasesToClipboard();
return;
}

// Didn't match event to capture, just drop out.
trace(charCode:  + event.charCode);
trace(char:  + char);
trace(keyCode:  + event.keyCode);
trace(ctrlKey:  + event.ctrlKey);
trace(altKey:  + event.altKey);
trace(shiftKey:  + event.shiftKey);
}

When run, I can never get the release of the C key while also  
pressing the command key (which shows up as KeyboardEvent.ctrlKey). I  
get the following trace results:
charCode: 0
char:
keyCode: 17
ctrlKey: false
altKey: false
shiftKey: false
As you can see, the only event I can capture is the release of the  
command key, the release of the C key while holding the command key  
isn't even sent.

Has anyone successfully implemented standard copy and paste keyboard  
handling?

Am I destined to just use the C key on it's own (as shown in the  
code example) or make a copy button available?

Or do I need to create the listener manually at a higher level and  
pass the event down into my modular application's guts?

Thanks in advance for any help.

Ian

IMiJ Software
http://www.imijsoft.com
http://www.ianmjones.net (blog)



Re: [flexcoders] Capturing Cmd-C (or Ctrl-C) keyboard event from modular Flex application in browser or AIR.

2008-08-28 Thread Ian M. Jones
Thanks Alex, I'll see what I can find on using JavaScript and  
ExternalInterface then.

Thanks,

Ian

On 28 Aug 2008, at 18:10, Alex Harui wrote:


 Not really.  I think some folks capture the event in javascript and  
 notify Flash via ExternalInterface.



 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]  
 On Behalf Of Ian M. Jones
 Sent: Thursday, August 28, 2008 5:33 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Capturing Cmd-C (or Ctrl-C) keyboard event  
 from modular Flex application in browser or AIR.



 Hi,

 It seems that it is impossible to capture the keyboard event normally
 used for copy when running a Flex application in the browser or as an
 AIR app, presumably because the browser or OS is intercepting it  
 first.

 Is there a way to tell the browser or OS to let the event through?

 For example, on an AdvancedDataGrid I have set the keyUp event to
 handleCaseListKeyUp(event), which calls the following function:

 private function handleCaseListKeyUp(event:KeyboardEvent):void
 {
 var char:String = String.fromCharCode(event.charCode).toUpperCase();

 if (event.ctrlKey  char == C)
 {
 trace(Ctrl-C);
 copyCasesToClipboard();
 return;
 }

 if (!event.ctrlKey  char == C)
 {
 trace(C);
 copyCasesToClipboard();
 return;
 }

 // Didn't match event to capture, just drop out.
 trace(charCode:  + event.charCode);
 trace(char:  + char);
 trace(keyCode:  + event.keyCode);
 trace(ctrlKey:  + event.ctrlKey);
 trace(altKey:  + event.altKey);
 trace(shiftKey:  + event.shiftKey);
 }

 When run, I can never get the release of the C key while also
 pressing the command key (which shows up as KeyboardEvent.ctrlKey). I
 get the following trace results:
 charCode: 0
 char:
 keyCode: 17
 ctrlKey: false
 altKey: false
 shiftKey: false
 As you can see, the only event I can capture is the release of the
 command key, the release of the C key while holding the command key
 isn't even sent.

 Has anyone successfully implemented standard copy and paste keyboard
 handling?

 Am I destined to just use the C key on it's own (as shown in the
 code example) or make a copy button available?

 Or do I need to create the listener manually at a higher level and
 pass the event down into my modular application's guts?

 Thanks in advance for any help.

 Ian
 
 IMiJ Software
 http://www.imijsoft.com
 http://www.ianmjones.net (blog)


 




--
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

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

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

* To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

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

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



Re: [flexcoders] UK rapid addressing web api

2008-03-31 Thread Ian M. Jones
Hi Glenn,

Have you looked at QuickAddress?

Just had a quick look on their website, looks like they have software  
targeted at those wanting to use web technologies. It's not a public  
interface though, you need to install their software on your own  
servers.

http://www.qas.co.uk/products/capture-name-and-address-data/pro-web.htm

Worth a look if this is a possible route for you rather than using a  
public service.

Regards,

Ian

IMiJ Software
http://www.imijsoft.com
http://www.ianmjones.net (blog)




On 31 Mar 2008, at 09:56, Glenn Williams wrote:

 oh great!!!



 I think I better just up-sticks and move to the  USA,

 only us English could think of letting someone ‘own’ the postcode!



 the more I look into this the depressed I’m getting lol



 I refuse to make the application users have to enter the address  
 data though,

 rapid addressing is just the kind of thing that should

 be automated in applications.



 I’ll keep you posted of how this works out, and by the looks of  
 things – how much it6 costs me!









 Glenn





--
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

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

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

* To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

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

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



Re: [flexcoders] No Serial Numbers for Flex Builder 3?

2008-02-25 Thread Ian M. Jones
I had the same problem, ordered FlexBuilder 3 Professional upgrade  
this morning, in the email confirmation entitled Your Serial Numbers  
it said Contact Customer Service under Adobe Flex Builder 3  
Professional (Mac/Win,English), and on my downloads page in my Adobe  
account it also said Contact Customer Service in place of a serial  
number.

So I contacted our local (UK) customer service, spoke to a nice lady  
who checked out my order and said she'd get back in contact when she  
got the serial number.

Although she was supposed to send it by email, she called and said  
that I should now have an email with the serial number. I didn't have  
it, but she said I should be able to see it in the downloads in my  
online account. I went online (keeping her on the phone until I could  
verify), and sure enough my serial number was there.

I have my serial number, after a little wait, hopefully the bug in  
serial number delivery has been fixed by now.

Ian

On 25 Feb 2008, at 15:09, Battershall, Jeff wrote:

 I upgraded to Pro but no S/N. Wasted 20 minutes on the phone to  
 discuver
 this.

 Also - was asked for my Adobe ID - anyone know where that can be found
 online? I sure couldn't and finally they verfied my identity via my  
 home
 phone number. If Customer Service is going to ask for such things, it
 has to be somewhere where you can find it.

 Jeff

 -Original Message-
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]  
 On
 Behalf Of Claus Wahlers
 Sent: Monday, February 25, 2008 9:33 AM
 To: flexcoders@yahoogroups.com
 Subject: Re: [flexcoders] No Serial Numbers for Flex Builder 3?

 FWIW, i just purchased Flex Builder 3 Standard Upgrade and got my  
 serial

 instantly.

 Cheers,
 Claus.

 Paul Whitelock wrote:

  I purchased the upgrade to Flex Builder 3 Professional and after the
  order went through instead of a serial number all that I got was a
  message that said Contact Customer Service.
 
  I just got off of a 15 minute phone call with Customer Service and  
 was

  told that it will take 24 to 48 hours before serial numbers are
  available. Supposedly I will receive an email with the serial  
 number,
  but after many bad experiences with Adobe Customer Service, let's  
 just

  say I'll believe it when I see it ;-)
 
  Anyway, just wanted to get the word out in case you buy Flex  
 Builder 3

  and expect to receive a serial number for the product at the time  
 you
  make the purchase.

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


 



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

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

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

* To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

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

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


Re: [flexcoders] Re: Flex 3 and AIR 1 are now live!

2008-02-25 Thread Ian M. Jones
I had the same bouncing for a long time problem, and then it stayed in  
the dock but without an active indicator using Mac OS X 10.5.2.  
Here's how I got the install to work.

I Force Quitted it from a right click on its dock icon.
Copied the installer onto my hard disk from the mounted disk image.
Unmounted both disk images (clicking cancel on the This application  
was downloaded from the internet... dialog that then appeared).
Then ran the installer that I copied to my hard disk, and OK'd the  
This application was downloaded from the internet... dialog that now  
properly displayed (I think this dialog might have been to blame for  
the first no-show).
I then needed to cmd-tab to the installer as it seemed to start hidden.
 From then on it was fine (although I did quit it part way through so  
that I could uninstall the FB3 beta before proceeding).

Hope that helps.

Ian

On 25 Feb 2008, at 13:30, Markus wrote:

 Have the same problem. Mac OS X 10.5.1 or 10.5.2, doesn't matter ...  
 bouncing installer app
 icon. Just bought the FB3 Professional version ... called Adobe for  
 technical support for a
 paid product and got the answer: Sorry, no support for that ...  
 maybe with a Gold Support
 contract ... WOW, I'm really astonished! Will return it to Adobe as  
 uninstallable product.

 Regards
 Markus

 --- In flexcoders@yahoogroups.com, Alisdair Mills  
 [EMAIL PROTECTED] wrote:
 
  just downloaded the standalone and plugin versions for a mac. both
  installers bounce on the dock for an age before giving up. i'm on
  10.5.2 intel... thought i'd throw this out there to find out if it  
 is
  just my machine or something wrong with the mac installers?
 
  anyone successfully installed the mac version yet?
 


 



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

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

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

* To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

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

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


Re: [flexcoders] xml and dataprovider for simple chart

2007-12-05 Thread Ian M. Jones

Try...

dataProvider ={xmlData.entry[0].One}

or

dataProvider ={xmlData.*.One}

On 5 Dec 2007, at 15:52, y.mauron wrote:


Dear all,

I have a problem which certainly be very easy. I have a xml varialbe
like the following :

var test:String = rootentry
id=123Oney813/yx270/x/One/entryentry
id=123Oney890/yx280/x/One/entry/root;
var xmlData = new XML(test);

and would like to use this as dataprovider for my chart. Each entry
represent a series. (Rem: the number of entry entry is not known at
the beninig). I then code that :
mx:ColumnChart id=columnChart height=100% width=100%
paddingLeft=0 paddingRight=0
showDataTips=true columnWidthRatio=1
maxColumnWidth=1
dataProvider ={xmlData.entry.One}

But cannot see the two lines... and even not one...







[flexcoders] Re: Problem with setting initial sort of AdvancedDataGrid via data provider.

2007-12-05 Thread Ian M. Jones
--- In flexcoders@yahoogroups.com, Ian M. Jones [EMAIL PROTECTED] wrote:

 Hi there, hope someone has come across my problem and can point out  
 my mistake...
 
 I have an ArrayCollection acting as the data provider for an  
 AdvancedDataGrid, and am saving out the data provider's sort fields  
 array to a SharedObject between sessions and refreshes of the data.
 
 When I retrieve new data I grab the array of sort fields and stuff  
 them into the ArrayCollection's sort property like so:
 
 private function getDefaultColumnsSort():void {
   var prefs:SharedObject = SharedObject.getLocal(FogBugzModule);
 
   // Look for a saved sort order.
   if (defaultColumnsSort in prefs.data) {
   var sort:Sort = new Sort();
   sort.compareFunction = customCompare;
   sort.fields = new Array();
   for (var y:int = 0; y  prefs.data.defaultColumnsSort.length; 
 y++) {
   if (prefs.data.defaultColumnsSort[y] != null) {
   if (name in prefs.data.defaultColumnsSort[y]) 
 {
   if 
 (prefs.data.defaultColumnsSort[y].name != null) {
   var sortField:SortField = new 
 SortField 
 (prefs.data.defaultColumnsSort[y].name, true, Boolean 
 (prefs.data.defaultColumnsSort[y].descending));
   sort.fields.push(sortField);
   }
   }
   }
   }
   // Add sort criteria to data provider.
   casesArray.sort = sort;
   // Sort data in data provider.
   casesArray.refresh();
   }
 }
 
 The problem is, the ADG does sort the data by the right columns, but...
 
 * it's always in ascending order, even though the column headers show  
 the sort arrow correctly pointing down if the saved sort was descending.
 
 * if you click on the column header to re-sort it nothing happens,  
 the sort arrow will flip-flop between pointing up and down as many  
 times as you like, but sort order is always ascending.
 
 * The sorted column will not sort properly until I sort another  
 column by clicking it's header first, then it'll properly sort  
 ascending and descending when clicked.
 
 The Sort object I'm assigning to the casesArray ArrayCollection above  
 looks OK, it just seems there is something not quite right in the  
 way the ADG uses it.
 
 If anyone has any advice, I'd be very grateful.
 
 Thanks,
 
 Ian


Fixed it.

I got close to solving the problem by removing the compareFunction from the 
Sort I was 
constructing at startup, but that meant numeric, date and compound columns were 
always 
sorted alphabetically instead of numerically, by date or through the two or 
more data 
fields that made up the column respectively. But at least it was sorting in the 
right 
direction and the direction could be changed correctly. This was definitely my 
fault, I 
shouldn't have used the custom compareFunction because I dynamically add a 
sortCompareFunction to any AdvancedDataGridColumn that needs it when adding the 
user's preferred columns to the AdvancedDataGrid, so I didn't need to reference 
another 
custom compare function on the data provider.

But why wasn't the AdvancedDataGrid using it's column's sortCompareFunction 
definitions?

When I created the SortFields for the initial sort I was setting the ignore 
case property to 
true just as a means of getting to the descending parameter that I was truly 
interested in, 
when I set that to false, suddenly the AdvancedDataGrid was using the correct 
sortCompareFunctions for it's columns. Very strange.

On reflection, it could be that the framework is assuming that if the SortField 
has it's 
ignore case property set to true then it must need to do an alphabetic sort, 
regardless of 
whether there's a custom compare function on the column or not.

Hey ho, it's fixed now.

Cheers,

Ian



[flexcoders] Problem with setting initial sort of AdvancedDataGrid via data provider.

2007-11-29 Thread Ian M. Jones
Hi there, hope someone has come across my problem and can point out  
my mistake...

I have an ArrayCollection acting as the data provider for an  
AdvancedDataGrid, and am saving out the data provider's sort fields  
array to a SharedObject between sessions and refreshes of the data.

When I retrieve new data I grab the array of sort fields and stuff  
them into the ArrayCollection's sort property like so:

private function getDefaultColumnsSort():void {
var prefs:SharedObject = SharedObject.getLocal(FogBugzModule);

// Look for a saved sort order.
if (defaultColumnsSort in prefs.data) {
var sort:Sort = new Sort();
sort.compareFunction = customCompare;
sort.fields = new Array();
for (var y:int = 0; y  prefs.data.defaultColumnsSort.length; 
y++) {
if (prefs.data.defaultColumnsSort[y] != null) {
if (name in prefs.data.defaultColumnsSort[y]) 
{
if 
(prefs.data.defaultColumnsSort[y].name != null) {
var sortField:SortField = new 
SortField 
(prefs.data.defaultColumnsSort[y].name, true, Boolean 
(prefs.data.defaultColumnsSort[y].descending));
sort.fields.push(sortField);
}
}
}
}
// Add sort criteria to data provider.
casesArray.sort = sort;
// Sort data in data provider.
casesArray.refresh();
}
}

The problem is, the ADG does sort the data by the right columns, but...

* it's always in ascending order, even though the column headers show  
the sort arrow correctly pointing down if the saved sort was descending.

* if you click on the column header to re-sort it nothing happens,  
the sort arrow will flip-flop between pointing up and down as many  
times as you like, but sort order is always ascending.

* The sorted column will not sort properly until I sort another  
column by clicking it's header first, then it'll properly sort  
ascending and descending when clicked.

The Sort object I'm assigning to the casesArray ArrayCollection above  
looks OK, it just seems there is something not quite right in the  
way the ADG uses it.

If anyone has any advice, I'd be very grateful.

Thanks,

Ian


Re: [flexcoders] Remember Username/Password !

2007-05-31 Thread Ian M. Jones
Hi Ravi,

You can do cookie like stuff with SharedObjects.

Regards,
-- 
Ian M. Jones

IMiJ Software
http://www.imijsoft.com
http://www.ianmjones.net (blog)

On Thu, May 31, 2007 10:59, Ravi Kumar Gummadi wrote:
 Hi all,



 How do we enable the functionality of remembering the credentials
 (username/password) in a flex application?

 Since we can't know the IP address of client, I don't see a way how we
 achieve it.



 Any inputs would really do a world of good.



 Thanks in Advance



 Regards

 Ravi

 Partygaming








Re: [flexcoders] CALL MULTIPLE WEB SERVICES AT ONE EVENT ONLY

2007-05-30 Thread Ian M. Jones
Hi Kanu,

You're correct, you need to create a handler for the result event of the
first webservice, and in there call the second service.

See Handling asynchronous calls to services in the developer guide:
http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/js/html/wwhelp.htm?href=Part2_DevApps_048_1.html

-- 
Ian M. Jones

IMiJ Software
http://www.imijsoft.com
http://www.ianmjones.net (blog)

On Wed, May 30, 2007 08:37, kanu kukreja wrote:
 After successful completion of one web service, i'm calling another web
 service, but its showing 2 results one is the same result as first service
 and  another one is the result for original one i need.

   i think this is an issue of threading, i must wait before calling
 another service till then i'll get the complete result from 1st service.



 Best Regards
   Kanu Kukreja


 -
 Building a website is a piece of cake.
 Yahoo! Small Business gives you all the tools to get online.




Re: [flexcoders] Retrieving saved DataGrid columns array from local SharedObject.

2007-05-29 Thread Ian M. Jones
Just to follow up...

I installed hot fix 2 yesterday, which cleared up my problem with  
setting the width of non-visible columns (i.e. scrolled off to right  
in this case).

So, thank you jake247, your code is working very well for me.

Regards,

Ian

IMiJ Software
http://www.imijsoft.com
http://www.ianmjones.net (blog)


On 25 May 2007, at 19:08, Ian M. Jones wrote:

 Hi all,

 Thanks for the help Tracey and Tom, I've tried to do something along
 the lines of what you suggested but keep running up against the
 problem of casting from Object to DataGridColumn.

 jake247, your code works pretty well, I think I could probably alter
 it to get what I really want if I work on it a little more (the
 columns may need to be added or removed).

 However, I assume you're using a grid without a horizontal scroll
 bar, as I seem to have found a bug in the DataGrid when running your
 code. When it get's to the point where the width is set on the newCol
 for a column that is off to the right and not visible until the
 scrollbar is used, it complains about a missing property because it's
 internally trying to reference an element in the visibleColumns array
 which isn't there. I need to either fix this in the DataGrid source
 or find a work around.

 Ian


 On 24 May 2007, at 20:38, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Ask and ye shall receive ... we solved this exact problem about a
 month ago ...
 - 
 -
 ---
 //  Save grid settings to shared object
  public function saveGridSettings():void {
  var name:String = lineItemGrid.name;
  var gWidth:int = lineItemGrid.width;
  var cols:Array = new Array();
  var savedLastSort:String = lastSort;
  var savedReversed:Boolean = reversed;
  for (var i:int = 0; i  
 lineItemGrid.columns.length; i++) {
  cols[i] = lineItemGrid.columns[i];  
  }
  
  // Write grid data to shared object
  lineItemGridSO = 
 SharedObject.getLocal(gridData, /);
  lineItemGridSO.data.name = name;
  lineItemGridSO.data.gridWidth = gWidth;
  lineItemGridSO.data.lastSort = savedLastSort;
  lineItemGridSO.data.reversed = savedReversed;
  lineItemGridSO.data.gridCols = new Array();
  lineItemGridSO.data.gridCols = cols;
  lineItemGridSO.flush(); 
  }
  
  // Get grid settings from shared object
  public function getGridSettings():void {
  lineItemGridSO = 
 SharedObject.getLocal(gridData, /);
  if (lineItemGridSO.data.name != undefined) {
  lastSort = 
 lineItemGridSO.data.lastSort;
  var newCols:Array = new Array();
  for (var i:int = 0; i  
 lineItemGridSO.data.gridCols.length; i+
 +) {
  for (var j:int = 0; j  
 lineItemGrid.columns.length; j++) {
  if 
 (lineItemGrid.columns[j].dataField ==
 lineItemGridSO.data.gridCols[i].dataField) {
  var 
 newCol:DataGridColumn = DataGridColumn
 (lineItemGrid.columns.splice(int(j), 1)[0]);
  newCol.width = 
 lineItemGridSO.data.gridCols[i].width;
  
 newCols.push(newCol);
  }
  }
  }
  newCols.concat(lineItemGrid.columns);
  lineItemGrid.columns = newCols;
  }
  }
  Ian M. Jones [EMAIL PROTECTED] wrote:
 Hi all,

 I'm trying to set up a simple way to save a user's DataGrid column
 setup
 to a local SharedObject, and then retrieve those settings when
 they next
 run the application.

 Saving them seems to have been pretty simple:

 public function savePreferences():void {
 var prefs:SharedObject = SharedObject.getLocal(Preferences);
 var defaultColumns:Array = myDataGrid.columns;
 prefs.data.defaultColumns = defaultColumns;
 prefs.flush();
 }

 That works, I can see the objects

Re: [flexcoders] Retrieving saved DataGrid columns array from local SharedObject.

2007-05-25 Thread Ian M. Jones
Hi all,

Thanks for the help Tracey and Tom, I've tried to do something along  
the lines of what you suggested but keep running up against the  
problem of casting from Object to DataGridColumn.

jake247, your code works pretty well, I think I could probably alter  
it to get what I really want if I work on it a little more (the  
columns may need to be added or removed).

However, I assume you're using a grid without a horizontal scroll  
bar, as I seem to have found a bug in the DataGrid when running your  
code. When it get's to the point where the width is set on the newCol  
for a column that is off to the right and not visible until the  
scrollbar is used, it complains about a missing property because it's  
internally trying to reference an element in the visibleColumns array  
which isn't there. I need to either fix this in the DataGrid source  
or find a work around.

Ian


On 24 May 2007, at 20:38, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Ask and ye shall receive ... we solved this exact problem about a  
 month ago ...
 -- 
 ---
 //  Save grid settings to shared object
   public function saveGridSettings():void {
   var name:String = lineItemGrid.name;
   var gWidth:int = lineItemGrid.width;
   var cols:Array = new Array();
   var savedLastSort:String = lastSort;
   var savedReversed:Boolean = reversed;
   for (var i:int = 0; i  
 lineItemGrid.columns.length; i++) {
   cols[i] = lineItemGrid.columns[i];  
   }
   
   // Write grid data to shared object
   lineItemGridSO = 
 SharedObject.getLocal(gridData, /);
   lineItemGridSO.data.name = name;
   lineItemGridSO.data.gridWidth = gWidth;
   lineItemGridSO.data.lastSort = savedLastSort;
   lineItemGridSO.data.reversed = savedReversed;
   lineItemGridSO.data.gridCols = new Array();
   lineItemGridSO.data.gridCols = cols;
   lineItemGridSO.flush(); 
   }
   
   // Get grid settings from shared object
   public function getGridSettings():void {
   lineItemGridSO = 
 SharedObject.getLocal(gridData, /);
   if (lineItemGridSO.data.name != undefined) {
   lastSort = 
 lineItemGridSO.data.lastSort;
   var newCols:Array = new Array();
   for (var i:int = 0; i  
 lineItemGridSO.data.gridCols.length; i+ 
 +) {
   for (var j:int = 0; j  
 lineItemGrid.columns.length; j++) {
   if 
 (lineItemGrid.columns[j].dataField ==  
 lineItemGridSO.data.gridCols[i].dataField) {
   var 
 newCol:DataGridColumn = DataGridColumn 
 (lineItemGrid.columns.splice(int(j), 1)[0]);
   newCol.width = 
 lineItemGridSO.data.gridCols[i].width;
   
 newCols.push(newCol);
   }
   }
   }
   newCols.concat(lineItemGrid.columns);
   lineItemGrid.columns = newCols;
   }
   }
  Ian M. Jones [EMAIL PROTECTED] wrote:
 Hi all,

 I'm trying to set up a simple way to save a user's DataGrid column  
 setup
 to a local SharedObject, and then retrieve those settings when  
 they next
 run the application.

 Saving them seems to have been pretty simple:

 public function savePreferences():void {
 var prefs:SharedObject = SharedObject.getLocal(Preferences);
 var defaultColumns:Array = myDataGrid.columns;
 prefs.data.defaultColumns = defaultColumns;
 prefs.flush();
 }

 That works, I can see the objects in the Preferences.sol file, but I
 haven't found a way of setting the grid's columns after reading it  
 back
 in.

 I've tried reading back into an array and then setting the columns
 property to the array.
 I've tried iterating through the array with a for each casting the  
 results
 to a DataGridColumn, appending to an ArrayCollection and then finally
 setting

[flexcoders] Retrieving saved DataGrid columns array from local SharedObject.

2007-05-24 Thread Ian M. Jones
Hi all,

I'm trying to set up a simple way to save a user's DataGrid column setup
to a local SharedObject, and then retrieve those settings when they next
run the application.

Saving them seems to have been pretty simple:

public function savePreferences():void {
var prefs:SharedObject = SharedObject.getLocal(Preferences);
var defaultColumns:Array = myDataGrid.columns;
prefs.data.defaultColumns = defaultColumns;
prefs.flush();
}

That works, I can see the objects in the Preferences.sol file, but I
haven't found a way of setting the grid's columns after reading it back
in.

I've tried reading back into an array and then setting the columns
property to the array.
I've tried iterating through the array with a for each casting the results
to a DataGridColumn, appending to an ArrayCollection and then finally
setting the DataGrid's columns to the ArrayCollection.toArray, that didn't
get very far.
I've tried binding the DataGrid's columns property to an Array, and then
setting that array to the prefs.data.defaultColumns.

Nothing seems to work, the app generally seems to hang at the point I try
to set the columns property.

Is there a kind soul that can point me in the right direction?

Thanks,
-- 
Ian M. Jones

IMiJ Software
http://www.imijsoft.com
http://www.ianmjones.net (blog)



Re: [flexcoders] Re: Datagrid auto sorting. Has anyone done this?

2007-05-22 Thread Ian M. Jones
As a total newbie, having just seen this in the docs, I may be totally
wrong, but have you looked at the DataGrid's placeSortArrow() method?

I'm not sure how you use it, but it looks promising.

Regards,
-- 
Ian M. Jones

IMiJ Software
http://www.imijsoft.com
http://www.ianmjones.net (blog)

On Tue, May 22, 2007 14:06, polestar11 wrote:
 Hi there

 I tried exactly that in various different ways, but wasnt able to get
 it to work.

 I have an array, which I convert to an array collection, on which I
 sort and refresh, after which I set as a dataProvider for my DataGrid.

 Still no sort arrow is shown.

 I then tried extending the DataGrid class, but that opened up another
 can of worms

 Help, anyone??
 Tracy


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

 On 4/28/07, Mark Piller [EMAIL PROTECTED] wrote:
  Do you know how to configure a datagrid to automatically sort in a
  particular column before the data is rendered?

 Basically you just set the sort on the collection, and the DataGrid
 will appropriately display a sort arrow on the header. So it's the
 collection you need to sort.

 You can see an example of how to sort a collection here:

 http://www.adobe.com/livedocs/flex/2/langref/mx/collections/Sort.html





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