Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I've been tasked with writing a Flash application for facilitating a Fantasy Football draft pick. Normally, my choice would be to write this application in JavaScript. Unfortunately, it will require the use of sockets and since we don't have enough experience with Web Socket JS to be sure it would work in this situation I need to learn Flash.

Currently, I'm most proficient in JavaScript/HTML/CSS/PHP/MySQL and have never really used Flash in a meaningful way. As best as I can I want to start this project off "the right way".

So, what are good to know best practices and/or references/resources that will teach my the right way of doing things in Flash?

share|improve this question
1  
Are you considering Flex? –  Jeremy Heiler Jun 11 '12 at 15:10
    
I don't even know what Flex is. I guess I'll look that up... –  donut Jun 11 '12 at 17:02
    
2  
Over ten years I've seen a lot of flash and flex applications and they nearly all suffer from the same thing - they don't match the users expectations of what happens in a web browser. No amount of instructions can totally address that. The first test with most of them is the 'back' button... –  Michael Durrant Jun 11 '12 at 17:43
1  
The best practice is to avoid Flash apps at all costs, if you can. –  haylem Jun 12 '12 at 6:07
show 3 more comments

4 Answers

If you are stuck using Flash, I would highly recommend using Flex, which is a UI framework built on top of the flash platform. It was built by Adobe, and the framwork code has been donated to Apache.

Most of the "best practicies" you see with Flex are similar to the standard JS + HTML application. The main difference is that you are writing the entire view layer on the client-side flash platform instead of having parts of it on the server. This gives you a lot more control over how to organize and managed the user interface.

If you are new to ActionScript 3, then I suggest you check out this Coding Convetions document. This overview (while a bit dated) can give you a good idea of what ActionScript 3 (and E4X) is all about.

share|improve this answer
add comment

Just throwing this out there (too long to be a comment, otherwise that's how I would have posted this)..

If you're most familiar with Javascript, wouldn't it be much better to investigate both web sockets and other methods of real-time(ish) streaming before jumping on the Flash bandwagon? With options such as long polling and Flash XMLSocket relays, there's really no reason that you can't author your application using the technology that you're most comfortable with (and therefore hurdle any unforeseen language/tech shortcomings and best practices with a tech that you're unfamiliar with) while still fulfilling your requirements.

share|improve this answer
    
My argument and view exactly. Unfortunately, not my decision :) –  donut Jun 11 '12 at 16:58
    
@donut: When presented with a compelling argument, those who make the decisions can be swayed. :) –  Demian Brecht Jun 11 '12 at 17:01
    
I've presented almost your exact argument to no avail :( –  donut Jun 11 '12 at 20:43
    
@donut: Then I'd ask for clarification as to why Flash is required. Perhaps there's a technical (or business?) reason as to why.. If all else fails, at least you've voiced your concern and that's all you can do if the powers that be still come back with a resounding "no". –  Demian Brecht Jun 11 '12 at 21:00
    
I think it basically comes down to the tech lead not being comfortable with an unproven solution (we've used Flash years ago for a very similar application) on the tight deadline we're on. –  donut Jun 11 '12 at 21:53
show 1 more comment

Yes, it happened quite a bit in the Flash realm. Coding conventions have been established by Adobe, but since they moved from their own open source server to source forge, most links got broken. But there should be some redundant infos on that already somewhere at google.

I wrote a while back a simple MVC example which just illustrates a simple MVC implementation which you can check out at github. When using Flex, you would of course use data binding in the views. But that's just to get an idea. You might want to check out robolegs, an i.o.c. container.

When it comes to the performance, i don't really understand goreng. The current Flash players are fast and re-rendering can be optimized. But overlapping is not really an issue but deep child nesting (as in ever dom based rendering engine).

If your familiar with backbone, you should be able to get an idea on how the get started pretty fast.

share|improve this answer
add comment

I haven't done Flash in years so probably my recommendations are a bit antiquated. If you're primarily using the Flash dev env from Adobe, always try to establish a naming convention that suits you. Usually there are some assets that are not loaded on demand but are created within the Flash file itself. It could be a movie clip or a bitmap and any other asset. Stick to a proper convention then it'll be easier for you to reference them in your code.

Another thing to look at, probably not a coding practise per se, but you'd want to make sure that if you overlay elements on the timeline, don't let them overlap. A redraw in one element will force a redraw in another element. And if many elements overlap, it can become quite slow.

If you're using bitmaps, try to use them at their original size. Scaled bitmaps are a no-no.

I'm not sure about source control as the flash file itself is binary, but you can import code from external files, so those can be put into source control, with the flash file itself locked out when it needs to be edited.

And as always be generous with comments. That's all I can think of from the top of my head.

share|improve this answer
    
If you don't mind, please give me an example of a naming convention so I can get an idea of what to prepare for. Thanks! –  donut Jun 12 '12 at 15:57
1  
I used to read kirupa.com for my flash stuff many years ago. So maybe this might help you. It's not definitive by any means, but something to start with kirupa.com/developer/actionscript/tricks/naming.htm –  gorengpisang Jun 28 '12 at 8:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.