Is there any way to create xml file in flex? - apache-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

Related

Unable to add SWC file to Flex Library Build Path in Flash Builder

I'm looking at Flash Builder for my next project. I'm following some tutorials, yet I keep getting stuck at the same part. The tutorials I am following tell me to add a SWC files (containing my art) and should be in a library project.
I can create the library project and use it as a reference in my application. However, when I try to add the SWC file to the "Flex Library Build Path" the OK button does nothing. The same happens if I try to add a SWC or SWC Folder.
I' m using Flash Builder 4.6 (trial version) if that makes any difference. Below is a screenshot of the window that I am talking about in case I'm not very clear.
It has also happened to me.
There is workaround - just place SWC into /libs directory of your project and perform clean. SWCs there will be loaded automatically.
Make sure you have added the folder to the Workspace's linked resources. In Flash Builder, go to menu Windows > Preferences > General > Workspace > Linked Resources, and add a new path variable to the component directory. After this, the component can be added to the project's Flex Library path.
I think this is a bug of flash builder. It has also happened to me. And I can not choose the output path in fb....
I found a way, first, delete this project, delete evrey thing fb created itself except the source code, then u can swith ur fb to a new workspace, add creat a new project, u will see that u can add the swc file now.finally,switch back to the workspace u worked with before......

How to change the directory name used by Flash Builder 4.5 for actionscript project?

I have a nicely working actionscript project in Flash Builder 4.5. However, I'd like to change the directory name that it sits in. Seems Flash Builder breaks if I manually change this directory name using the operating system. Is there a way to change this in Flash Builder so it doesn't get mad at me, or other workaround?
With careful text editing I discovered it is possible to change the project path in the .location file underneath this directory:
Adobe Flash Builder 4.7\.metadata\.plugins\org.eclipse.core.resources\.projects\
It is a binary file, but the path was plain text. Saved me a bunch of time!
I've just found another way to move a project. I'm using Flash Builder 4.5.
1) Select the project to move
2) In the context menu, choose the 7th option "move..."
3) Choose new location
4) You will be prompt for a progress of the copy of the project!
5) Relaunch the workspace, now all is ok, you can work on your project...
You could always just export it as an FXP, then reimport it. In the import wizard is an option to choose the folder to unzip the project into.
Right-click on the project and select "Rename..."

Ability to create new File Templates in Flash Builder 4

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.

How to make a Flex Builder project to work on an existing Flex non-project with ant build?

I want to do some development on a Flex project that uses Ant: http://svn.openstreetmap.org/applications/editors/potlatch2/ . I can build it from the command line but now want to use Flex Builder 3.0.2 to build, debug, etc.
I can see a few different paths to follow, but nothing that screams out "this is the right way":
create new project, SVN checkout in there (but then the directory structures won't match, and not sure how to tell FB to build using the existing build.xml)
create new project, create external source links to another directory with the files in it
Surely people do this all the time? (Never done Flash development before...)
Ok, here's what ended up working for me. It turns out I didn't need to use ant to build the project after all. This is for the specific project (Potlatch2) but lots of the principles are probably common.
File | New Flex Project (no server), save it somewhere, eg "c:\pot"
SVN checkout the potlatch2 files inside, so you have c:\pot\potlatch2\potlatch2.mxml etc...
Rename version.as.template to version.as and make up some stuff inside
Remove the "..." line from potlatch2-config.xml. Don't ask me why.
Set Flex SDK version - configure it to point to SDK 3.5
Project | Properties | Flex Build Path:
set source folder to potlatch2
set output folder to potlatch2\resources
set library path to potlatch2\lib
Update Flash global security settings to allow access to c:\pot\potlatch2\resources (otherwise you get 1. SWF security errors)[1]
Update browser settings (Window | Preferences...) to use a browser that has Flash Debug Player installed (ie, not Chrome).
Under debug settings (click the bug drop down, Other...): Turn off "Use defaults", make debug (and possibly run and profile) point to an HTML host file that passes the right settings to potlatch2.swf, passing lat/long coordinates of a place you want to edit.

Using Flex Builder with source control

When setting up a source control repository for a Flex Builder workspace, what do you consider to be worth checking in? Do you exclude the workspace .metadata folder but keep the .project and other project specific files? Keep both? Throw away both? Is there a guideline you use to decide which is worth holding onto or do you do it out of practical experience?
We check in the source files but not the binaries or settings files (e.g., .actionScriptProperties, .flexLibProperties, nothing in bin-debug, nothing in target directory). We build and deploy with Maven.
I check in the source directoy and the binary directory; nothing else. I set up my Flex Builder project to use a linked directory as my primary source; which keeps the code and repository independent of any project specific settings.
I have known people who check in all the project files. This makes it relatively easy to check out and then set up a new project; as you can import the project folder very easily into Flex Builder.
I can't say one is better than the other, though. It depends what you want to do.

Resources