Ability to create new File Templates in Flash Builder 4 - apache-flex

I have a class interface that I have written in a Flex project using ActionScript 3 . I write FlexUnit test cases around each implementation of that interface. To help the process of creating new ones, I thought it would nice to create a FlexUnit file template around my interface.
Is there a way to create new FlexUnit file templates? It seems as though you can only modify the default templates.
If anyone has an idea on how to do that or a reference link, please let me know. Thanks!

I recommend you to try SourceMate 2.0 which supports custom file templates or wait for Flash Builder 4.5 which supports them too.

The answer is still 'no' in Flash Builder 4.6. The Adobe documentation mentions Customize for File Templates but no information on adding or removing user defines File Templates.
Even after exporting existing File Templates, altering the XML and importing them in Flash Builder I was never able to get the application to show a new File Template. It would only alter existing templates with the same 'ID' attribute. In addition there is no UI in Flash Builder's File Template view to remove a user created template.
Customize file templates
I bug is filed the Adobe JIRA website: FB-33340.

Related

Is there any way to create xml file in flex?

I am using adobe flash builder 4.6
it does not support "File" keywords.
It depends on your project type. To get access to the File class, you need to be working in an AIR project:
As drkstr1 pointed out, A Flex project for Web can't save files in this way for very good security reasons.
Right click on the folder, select new -> Other, then select the XML file type.
If you don't have this option, go to Help -> Install New Software

Customize Adobe File

I have a problem with my Flex Builder Plug-in.
I'm using the Flex Builder 3 Plug-in in my Flex application (in Eclipse).
Now I want to customize the MessageResponder.as File in the Plug-In. I found the ActionScript File without any problems, but the point is, that my changes doesn't cause anything because the file is allready compiled. (That's my guess)
Now my question:
How can I compile the file after editing it? Is there a possibility at all?
Thanks for your help!!
What you want to do is called "Monkey Patching." What you need to do is create your own version of the file in the same package location, and yours will be used in preference to the one from the swc.
The MessageResponder.as class is a file in the Flex Framework. You can modify it if you want, and--in essence--create your own version of the Flex SDK. However, you will most likely have to re-buld the entire framework for this to work. You're best bet for doing this is to get the source for the most current Apache Flex SDK; modify your class and then build the framework from scratch. After that you can use the Flash Builder "multi-SDK feature" to use your modified SDK in a Flex Project.
I'm not sure if Flex Builder 3.x supports multiple SDKs.
This may be a time consuming process. The alternative is to extend the MessageResponder and add your changes. Then you'll have to make sure that your new MessageResponder class is used instead of the old MessageResponder class. This could difficult due to many private methods used in the Flex Framework.

Upgrading Flash AS3 project to CS5 and using Flash Builder 4 as IDE

I have been working for quite some time with the Flex Builder (3) as the development IDE,
and used Flash CS3 to compile my flp file (all the actionscript I wrote in the Flex Builder).
I don't use any of the Flex components. Pure AS3 and FLA for symbols.
I want to upgrade to CS5, and I read that there is a new Flash builder IDE so I thought I'll give it a try. But In the Flash builder I see that they have tighten the Flex SDK relation (which is kinda stupid since they change the name from Flex to Flash?) so I am a bit stuck with how to migrate my project.
Furthermore, is there a way to download the Flash 10 compiler/SDK or whatever to make it compile from the Flash builder, and not use Flash CS5 for it?
Thanks a lot.
Chen
You can create pure AS3 projects with the FlashBuilder IDE without worrying about the Flex framework. Simply create a new Actionscript project. You can then compile your project in FlashBuilder and strictly use CS5 for your graphic assets.
In order to migrate your project , you only need to add your classes folder to your project source library.
With Flash CS5 , export a SWC and add it to the project's library path. All this is accessible via your project Properties.
From that point on, you should be able to access both your project classes and your symbols by declaring your variables with the relevant classes.
Edit
Start simply, first create a new Actionscript project in FlashBuilder.
http://help.adobe.com/en_US/flashbuilder/using/WS6f97d7caa66ef6eb1e63e3d11b6c4d0d21-7ff7.html
After you successfully created a project and tested it, you can then add the code from Login.swf.
If you've been using a Document Class, you could create an instance of that class and add it to the stage, you could also simply copy the code in your Main class.
If Login.swf doesn't use any graphical assets, you should be good to go, without the need to load any SWCs.
You could also refactor your code so that each concern is encapsulated within its own class. For instance, if Login.swf serves as user login and loads a bunch of SWFs, it may be a good idea to create a Login class and an AssetsLoader class.

Custom project in Adobe Flex Builder 3?

Is it possible to create a custom project type using Adobe Flex Builder 3? I'd like to create my own custom project template that creates certain directories, sets Source Path and Library Path values, etc. so that I don't have to do it manually.
I'm using the standalone version of Flex Builder, which is running on Eclipse 3.3.
Thanks!
Flex Builder 3 can't do anything like that :/. I've created a set of custom generators in ruby, that work just the way Ruby on Rails generators work: Define a bunch of template files and directories, run a single command with project name and I get a new Flex project completely customized and ready to go.
What Flex Builder 4 REALLY Should Include...
I just have a project 'template' that I create a copy of and import when I need it.
But I guess you could theoretically write a plugin but that's total overkill.

Post Build Actions in Flex Builder

How do I add post-build actions in Flex Builder? For example, I'd like my build to work as normal, and execute from the bin folder; but I'd also like a copy of the final SWF to be copied to another folder automatically (I'm sick of doing it myself).
Thanks!
I know this post has been answered, but I found something simpler. I'm sure the Ant solutions are the way to go, but I didn't feel like messing with ant for my small project. All I really want is to have my html files and swf files in different directories. I guess that's a lot to ask.
I'm building on windows, so I created a simple batch file that performs my post-build steps (namely some move commands). I then created a new builder in flex using windows cmd.exe. I just told it to call the batch file using the /C option. It works perfectly and was very simple to set up. I tried adding screen shots, but I guess I'm too new to the site.
You can extend or replace the builder used by Flex Builder 3 with extenal programs - ant is a good choice.
If you run "Flex Builder 3 standalone" (which is a minimalist Eclipse version + the Flex builder plugin) as opposed to the Flex builder plugin in a standard Eclipse, you first need to install ant support. I didn't find ant separately packaged, so I just selected the Java build environment from Help / Software Updates.
Now you can go to your project properties (Right-Click on your Project, Properties) and chose Builders. You'll notice there is a Flex Builder per default, which you cannot remove nor change. However, you can deselect it and you can add other builders.
So in your case: "add" a new builder, ant builder, select a build.xml (can be named differently), preferably from within your project folder, and set the correct targets. This will continue to use the internal IDE builder while running your ant task just before or afterwards. The ordering on the screen will be the build order, which you can change using the arrow buttons.
I used this to copy required libraries into my /lib folder, compile the Flex sources using the IDE build (which has Eclipse-integration with error messages, which a pure ant-based commandline build would miss), and copy the result to a common deploy directory, renaming the wrapper html file in this process.
For details of how to write an ant file, please refer to the ant documentation.
I would also recommend using ant.
I posted a big article on how to get it set up for flexbuilder here http://dispatchevent.org/mims/ant-for-flex-part-1/ I think there is even an example in my build script of copying files from one place to another after compiling.
Good luck!
You'll have to create a custom build script. For whatever reason, the included, default 'builder' is not editable through the interface, so you'll have to replicate a lot of its functionality. Luckily, (or maybe not) Flex Builder uses Apache Ant for its build scripts, so this may or may not be a familiar way to do this for you.
To create a custom build script:
In the Flex Navigator view, select a project and then right-click (Control-click on Macintosh) to display the context menu and select Properties.
Select the Builders properties page. If you're using other Eclipse plug-ins, there may be more than one builder listed. Flex Builder provides a builder named Flex, which you cannot modify.
Select New.
In the Choose Configuration Type dialog box, select the appropriate configuration type. Flex Builder supports the program type. Select it and click OK to continue. From the new builder properties page you define the builder properties and reference the Ant script (an XML file).
Click OK to apply it to the project.
Flex builder is based on Eclipse 3.1, so documentation for Ant integration for that release is relevant here.
Note: Ant support must be enabled in Flex Builder first. I usually use Flex Builder as a plugin, rather than the standalone version, and the standalone version doesn't come with it out of the box. Here's a tutorial on how to do this.
Steve,
If you want use Ant in Flex Builder, you may see:http://www.peterelst.com/blog/2006/09/03/flex-builder-2-ant-support/
but I am not sure this is work in flex builder 3 or not.
Steve,
Here is a bit more detail on the post build script. It will be a simple bat file. For instance add the below line to a simple text file postbuild.bat (name doesn't matter).
copy bin/*.* 'someother location'
This would copy everything in the bin folder to another folder, just change the 'someother location'.
The least elegant solution but it will work on linux.
Create cron task to be executed every minute.
Use cp command with "-u" option.
From "man cp".
-u, --update
copy only when the SOURCE file is newer than the destination
file or when the destination file is missing
In crontab -e add
* * * * * cp -u /path/to/bin-debug/*.swf /path/to/destination/
For more elegant solution - Ant the way to go.

Resources