

Offer HN: Help with ActionScript 3 - dgant

Many or most developers I've spoken to have little or no familiarity with ActionScript.<p>I've spent two years working primarily in ActionScript 3. So if you have any questions about the language, about Flex, about Flash Player/AIR, about best practices, and so forth, I'll try to answer them.
======
aiurtourist
Free book idea, which I got close to writing a few chapters of during the
height of my ActionScript programming heyday: _Flash for Programmers._

Getting started with Flash development is difficult for CS-trained
programmers. Most tutorials seem aimed at designers or animators. I haven't
seen a good description of the end-to-end tool suite for flash or a list of
best practices (e.g., using Flash for animated assets, exporting to a SWC and
importing symbols as objects).

~~~
dgant
That's definitely true, about the small intersection between {Flash fluent
people} and {CS/software engineering fluent people}. My last company tried to
find such people several times without success.

And indeed, that also means that many or most of the AS3/Flash resources out
there are geared towards the copy-and-paste crowd.

------
nfriedly
Would you mind taking a look at [http://github.com/nfriedly/Javascript-Flash-
Cookies/blob/mas...](http://github.com/nfriedly/Javascript-Flash-
Cookies/blob/master/src/Storage.as) and letting me know if anything could be
improved. For one thing, I think I have more try/catch statements than I need,
but I'm not really sure what can throw errors.

(This is a flash cookies library. My company doesn't use it to invade people's
privacy, but I know it could be used for that. If you don't want to contribute
to something like that, I'd understand.)

Either way, thanks for the offer!

~~~
dgant
I haven't worked with Flash cookies so I have no feedback about that domain
specifically. There are plenty of legitimate uses for them, so there's no need
to add a disclaimer!

The Flex references do a pretty good job of documenting what errors are thrown
by various library methods. I recommend doing error handling at the first
point where an error can be thrown, because AS3's unchecked error system makes
it difficult to otherwise ensure that errors don't unintentionally propagate
all the way up the stack.

Often, all you will care about is success/failure of a call. That appears to
be true in your code. In that case, you might as well Don't Repeat Yourself:
just catch(error:Error), and proceed. If you want to record which particular
error occurred, you can log error.message or
flash.utils.getQualifiedClassName(error). Tangentially, that also futureproofs
you against changes to the API like additional Error types that may be thrown.

------
phoenix24
This is such an excellent offer! I would definitely need your help.

I've been working on a project of mine, where I need to the webcam to take a
photograph of the user. something like chatroulette, but i need users to take
only the photo. then send it back to my server where i'll do further
processing.

I am an ActionScript noob, so any help in libraries/sample code or approaches
that you could offer would be immensly helpful.

Thanks!

~~~
dgant
I haven't worked with webcams. I imagine the AS3 docs, and the included
examples, should cover your use case:
<http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/>

For sending the photo, you probably want to look at URLRequest:
[http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl...](http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/URLRequest.html)

A solution might look like this:

1) Set up your server to accept HTTP POST requests which include a photo, in
whatever data format you plan to transmit them

2) Obtain the image data from your webcam (I have no particular insight into
this)

3) Create a URLRequest

4) Assign the URLRequest's 'url' property as appropriate

5) Assign the URLRequest's 'data' property to to the image data

6) Set the URLRequest's 'method' property to URLRequestMethod.POST

7) Set other URLRequest properties, like ' requestHeaders', as appropriate

8) Add event handlers to the URLRequest as appropriate

9) Call the URLRequest's load()

------
dbrannan
I've been working on this one webapp for quite some time, also. I'd love some
help with drag & drop between two datagrids where any changes push a specific
ID as an array to the database.

It's one of those things where you have been stuck for 3 days and are willing
to pay someone move on.

~~~
dgant
I'd be happy to talk more about it. dsgant at gmail

------
mrschwabe
Do you know if there exists a set of template files or code for an demo iPhone
UI?

I'd like to do an 'animated prototype' of my app - and Flash is definitely the
solution - but it would be nice if someone has already done the basic
animations (moving screens, button states, etc).

~~~
dgant
I don't know about iPhone-anything, but Flex offers a lot of the UI niceties
you describe.

~~~
mrschwabe
Thanks, I'll look into it!

------
znt
I've been working on this webapp for quite sometime and I'd love to have some
help with pyAMF + Flex best practices.

~~~
dgant
I haven't dealt with pyAMF but I have worked with AMF serialization. Do you
have any particular questions about AMF?

