Hey guys, I have been programming with as3 for the past 4 months and Ive been getting rather good at it. I just recently decided to work with flashdevelop. I notice that there is alot of code that is availible in the flex sdk that isn't available in as3 with flash cs4. Like embedding of assets and such. I've been trying to find some up to date tutorials on how to embed things like xml and so far the tutorials are inaccurate or unclear about how to go about doing so. Ive been trying to find some good books that cover that and havnt been able to.
The books either cover as3 with flash or as and flex builder. Which is more towards working with the mxml. I havnt been able to find any books on how to work with as3 and flex sdk. Which show examples like embedding of xml and so on. I was just curious does anyone know of any good books that cover EVERYTHING there is to know about as3 and the flex sdk. Not so much on flex builder and mxml.
In a sense, I just want to get better with working with as3 projects with flashdevelop. And it would be great if there was books that covered that. Cause lets just face it, We developers sometimes just get sick of searching the web for bits of pieces of things. and its just great to have that one good book that references everything.
If no one know's of any good books then I guess website can do. but they cant be
http://dispatchevent.org/roger/embed-almost-anything-in-your-swf/
or
http://mattmakesgames.com/blog/2009/06/embedding-xml-in-as3.html
The first one wasn't too bad, they just wasn't clear on how to tap into the nodes, second one was just wrong about how parse the xml. atleast for me he was. I did it line by line and got errors. I just need to get better at flash develop.
Thanks guys!!
Ok, so it seems like when you refer to the "Flex SDK" you are actually mean the MXMLC (the Flex compiler), and not the SDK (although the compiler is part of the SDK).
Both Flash Builder (Flex Builder) and FlashDevelop use MXMLC to compile your SWFs. An exception is that in FlashDevelop if "No Output" is checked in your project settings, then it will tell Flash (Authoring) to compile your SWF. Flash uses its own compiler.
Using the MXMLC compiler, does not mean you must use the Flex framework. It can compile pure AS3 projects too.
Ask youself - Do you need to "embed" the XML document? Can't you just load it in at runtime?
Here is a great run through of MXMLC by Senocular. It's a little dated, but it all should still work, and will give you a greater understanding of what is actually going on. It is a little long, so you could print it out, staple it together, so it feels like a book :) Here is another quicker guide to MXMLC from Erik Johnson.
I think you just have to find a good workflow that works for you. Usually I create all my assets in Flash, then publish them out to a SWC. Then I have a Pure AS3 FlashDevelop project that imports the SWC (right click the SWC in FlashDevelop and click "Add to Library"). I then just use AS3 to chuck the graphics around and do all the magic. Read this post for more info.
You can embed almost anything you want in your swf
FlashDevelop's own wiki has also some good workflow tutorials for all three compiling options (i.e. Compile using Flash, Compile using Flex SDK and create assets using Flash, and Compile using Flex SDK only).
http://www.flashdevelop.org/wikidocs/index.php?title=AS3
Related
I just started making games and I decided for my next project to use either flashdevelop or flex builder. Reason being is because you can embed just about everything and for licensing purposes and it recommended the the game is compiled into one file. flex sdk is good with that type of stuff.
As of right now I decided to use flashdevelop. but recently it's been kicking my behind. First I wasnt able to use ui class (e.i. buttons, and textboxes) probably because of something stupid I did. Now for some reason I can not compile my applications. When I compile, nothing happens, no errors, no nothing. below is a screenshot of what happens when I compile.
Yes i installed debugger and yes I installed sdk
So now I was thinking about just going with flex builder. Not sure which one is more easier to assemble and use. But I do know the flex builder community is bigger, and they have a much better documentation. I am good with actionscript, but I am not so good with using flex.
My ultimate question is...
Which one is easier to assemble
which one is easier to use
which one is BETTER overall
as far as not compiling goes, looks like it compiled just fine.
I don't know what you're expecting to see from the code other than the "Hello"
to see that open up your output window (under View)
Whether you use flex or flashdevelop, you end up using the same compiler.
Like Adam, I find flashdevelop easier to use than flex, but that's because I've used it more (flex trial expired and FD didn't)
And plus I'm fast with FD, like really fast :)
Try some of the shortcuts:
to create getter and setter or
generate function press 'ctrl shift ~' and PRESTO
or for a for loop or for each loop type in the first few
letters and press 'ctrl B'
to find instances of any string in code you
can do F3 and shift F3, whereas F4
will find the object or function
declaration(even in separate files)
FD also adds a lot of the classes as
needed (sometimes I have to do it manually)
and the latest version lets
you generate classes which extend
another class easier.
I'm sure that flax does most of this as-well, but when you're already used to this then switching slows you down.
I had the same issues when I started working with FD. What it boils down to is that flex has a bunch of libraries that it's using that FD doesn't unless you link to them, and sometimes even then.
But once you start compiling your libraries and assets into SWCs you will be able to compile them through Flash and Flex. Which can be handy (like when you're working with other developers)
FD doesn't have a profiler, but this has not prompted me to stop using it. When I need some debugging and trace isn't enough I add the demonsters debugger class: http://www.monsterdebugger.com/ it's pretty powerful, but you still can't step through your code.
** Update - Flash Develop has had a profiler for a few versions now, It's good for watching memory use, but I still end up using monster debugger a lot. You can use debug in Flash Develop as-well and step through your code.**
FD doesn't have the UI that flex does, and for developing mxml it is a bit more tedious, but at pure as3, I find FD is all I need. Well than and Flash to create my SWCs
I think a lot of it is personal preference, and what you have previously used. Some people do have strong opinions though.
Personally I like FlashDevelop, but only because I am use to it, and can get things done a lot faster e.g. setting up projects, workflow, shortcuts etc. But I am sure If I forced myself to only use FlashBuilder (formally FlexBuilder) that I would soon come to grips with its nuances.
Here are a few of my points for either side:
FlashDevelop:
I like how FlashDevelop is so simple,
where as Flash Builder is rather
bulky.
FlashDevelop is totally free, where Flash Builder actually cost quite a bit.
Flash Builder:
Built on Eclipse, so has a massive community, tons of plug-ins etc.
Source control intergrated into the IDE (very important in large projects).
Also might want to check out this article on ActionScript Editors.
I know it's an old topic, but in case someone finds it, here is an interesting thing I've noticed:
I am using pixel fonts in my project, and by default Flash Player blurs part of it (it is a known problem). One solution is to use a bitmap text (some kind of custom class) and the other is to use Text Renderer with some of its related elements to force Flash to render the font correctly. When compiling under the same version of Flex SDK in Flash Builder 4+ the font rendered correctly. But when I compiled with Flash Develop (latest version) the text was really ugly, with missing pixels at random places. It might be caused by the fact that Flash Develop or Flash Builder are sending some hidden arguments to the compiler which either make it work/break.
This is a long running question that has been repeated a few times. Review this question and see if it answers yours.
Web-based Game Development: Flex Builder or Flash CS3?
How can you know that an swf was written using flash or flex?
and is there a way to compile back to flex?
I know sothink's for flash, but any thing for flex?
A Flex app is fundamentally a Flash SWF - the only difference is that the flex compiler generates a lot of intermediate code (that you can see if you use -keep compiler option) and converts that code (instead of your mxml code) to SWF.
So I guess when you decompile a flex application with whatever tool you use to decompile a flash SWF, you will get only this generated code (and not your mxml) - which may or may not be helpful - it depends on your requirement.
Just googled to find that Sothink SWF Decompiler V5.2 supports SWF to Flex
Sothink SWF Decompiler and Eltima FlashDecompiler both reportedly support Flex decompilation. I have used Sothink's solution a few times to help in security audits and hand optimizing the byte code and when decompiled the result was about what you can expect out of any flash decompiler.
Exporting to flex provides a flex project that can not usually be recompiled without hand editing your files. However much of the original project does stay relatively close to the source (stripped variable names, multi stage variable assignment, etc.) and is nothing you can't fix if you're familiar with the source code. Which I assume you are, unless of course you're sneaking peeks at others livelihoods.
With that being said, for those of you who are unaware of flash security issues or have an interest in protecting your assets, Prajakta Jagdale at HP recently did a talk on flash decompilation at ShmooCon this year that is rather engaging. The video is available online if you're interested, but I'll leave finding that one as an exercise for the reader.
I am completely new to Flex.
Can I realistically develop, say, a medium complex application with the Flex SDK alone, or do I need Flex Builder?
Also, apart from the SDK, what will I need to get started?
Thanks for any help.
I was there a year or two ago, so here's my experience. In order by subquestion:
I am completely new to Flex.
I was new to Flex too - and Actionscript (although it's a superset of javascript, which I know pretty well; although it sure doesn't feel like javascript to me).
Can I realistically develop, say a medium complex application with the Flex SDK alone, or do I need Flex Builder?
Maybe, if you already know Flash and Actionscript pretty well. I didn't, so I found it sure helped. But it isn't any different from any other IDE-or-not decision.
Also, apart from the SDK, what will I need to get started?
Nothing, unless you want to use AIR, which is only a simple download. Everything else is in there. I was completely happy with my experience; no unpleasant surprises, and you're asking the same questions I did. YMMV.
You don't need it, but it can be helpful.
I've found FlashDevelop to be a much better IDE for coding ActionScript. It ties in with the (free) Flex SDK, so as long as you don't mind coding the MXML by hand then it should work great. I've created a number of smaller Flex apps using this, and it's worked great. I generally shy away from graphical GUI designers anyway, so it worked quite well for me.
FlexBuilder gets you two things that (afaik) you can't get elsewhere. A visual designer for the MXML, and a debugger. If you get the more expensive version of Flex Builder you also get a profiler.
The visual designer is good if you want to quickly prototype something, or if you're used to designing UI stuff that way (and I can see where it would be helpful once you start getting into more complex UI stuff).
The Flex SDK comes with a command line debug tool, but the GUI you get with FlexBuilder makes using it a lot easier. This is what made getting FlexBuilder worth it for me. I generally don't use FlexBuilder for everyday development, but when I need to debug it makes things much easier.
If you're the one who would have to pay for FlexBuilder, try it without FlexBuilder. If you start running into a situation where you feel having the graphical designer or debugger GUI would be helpful, grab the FlexBuilder trial. You'll have 30 days to try it out. If it helps you enough that you think it's worth the cost, then buy it. If you're getting along fine without it then you don't have to worry about getting it.
If your employer would be purchasing it and has the budget for it then it might be worth getting it sooner, but you could probably do the same thing I mentioned above so as to possibly save your company some money.
You don't need FlexBuilder to develop Flex applications, I use:
Flex SDK
Editor of your choice ( I use emacs on Linux, Notepad++ handles ActionScript well in Windows)
Ant (Flex SDK comes with Ant tasks)
I wrote a entire blog post on how to set up a Flex development environment:
http://blog.apterainc.com/software/setting-up-a-flex-development-enviroment-in-gnulinux/
While I blogged about setting this environment up in Linux, most of the steps can be directly transferred to a windows environment.
As to the other posters: Developing GUI components in Flex is no different or harder then using HTML to design a webpage. If you require a WYSIWYG editor for that, then you do not know Flex or HTML well enough.
FlexBuilder has been well worth the investment for me personally; it's probably paid for itself tenfold or more. No, far more. Easily.
A few key fetures I've most enjoyed:
Intellisense/code-hinting: Especially if you're new to Flex, this'll speed your learning process along surprisingly well;
The Profiler: The live memory/app profiler really helps keep an eye on what's happening inside the box;
The Debugger: It's tough to beat being able to set breakpoints, trace the stack, watch variables, etc. -- great stuff here;
Eclipse: Eclipse is just an excellent IDE, and Adobe has extended it beautifully for Flex and AIR.
Incidentally, I don't do any drag-and-drop stuff, myself; I code everything manually, and I still can't recommend FlexBuilder enough. If you can part with the cash, chances are you'll be happy with the product.
Flex Builder is really useful if your application involves lot of GUI. It provides you a nice IDE do draw GUI. If you are just building actionscript that transforms to swf, you don't need Flex Builder. Flex SDK with your favourite editor is enough.
You may have to learn Actionscript and MXML DTD.
It's not required but it certainly makes things easier.
However, having said that, when you're using the FlexBuilder, you'll probably still end up doing minor tweaks to the UI in the mxml code and not in the IDE.
G-Man
I have a Flex application that seems larger than it should be. There is a lot of code in it, but not a lot of assets and it just seems large, but I'm not sure how to go about figuring out where the space is going.
I know about the –link-report option, but it only gives the sizes of externally linked library classes. I'm very interested in seeing a report of the sizes of all the classes and resources in my application and it would be a huge bonus if I could also view their dependencies. Not knowing how the code is compiled I'm not sure if this is even possible, but it seems like it should since the compiler can give me the sizes of individual classes linked from other libraries.
I did some searching around, but couldn't find anything helpful. Everything points to the optimization techniques of modularizing and externally linking libraries, which I understand and will implement, but I would really love some more detailed reports of what my compiled application looks like.
To be clear, I'm not really interested in tips on how to reduce the file size, just a report on what is used for and which classes are referencing what.
Anybody have any ideas?
CORRECTION - The link report does show all classes. My particular project in Flex Builder had several CSS files set to compile to swfs. My link report for the main app was being overwritten by these css compiles!
The link report actually contains all compiled classes and not just the ones in external libraries (at least with the Flex 4 SDK). There is an xsl available that will generate an html file of the link report so it is easier to read.
Check this post: http://blog.iconara.net/2007/02/25/visualizing-mxmlcs-link-report/
There is a command-line utility called flash.swf.tools.SwfxPrinter in swfkit.jar, which comes with Flex Builder (or the plug-in or the SDK) and which you can use to analyze information about class sizes. Joe Berkovitz wrote some good instructions on how to make use of it in his blog, and he was working on an AIR-based GUI tool that leverages it, but I'm not sure if he ever published the tool. Still, you can use his instructions to leverage the utility directly from the JAR.
I found a handy little AIR app that really helps organize the link report info.
http://www.kahunaburger.com/2008/03/08/air-link-report-visualizer/
It's old but still works very well.
What are the key differences between Flash and Flex? I have over five years experience with flash and feel very comfortable developing with it and ActionScript3. I find myself more and more curious about Flex and want to know when it is best to use flash or flex. Also, is everything that can be done with MXML, able to be done with AS3? I have a strong understanding of AS3 and OOP and would like to know the diffrences between using AS3 and MXML in Flex.
Flex is great if you quickly want to build a UI, you can mock up a functioning UI in a couple hours. Since it still can be limiting for some custom UI's it's not perfect for everything but if something should "look" more or less like an application and fit in a grid it's super quick to mock up the UI in MXML. Also don't be intimidated of how most Flex apps look (ugly, imo), you can customize everything or easily create your own components.
Putting actionscript in mxml is the same as putting css or javascript in html = really bad. Unfortunately even Adobe has this in multiple examples (probably mostly because it's easier & faster for demostrations).. My personal opinion is that this applies to bindings too, as i don't want to put my data in the UI (mxml).
As an experienced developer I'm sure you don't do any development on the timeline (to clarify the Flash = timeline misconception). Still with Flex you have the UI separated in a framework that handles a lot of the burden with layout so that you can concentrate on the business logic. The rest of the workflow is close to what you probably already have with Flash.
It depends on what kind of applications you are developing now with Flash. I have been a Flash developer (mainly applications) for 7 years. I must honestly say that I was extremely glad when Flex 2 was released because it had the component framework (good components, layout managers, ...) I did not have in Flash. This is IMO the biggest difference between Flash and Flex (or the Flex framework).
MXML is a real blessing, especially when using data binding. In the end, everything is compiled down to ActionScript (check the -keep compiler option), but MXML just saves you so much time.
Flash and Flex provide different ways to produce different things. I am not familiar with Flash, but I would expect that it is dependent on a time-oriented way to produce something, whereas Flex is geared toward more traditional software development. That is, rather than dealing with time and frames in Flash, one is dealing with describing where components should be placed with MXML and how those components work with ActionScript.
One should also be able to write a Flex app with just AS3 and no need MXML.
The main difference between AS3 and MXML in Flex, as far as I know, is that MXML is not intended to be used with application logic, but rather it is intended to be used like HTML/CSS in web pages and puts components and content onto the Flex app. ActionScript is used to program behaviors, components, and other things outside or what MXML does. Thus, if you want to attach an event to a component one would write ActionScript code.
Hope that helps. I am still learning about Flex myself.
Some other differences that come to mind:
Flash allows you to create graphical assets and then work with them immediately. To use those same things in Flex, you need to use Flash to export them to a swf or swc first.
Flex has a layout manager, so applications that have variable window size are waaaay easier to make. For instance, you can take a window and set it to 90% width of the window, and it will change size... not scale mind you, but actually change its width as the window is made larger or smaller. This is not easy outside of the Flex framework.
Data Binding in Flex is a huge timesaver. It essentially creates all of the code you'd need to write in AS3 by simply saying blah="{foo}" The curley braces denote "bind to this".
The Flex Debugger is vastly superior to the Flash one. There is also a Profiler.
Since I started with Flex and not Flash, I'm not sure what kind of IDE is best for Flash dev, but the Eclipse based Flex Builder is quite nice. The code hinting is great. Subclipse integration is great.
Really, Flash and Flex are different beasts. You should know and understand AS3 if you want to use Flex, and since you do, you're in a perfect position to take advantage of Flex's features. Flash is not going anywhere as a tool for making more visually creative pieces, but Flex offers a lot of advantages for application development.
I prefer Flash IDE vs Flex (aka Flex Builder aka Flash Builder for my comment)
In general i would say it depends on the size of the project.
I find it easier to start and finish small projects quickly in Flash.
I would advise Flex for larger projects because it has various debug tools that can save you plenty of time (although i would still just use Flash my self)
But maybe if you really get used to flex, that might not matter.
some Cons of Flex from my experience.
When working on a team of 4 on a
large project, Flex failed to keep
the project
settings from one computer to another. (we shared files using SVN)
Flex constantly conflicted with SVN for us.
I felt distant from the art assets.
some Pros of Flex
being able to follow variable references from one class to another at the click of a button.
being able to easily see many variables while debugging. w/o needing to trace them.
and Flash used to not have Custom Class Code hinting, but now with CS5 it does.
I think you can use the newest features of Flash Player w/o waiting for a new Flash CS#, for example MoleHill (a new 3d api that uses the GPU) has a beta release out right now. and i think the Flex SDK can already use it.
hope this helps.
it should be noted that I am a rare case that doesn't prefer flex, most people strongly prefer flex, so you should give it a try at least.
MXML compiles to action script so it's really like a higher level version of that. So, yes, everything that can be done with MXML can be done with actionscript (but not the other way around).
Flash CSx:
GUI\Layout: Basic GUI class framework
Graphical Content: Great for editing graphical library objects with or without animation
Code: Lacks a good code editor
Flex/Flash Builder + Flex Framework:
GUI\Layout: Advanced GUI class framework and layout engine (Flex)
Graphical Content: Lacks drawing capabilities of Flash, but you can include Flash generated graphics by exporting them for ActionScript into a SWC and importing/referencing the SWC in Flash Builder.
Code: Much better code editor than Flash; not sure if it's on par with FlashDevelop
Other: Supports MXML, which is basically just another style of laying out content. Instead of writing a bunch of "c = new C()", "c.prop = x", "c.addChild"... you can structure display objects and thier children using XML constructs, and the MXML compiler will convert it all back into the less-readable, but basically the same AS3 code.
These technologies are all related and interoperable. They are natural and predictable extensions of the Flash player and ActionScript techonolgies, but for some reason Adobe developed the Flex/Flex-builder/MXML technologies as a totally separate product, and market it as something totally new and oh-so-amazing. Whatever. So now we have to go back and forth between the two to use all the features, which is LAME. They also have to waste time and resources developing unnecessary, but helpful, packages like the "Flex Component Kit" to reduce the number of steps necessary to get Flash content into Flash Builder.
You have to go back and forth between these applications, because of their mutually exclusive features -- Flash Builder lacks graphics editing, and Flash CSx lacks MXML and a good code editor -- but they're interoperable in the sense that you can use Flex classes in Flash, Flash classes (and their embedded graphics) in Flex, you can use Flash Builder and MXML without Flex, etc.
I think they need a single, truly integrated Flash IDE, so they need to merge Flash Builder into the Flash CSx editor.