Re: [flexcoders] Re: Future Scope of Flex

2014-08-16 Thread David Adams dpad...@gmail.com [flexcoders]

 like promises - that were never really implemented in Flex/flash.
 Like what specifically?


Try this:

http://www.html5rocks.com/en/tutorials/es6/promises/


Re: [flexcoders] MS - The future of the web is HTML 5

2010-04-30 Thread David Adams
On Sat, May 1, 2010 at 12:13 PM, Guy Morton g...@alchemy.com.au wrote:
 http://www.engadget.com/2010/04/30/microsoft-weighs-in-the-future-of-the-web-is-html5/

 and

 http://blogs.msdn.com/ie/archive/2010/04/29/html5-video.aspx


 So, I wonder if the Steve/Apple bashing will now move on to MS-bashing? I'm 
 guessing not...

I think it's a pain that Apple won't allow Flash on their devices and
are blocking cross-compiling. I personally like Flex because it seems
to be the best way to make cross-platform RIA apps these days - it's a
whole lot faster and easier than using a JS framework. I'd really like
to see the platform continue to improve and flourish.

With that said, Adobe needs to lift their game in some areas. Not
picking on Flex or Flash here, but Adobe has really become the new
Microsoft when it comes to security problems. PDF exploits, as an
example, have been in the news a lot this year. Apple and Microsoft
both make patching/updating the OS and various critical components a
pretty smooth experience. Adobe? I'm technical and fail more often
than not. The most reliable thing to do is to download the full
installer for the product (if you can find the right version) and
install from scratch. Not good.


Re: [SPAM] [flexcoders] Component Data Calls

2010-02-22 Thread David Adams
On Mon, Feb 15, 2010 at 3:28 AM, Dan Pride danielpr...@yahoo.com wrote:

   Thank you for your answer.
 Question if you would, I have been asking it everywhere and get NO
 satisfactory answers.
 How to approach a multi-windowed application, particurarly in FB4?
 1) Different Urls?
 2) ViewStacks?
 3) States?
 4) ViewStacks of States (Master-Detail in one ViewStack as two states)?
 5) Do States initialize in Flash Builder 4? I had heard they do not?


Dan,

You might like the following video from near the end of Adobe's Learn Flex
in a Week training:

http://www.adobe.com/devnet/flex/videotraining/xml/vid41.html

It's a pretty nice, simple example of building and then lazy-loading a
module only once (and if) it's needed.


Re: [SPAM] [flexcoders] Component Data Calls

2010-02-22 Thread David Adams
On Tue, Feb 23, 2010 at 12:52 PM, Dan Pride danielpr...@yahoo.com wrote:



 There seem to be so many different ways to approach this issue, someone
 should write a book on it. I know I would buy it.


So would I.


Re: [flexcoders] A framework to help with busines apps?

2010-02-21 Thread David Adams
On Fri, Feb 12, 2010 at 5:23 AM, Nick Middleweek n...@middleweek.co.ukwrote:

  My background is 4D DB (www.4d.com) and there are great ways to work and
 certain events are good for loading data, related data in sub screens. I'm
 not trying to replacte 4D within Flex because architectural it's different
 but I guess every developer is faced with similar issues and to overcome the
 same hurdles and was hoping there are some good practices out there I can
 follow..

Hey again Nick!  For any other 4D programmers following this list, there's a
special-topic list for 4D-Flex development that may also be of interest:

http://groups.google.com/group/4d-flex

The 4D-Flex list is no substitute for FlexCoders, but the special-purpose
list is a nice place for those of us that already know 4D.


[flexcoders] Strategies for switching between testing and deployment addresses

2010-02-21 Thread David Adams
I've been writing some small programs that use HTTPService calls to
fetch data from a back-end. During testing, I'm using 127.0.0.1 or an
IP address on my subnet. When I deploy, I update the IP address in
service definitions to the right external address and build the app.
Or at least I mean to. It's all too easy to accidentally change the
addresses for internal testing and then forget to switch them back
before building.

Is there a best practice or simple strategy for putting the IP address
somewhere outside of the source code that it can easily be edited
without a rebuild?

Thanks for any advice.


[flexcoders] Validation: Enabling buttons on click and validating inputs on committing vales - good strategies?

2010-01-28 Thread David Adams
I'm trying to set up an interface with validation and am trying to do
a couple of things at the same time:

* Enable/disable some buttons as a user types into a couple of input
areas. So, the button higlight is triggered on click.

* Validate each input area once the user leaves it. So, the
validation/error is triggered on the default of valueCommmit.

Using standard validators, the input areas are validated when their
value is confirmed - which is exaclty what I want. But, I also want
the buttons to enable/disable as soon as plausible inputs are
received. Unfortunately, if I test the validator on the change event,
then the field is validated and an error shows up immediately. That's
pretty annoying for the user. For example, after typing one character
into an email input the validation error pops up. Obviously, that's
unreasonably aggressive validation.

I've had a look around at a lot of validation examples but haven't
found one to match what I'm aiming for.  I've built a simple working
example and posted it here:

http://www.wombatcountry.com/flex/validator/ValidatorTest.html

View source option turned on and I'll paste the source MXML at the end
of this post. (I jammed everything into a single document for this
example.) Briefly, I'm trying to

* Provide a validation error/tip/hint when the user _leaves_ the email
input or the password input.

* Update the enabled status of the Email my password and Login
buttons after each keystroke.

This is working in the demo, but I'm pretty sure I've done it in a way
that's far more complicated than it shold be. How it works (as the
source shows):

* Copy the text of the inputs into shadow variables (public vars
declared near the top) using  binding tags.

* Defined redundant validators that test the shadow variables instead
of the real values to avoid the validation error appearing on click.

* Put a method onto the change event for the inputs. This method
(validateOnChange) calls the shadow validators and sets a pair of
bindable flag variables (emailIsValid and lookupIsValid).

* Bind the enabled property on the buttons to the flag variables.

I actually will need something exactly like this for a form much like
this, so it's not just a made-up example. However:

* I'm going to need something similar with a couple of dozen inputs. I
don't want dozens of shadow variables and bunches of redundant
validators.

* There just has to be a simpler wayit's kind of unreasonably
complicated the way I've done it.

I've hunted around for an example that works like mine and failed to
find one...I've sort of pieced what I've done together bit by bit. The
behavior is right but the implementation seems far from ideal.

Can anyone suggest improvements or point me towards some feature or
behavior I've missed?

Apologies for the lengthy question and thanks in advance for answers,
suggestions, or links.

The full source is below:

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
layout=absolute
backgroundColor=#FF
 viewSourceURL=srcview/index.html

mx:Script
![CDATA[
import mx.events.ValidationResultEvent;
[Bindable]  private var emailIsValid:Boolean = 
false;
[Bindable]  private var lookupIsValid:Boolean = 
false;

public var 
emailToValidate:String = new String();
public var 
passwordToValidate:String = new String();

private function validateOnChange () : void {
// The 'lookup' and 'send password' button 
enabled properties are
bound to these variables:
var 
_emailValidationResult:ValidationResultEvent =
onChangeEmailValidator.validate();
emailIsValid =  _emailValidationResult.type == 
ValidationResultEvent.VALID;

lookupIsValid = false;  
if (emailIsValid) { 

// The lookup button should be enabled 
once (and only when) there
is a valid-looking
// email address and a password that 
seems okay.
var 
_passwordValidationResult:ValidationResultEvent =
onChangePasswordValidator.validate();
if (_passwordValidationResult.type == 
ValidationResultEvent.VALID)
lookupIsValid = true;
}   
}
]]
/mx:Script

mx:Binding source={lookupEmail.text} 

Re: [SPAM] [flexcoders] Reading URL arguments from within initApp()

2010-01-24 Thread David Adams
On Mon, Jan 25, 2010 at 2:27 AM, Tracy Spratt tr...@nts3rd.com wrote:



  There are several ways to do this.  I usually use javascript in the html
 wrapper to split the url params in to an array:


Thanks for the suggestion. Is there a way to do it from within the Flex code
itself?


Re: [flexcoders] Re: Compressing messages/data: What binary/compression formats are workable in Flex?

2009-03-06 Thread David Adams
On Sat, Mar 7, 2009 at 2:06 AM, valdhor valdhorli...@embarqmail.com wrote:
 You still avoid telling us your back-end setup.

 I give up.

I'm not meaning to frustrate you - particularly since you're being
kind enough to spend your time sending me suggestions. The back-end is
called 4D and it definitely does not have server-side AMF support. I
know the right people to ask and have already triple-checked that AMF
support is not available. I've even checked with people that might
have had reason to roll their own AMF support and none of them have.
The main product itself isn't going to have new features added until
the next version which doesn't have any announced date.

I just didn't think it was worth wasting people's time trying to find
an answer on the server-side as I've already got that covered.

Thanks for your help.


Re: [flexcoders] Re: Compressing messages/data: What binary/compression formats are workable in Flex?

2009-03-06 Thread David Adams
On Sat, Mar 7, 2009 at 8:38 AM, David Adams dpad...@gmail.com wrote:
 On Sat, Mar 7, 2009 at 2:06 AM, valdhor valdhorli...@embarqmail.com wrote:
 You still avoid telling us your back-end setup.

 I give up.

I figure I should address the next obvious suggestion in advance. Is
something like the following possible?

 [Flash Player]  --- AMF---  [Apache + Zend] --- XML or
something--- [4D]

Yes, it's entirely possible to put Apache (or what have you) into what
amounts to a smart proxying roll. It's even possible this setup would
deliver performance gains and other useful features as a bonus. There
are definitely times this would be well worth considering, but right
now I'm focusing on what can be done without the extra layer of
software. I'm well-enough versed in the specifics of this back-end
that what I've been trying to sort out is what is native and
reasonable in the Flash player. It's on the client side that I'm
ignorant. As in so many other areas of my life;-) But, pertinent to
this list, I'm ignorant about many aspects of the Flash player and the
Flex framework - the framework is huge and many features are easy to
overlook.

So far it looks like (ignoring back-end):

* AMF - Native

* XML - Native

* JSON - Often used library

* Plain-text format - May be able to leverage native features such as
String.split() or a custom parser that reads lengths precisely.

* Any of the textual formats (XML, JSON, plain-text of whatever sort)
may benefit from compression, depending on payload size,
compression/decompression time, and network conditions (latency and
bandwidth).

That's what I've got so far.


Re: [flexcoders] Re: Compressing messages/data: What binary/compression formats are workable in Flex?

2009-03-06 Thread David Adams
On Sat, Mar 7, 2009 at 9:24 AM, Maciek Sakrejda msakre...@truviso.com wrote:
 I think (some) people were asking about the back-end to try to help you
 configure http compression, which is done differently with different
 servers.

Oh. Well, how nice for everyone that I went on at length about
completely unrelated details ;-)

On the server side, I've had to bolt on a compressor so all I'd really
like to know I suppose is what MIME type such files arrive with from
another server when everything is working. I've looked up the MIME
codes and am not trying to be lazy - I ended up with my files
automatically downloading, so I figured I'd ask other people what is
actually working for them.

Thanks!


Re: [flexcoders] Re: Compressing messages/data: What binary/compression formats are workable in Flex?

2009-03-06 Thread David Adams
On Sat, Mar 7, 2009 at 9:39 AM, Guy Morton g...@alchemy.com.au wrote:
 You don't change the content-type to reflect gzip compression being on on
 the server. Gzip is a content-encoding and the browser should seamlessly
 decode it. You do need to set the HTTP headers to tell the browser is
 gzipped though, eg here's a gzip-encoded response example:

Beautiful. Thanks very much for the headers.


[flexcoders] Basic question: Creating, tracking, and deleting objects.

2009-03-06 Thread David Adams
I've been experimenting with a couple of classes that extend Canvas
and realize I need to get some basic information sorted out. I've done
quite a bit of googling, looking through examples, and checking
Adobe's documentation. Somehow I've lost the plot. Briefly, my
questions are:

* How do people normally track references to dynamically created objects?
* If you add an object to an array, are you copying a reference or
something bigger in RAM?
* How do you well and truly clear an object?

References to a good, basic demo would be most welcome, too.

Those are the questions, below is the background that leads to the
questionswhich may be skipped if the questions alone make sense.

What I've got is a class I've called SearchGroup that extends Canvas.
This is just a bounding container that is meant to coordinate a number
of child containers of calls SearchRow, which also extends Canvas. So,
there is one SearchGroup with 1 or more SearchRow instances. I'm going
everything in ActionScript rather than MXML as I'm trying to get
comfortable with AS.

  When a SearchRow is created, it should go at the bottom of the
SearchGroup canvas (visually).
  When a SearchRow is deleted, any rows below it should be moved up.

That's about all I'm trying to do at the moment and there are probably
better built-in widgets to use. My main problem is sorting out how you
properly create, track, and delete objects. My main application has an
initApp() like so:

public function initApp() : void {
this.addChild(searchArea.addRow());
this.addChild(searchArea.addRow());
this.addChild(searchArea.addRow());
}

Whenever addRow() is called, a row is created, added to the display
list, and some private variables are updated within searchArea (a
SearchGroup):

public function addRow() : SearchRow {
_rowCount ++;
var row:SearchRow = new SearchRow(_rowCount);
_rowReferences.push(row);
return row;
}

[I figure that SearchRow shold be an inner class of SearchGroup - but
I don't know how to do that in AS. Otherwise, I assume I should put
addRow into SearchRow and then have SearchRow dispatch an
event...which I'm skipping for the moment for simplicity.)

So, when a row is added, the searchArea increments a count and appends
the reference into a private array named _rowReferences. A couple of
questions:

* How do people normally track dynamically created object references?
* When I copy an object into my array, _rowReferences.push(row), am I
copying a _reference_ or something more substantial in RAM?

When I come to delete a row, I'd like four things to happen:
* Decrement the row count - that's easy.
* Remove the reference from the tracking array - that's easy.
* Remove the item from the display list - that's easy, assuming I get
the right parent reference.
* Remove (delete/clear) the row object instance. How do you do that?
I've not found a remove/delete/clear option or operator that appears
to do anything. I'm fuzzy on the AS/Flex garbage collection system, I
expect.

Thanks again for any help! Eventually I'll be able to contribute
answers instead of questions to the list.


Re: [flexcoders] Re: Compressing messages/data: What binary/compression formats are workable in Flex?

2009-03-05 Thread David Adams
On Fri, Mar 6, 2009 at 12:48 AM, valdhor valdhorli...@embarqmail.com wrote:
 What kind of server do you have?

 I was fairly sure there was an implementation of AMF for every server out
 there.

Nope. I can bolt in zip/unzip and a JSON encoder/decoder - but not AMF.

Speaing of which, I think I've asked my question badly enough that no
one thought to suggest JSON. I guess my most general question is:

What techniques can I explore for reducing message sizes that work
efficiently in Flex?

As I understand it:
-- AMF is native  fast.
-- JSON is not native  I'm not sure how fast it is.
-- XML is native and relatively fast...for XML.
-- Unzipping is native and fast...but not many methods are supported.
-- Custom binary protocols are fine as long as I draw the data down
into a general object or ByteArray and then parse it myself. Of
course, that means the parser is running in ActionScript - not code
compiled into the player.

Any other ideas?

Thanks, as always, for any suggestions.


Re: [flexcoders] Re: Compressing messages/data: What binary/compression formats are workable in Flex?

2009-03-05 Thread David Adams
On Mon, Mar 2, 2009 at 2:34 AM, Amy amyblankens...@bellsouth.net wrote:

 Plain text.

Further to this suggestion, I just stumbled across a note from 2007
that claims String.split is about 10x faster than the XML parser -
making delimited ASCII a good solution for (as an example)
transferring name-value pairs:

http://onflash.org/ted/2007/11/apis-with-delimited-ascii-text-vs-xml.php

As noted, gzip compression can reduce the overall message size.

I'm looking forward to the moment when I finally test and compare
various solutions - I'll post results whenever I've got them.


Re: [flexcoders] Re: Compressing messages/data: What binary/compression formats are workable in Flex?

2009-03-05 Thread David Adams
On Fri, Mar 6, 2009 at 11:55 AM, Guy Morton g...@alchemy.com.au wrote:

 JSON isn't binary but is more compact than XML. OTOH, parsing it may not be
 as quick as XML.

I haven't tested it yet in the Flash player but the post I linked to
earlier claimed String.split (native to the player) is considerably
faster than the native XML parser - at least in some cases. That's not
hard to imagine, really. Either JSON or XML are text - both of which
should benefit - even quite dramatically - from compression.

 I wouldn't be manually zipping and unzipping data - a better idea would be
 to enable GZIP on the web server and let the browser do the work (not that
 that is trouble-free but still...).

That sounds great and I'd like to pursue this as a few other people
have made the same observation. In my tests, the gzipping wasn't
happing in the browser prior to the data being loaded into the Flash
player. I set the MIME type on the server to application/gzip or
similar (I looked up the correct-sounding type at the time.)

Can anyone point me to a working example of gzipping working
'passively' but effectively? Namely, that the Flash player gets
uncompressed data even though the server sends the data compressed.
That would be ideal.

 Here: http://www.jamesward.com/blog/2007/12/12/blazebench-why-you-want-amf-and-blazeds/
 That should help you see what combinations are fast.

Thanks - it's a great article. The author mentions gzipping but I
haven't found the specifics. I suspect he's comparing processes
without any compression.


Re: [flexcoders] Re: Compressing messages/data: What binary/compression formats are workable in Flex?

2009-03-05 Thread David Adams
On Fri, Mar 6, 2009 at 5:31 PM, Guy Morton g...@alchemy.com.au wrote:
 You've still managed to avoid telling us about your back-end setup.

 Tell us more about that and we could probably be of more assistance. No good
 me suggesting stuff that works for apache on linux to find that you're
 running openVMS...

Sorry, I'm not meaning to be difficult. The server definitely does not
support AMF and will not any sooner than...not this year. That's why
I've been exploring alternative. Plus, I've spent some insane amount
of time over the last ten years studying messages on the wire and can
get a bit obsessive (read 'stupid') about sorting out message sizes
and round-trip times. I'm hoping to build up a pretty good list of
techniques/technologies to compare and put into a test harness. I
figure I'll end up using Charles to emulate different relevant
bandwidth constraints and it's easy enough to try various payload
sizes + encoding time + decoding times.


[flexcoders] Creating a dynamic search interfaces - strategies and suggestions

2009-03-05 Thread David Adams
I'm experimenting with creating a dynamic search interface and am
wondering about the most effective strategy to use in Flex. I'm
ignorant enough about Flex that I'd guess some of my ideas won't make
sense so I'm hoping to get feedback that will save me from chasing
down too many dead ends.

For this experiment, I'm creating an interface like the Finder's
search in OS X. You start of with one search term and then can add as
many as you like - each on its own 'line'. For those of you that don't
know what this interface looks like, you get a series of (Drop-downs)
static text and [Entry Areas] along with a (-) ad (+) button to add or
remove terms.

(Kind) is (Any) (-) (+)  Where (Kind) can be Kind, 
Last
opened date, Last modified data, and so on and (Any) can be
Applications, Folders, Documents, PDF and so on. Depending on
the choice you make - the related options change. For example:

(Created date) is (within last) [  ]  (days) (-) (+) The
exact details aren't too important - the main thing is that:

* You can add any number of 'rows'.

* The type (kind) of query determines what objects appear in the row
and what they contain. (The entry and drop-down contents are driven by
the type.)

* When you add (+) or remove (-) a row, the rest of the objects on
screen move or resize automatically.

This isn't the exact interace I need, but it's a good enough starting
point. Once all of the entries are completed, I'd like to package them
up and send them off magically somewhere for processing using an HTTP
post.

Key point: I'd like some of the options to be data-driven from a
server. For example, the styles of comparison or the kind of searches
may not be something I know until runtime.

If anyone is still reading, and with all of that in mind, I'm
imagining there are a few ways to build this:

* Build one MXML component that has all of the various objects,
presumably wrapped inside of an HBox or Canvas. -- The dynamic values
(popups and so on) are assigned/modified using ActionScript. -- The
objects that should be shown/hidden are configured using AS.

* Build an AS class for SearchRow and pass into the constructor
whatever values are needed to set defaults.

* Build an AS class with a pretty nearly empty constructor and then
assign the various dynamic values from the code that creates the
object.

Since I want to package up all of the various settings, what I need to
be able to do is iterate over the 'rows' or handle them as an array of
objects. Given that, I'd be grateful for suggestions on the most
effective way to manage storing/return references to the objects.

Thanks in advance for any help or suggestions!


[flexcoders] Creating a dynamic search interface - strategies and suggestions?

2009-03-04 Thread David Adams
I'm experimenting with creating a dynamic search interface and am
wondering about the most effective strategy to use in Flex. I'm
ignorant enough about Flex that I'd guess some of my ideas won't make
sense so I'm hoping to get feedback that will save me from chasing
down too many dead ends.

For this experiment, I'm creating an interface like the Finder's
search in OS X. You start of with one search term and then can add as
many as you like - each on its own 'line'. For those of you that don't
know what this interface looks like, you get a series of (Drop-downs)
static text and [Entry Areas] along with a (-) ad (+) button to add or
remove terms.

(Kind) is (Any) (-) (+)

Where (Kind) can be Kind, Last opened date, Last modified data,
and so on and (Any) can be Applications, Folders, Documents,
PDF and so on. Depending on the choice you make - the related
options change. For example:

(Created date) is (within last) [  ]  (days) (-) (+)

The exact details aren't too important - the main thing is that:

* You can add any number of 'rows'.

* The type (kind) of query determines what objects appear in the row
and what they contain. (The entry and drop-down contents are driven by
the type.)

* When you add (+) or remove (-) a row, the rest of the objects on
screen move or resize automatically.

This isn't the exact interace I need, but it's a good enough starting
point. Once all of the entries are completed, I'd like to package them
up and send them off magically somewhere for processing using an HTTP
post.

Key point: I'd like some of the options to be data-driven from a
server. For example, the styles of comparison or the kind of searches
may not be something I know until runtime.

If anyone is still reading, and with all of that in mind, I'm
imagining there are a few ways to build this:

* Build one MXML component that has all of the various objects,
presumably wrapped inside of an HBox or Canvas.
-- The dynamic values (popups and so on) are assigned/modified using
ActionScript.
-- The objects that should be shown/hidden are configured using AS.

* Build an AS class for SearchRow and pass into the constructor
whatever values are needed to set defaults.

* Build an AS class with a pretty nearly empty constructor and then
assign the various dynamic values from the code that creates the
object.

Since I want to package up all of the various settings, what I need to
be able to do is iterate over the 'rows' or handle them as an array of
objects. Given that, I'd be grateful for suggestions on the most
effective way to manage storing/return references to the objects.

Thanks in advance for any help or suggestions!


[flexcoders] Native JSON support in Flash player?

2009-03-04 Thread David Adams
I see that JSON support in Flex is through the as3corelib ActionScript
library, at the moment. Is there a plan to add native JSON
encoder/decoder support to Flex and the Flash player? Presumably, a
C/C++ implementation (I don't actually know what the Flash player is
coded in) will be considerably faster than an AS3 implementation.

Also, to prevent wasting everyone's time, if there's an official place
to check on the roadmap for Flex/Flash, I'd be grateful to be pointed
in the right direction.

Thanks.

-- David Adams


Re: [flexcoders] Question: Strategies for compiling individual modules into SWCs

2009-03-03 Thread David Adams
On Wed, Mar 4, 2009 at 7:57 AM, claudiu ursica the_bran...@yahoo.com wrote:
 Try with ant or maven, have to manually write build scripts though...

Thanks for the confirmation. I ended up spending a couple of hours the
other night writing executable scripts that call the compc compiler in
the SDK. I haven't figured out all of the switches and settings, but
it's not too hard to get a basic system up and running. I'll have a
look at ANT and maven and see if that's a lot easier.

Thanks!


Re: [flexcoders] Re: Getting ByteArray.uncompress() to work in Flash - looking for an example tex

2009-03-02 Thread David Adams
On Mon, Mar 2, 2009 at 5:13 PM, Bjorn Schultheiss
bjorn.mailingli...@gmail.com wrote:
 ASCompress supports GZIP
 http://code.google.com/p/ascompress/

Thanks very much for the link, I've downloaded the code to experiment with.

I have now managed to sort out that my server-side encoder is adding 5
bytes in front of the zipped data that chokes Flex, so that's a help
as well. I can always pull those bytes off before transfer, if
necessary.

Thanks again.


[flexcoders] Re: Getting ByteArray.uncompress() to work in Flash - looking for an example text with compressed bytes

2009-03-01 Thread David Adams
 * Perhaps there's something messed up in my compression data - would
 someone be willing to post some kind of 'hello world' in plain text
 and compressed form that is known to work with ByteArray.uncompress()?
 From there, I can experiment and see if I can tinker with my
 compression settings (or switch compression libraries) until I get a
 match.

P.S. If possible, I'm looking for a hello world XML message example
that has been compressed on the server, sent over HTTP and then
unpacked using ByteArray.uncompress() in Flash.

Many thanks in advance for any help.


Re: [flexcoders] Re: Compressing messages/data: What binary/compression formats are workable in Flex?

2009-03-01 Thread David Adams
On Mon, Mar 2, 2009 at 2:34 AM, Amy amyblankens...@bellsouth.net wrote:

 Plain text. Long before the invention of XML, developers used csv
 or csv-like files to power their data-driven apps. You'll have to
 load the plain text into objects, but hopefully you don't have a
 constraint against that :o)

Thanks for the suggestion. Sure, I can do some kind of a plain-text format
-- Fixed-length (not likely)
-- Variable length with length bytes
-- Some kind of delimited system (csv or what have you)

Depending on the content,
-- Fixed length is a bad idea...but it's useful in other contexts.
(For example, if you have a 'natural index' that lets you calculate a
rows position - then you can grab a row out of a huge file with a
couple of reads... but that's not my problem.)

-- Variable-length with a length byte: This would add only one byte
per variable-length item, so it's about as efficient as I can get.

-- Delimited system: Not as efficient as the previous method, but
popular so easy to support in many ways.

What I'm compariing against are two things:
1) The naive 'stupid unreadable XML' format that lets me keep using
XML but reduces the message size a bit.
2) True compression/binary format.

The unreadable XML approach reduces message size by making element
names shorter and removing whitespace. For example, instead of

ResultSet
 Record
FirstNameBob/FirstName
/Record
/ResultSet

...you get something like this:

abcBob/c/b/a

This obviously throws away the advantages of XML as 'human readable
markup'...an advantage that is irrelevant in my case - I'm just trying
to send messages that are produced by one program and read by another
program - no humans involved.

What I'm really hoping for is real compression - as plain text or XML
tend to compress fairly dramatically. Either that, or some other
binary format this is not AMF and that is supported natively in Flash.

Sorry for the length of my answer...I just suck at writing short
messages when I'm sorting through a problem. And, again, thanks for
the help.


Re: [flexcoders] Re: Getting ByteArray.uncompress() to work in Flash - looking for an example text with compressed bytes

2009-03-01 Thread David Adams
On Sun, Mar 1, 2009 at 9:06 PM, Cato Paus ca...@brannsikring.no wrote:
 go here
 http://onrails.org/articles/2007/11/27/flash-utils-bytearray-compressing-4-1mb-to-20k

Thanks for the link! I couldn't get the AIR app to compile, but
realized it pointed out an obvious strategy: use Flash to
encode/decode the test string. I've got that going now so I can sort
out a byte comparison with my server-side encoder's.

I also found an old bug report that indicates that Flash only
understands 'zlib' and does not understand deflate, at the moment.
That's a bit of a help but 'zlib' covers a bit of ground, as far as I
can tell (?)

Thanks again.


[flexcoders] Getting ByteArray.uncompress() to work in Flash - looking for an example text with compressed bytes

2009-02-28 Thread David Adams
I've been having no luck getting Flex to decompress some data I've
compressed using a tool based on zlib. I've tried the same code using
AIR where I can specify the compression method and the data *does*
decompress correctly. Below is a bit of code to give the idea:

  public function onComplete(event:Event) : void{
var loader:URLLoader = URLLoader(event.target);
//var info:String = loader.data;
//trace(info);
var ba:ByteArray = new ByteArray;
ba = loader.data as ByteArray;
ba.position = 0;
// The next line of code fails with error #2058 every 
time using Flex.
// Under AIR - you can get it to work by specifying the
decompression method as DEFLATE.
ba.uncompress();
// For the AIR application, the line above is
//  ba.uncompress(CompressionAlgorithm.DEFLATE);
var bytes:String = bytes = ba.toString();
Alert.show(bytes.toString()); // AIR shows the original 
string,
Flex never gets this far.
  }

A couple of questions:

* Does it matter what MIME type is set on the Web server for the
content? If so, what MIME type is likely to work.

* What decompression method exactly does the Flash player support?
I've read deflate - which AIR seems to handle when I specify
DEFLATE.

* Perhaps there's something messed up in my compression data - would
someone be willing to post some kind of 'hello world' in plain text
and compressed form that is known to work with ByteArray.uncompress()?
From there, I can experiment and see if I can tinker with my
compression settings (or switch compression libraries) until I get a
match.

Thanks in advance for any help.


[flexcoders] Compressing messages/data: What binary/compression formats are workable in Flex?

2009-02-28 Thread David Adams
I'm working on a system that transfers data from a back-end to Flex
for display and manipulation. In this case, I can control the message
format on the server-side. I'm pretty happy sending XML because of how
easy it is to work with XML in Flex. On the other hand, XML is
sometimes ridiculously inefficient as a message format as it tends to
be pretty bloated. I'm imagining a few strategies:

* Strip and reduce the XML to use stupidly short element names and no
spare white-space to reduce the message size a bit.
This is a weak option in a lot of ways but it's easy to do.

* Compress the XML and decompress it in Flex.
This is an appealing option as I get to work with the XML but don't
have such big messages. Unfortunately, I haven't been able to get this
to work using zlib and ByteArray.uncompress(). I'll also assume that
there is some kind of sweet-spot when the cost of
compression/decompression outweighs the cost of the larger message.
Once I get this working, I could try to figure out when compression is
worth engaging and then have the server compress when it (guesses) it
will make sense.

* Use AMF.
Can't. It's not supported on the server and a project constraint is
thou shalt not implement binary protocols by hand.

* Use a custom binary format, package the data that way on the server,
and then write a custom parser in Flex.
Can't. See previous point and another project constraint, thou shalt
not invent new binary formats.

* Use another binary format that Flex does understand.
Are there any?

Basically, I'm looking for an efficient message transfer format that I
don't have to invent or hand-code.

Any suggestions and help appreciated!


[flexcoders] Question: Strategies for compiling individual modules into SWCs

2009-02-27 Thread David Adams
I'm new to Flex so apologies in advance for what is probably a basic
question. I've been working on a code generator that spits out
MXML/ActionScript files and dumps them into a directory. For
simplicities sake, imagine that I'm dumping out three MXML files and
the goal is to produce an individual SWC for each. Is there any way to
do this using FlexBuilder short of creating an individual library
project for each module? I'd prefer to have a single project for all
of my generated modules yet have each compiled individually. At a
guess:

-- Is this not really possible?
-- Is there some kind of compiler setting or project property I can exploit?
-- Is this the sort of thing where I should update my code generator
to interact with the command-line compiler instead of messing with
FlexBuilder? (I'd rather not go this route, honestly.)
-- Is this what ANT is for?

Any strategies or suggestions welcome. And, if I've stated my
question/problem poorly, I'll be happy to try and clarify.

Thanks in advance for any help,


-
 David Adams
 Wallaga Lake 2546 NSW
-


Re: [flexcoders] Re: Reading compressed file in AS 3

2009-02-27 Thread David Adams
On Fri, Feb 27, 2009 at 12:42 PM, ACasualObserver pof...@yahoo.com wrote:
 Jim,

 I am using the zlib in a C program.

Just as an experiment, have you tried putting the code into an AIR
application where you can specify a wider range of decompression
methods? I'm struggling with the same error you've described using a
zlib compressor. I've found that I _can_ decompress the ByteArray in
an AIR app with code like the following, where ba contains my zipped
data:

ba.uncompress(CompressionAlgorithm.DEFLATE)

I actually find this a bit confusing as my understanding is that Flex
handles deflate...so I'm unclear what I'm doing/not doing in Flex that
makes the compression fail. I've really got the same code - apart from
the CompressionAlgorithm argument. Anyway, it's something else for you
to try...not that I know what the results mean ;-) Perhaps someone
else can offer a suggestion as to what this particular finding means.
(I'm new to Flex.)

For background, what I'm trying to experiment with is compressing XML
on the server-side and decompressing it on the client-side to see if I
can improve performance. If anyone has thoughts or suggestions on this
topic, I'm all ears. (AMF is not supported on the server I'm using, so
AMF-over-HTTP is not an option.)



-
 David Adams
 dpad...@gmail.com
 AU: (02) 6493-3250
 US: 831 621-4585
 Wallaga Lake 2546 NSW
-