Moving SWC to libs folder breaks project - apache-flex

I have a swc(degrafa) that I have been referencing externally in another folder on my computer. When I tried to move the swc to the libs folder I was no longer able to access the swc from my application. Is there a step im missing?

Did you updated your library path as described here?
With a project selected in the Flex Navigator view, select Project > Properties > Flex Build Path.
Click on the Library Path tab, and then select and expand the SWC file entry to display the SWC options.
Double-click the Link Type option. The Library Path Items Options dialog box appears.
Select the Merged into Code option, and click OK.
This procedure is the equivalent of using the library-path compiler option.

The project libs folder was not the same as the one in the project tree. This was due to the project i am working on being apart of a larger project and the project properties was referencing the wrong folder. After changing the libs folder to the one I wanted to use the swc was recognized.

Related

adobe air push notifications

I am using push notifications extension and getting an error :
ReferenceError: Error #1065: Variable
com.freshplanet.nativeExtensions::PushNotification is not defined.
These are the simple steps I followed so far:
1) added the extension in the properties/actionscript build path/native extensions . it is with a green flag and the .ane is located in my libs folder
2) added the extensionid to my app.xml file
<extensions>
<extensionID>com.freshplanet.AirPushNotification</extensionID>
</extensions>
3) registered in the app constructor :
PushNotification.getInstance().registerForPushNotification();
4)
Do the following steps, which use Flash Builder 4.5.1:
Change the filename extension of the ANE file from .ane to .swc. This step is necessary so that Flash Builder can find the file.
Select Project > Properties on your Flash Builder project.
Select the Flex Build Path in the Properties dialog box.
In the Library Path tab, select Add SWC....
Browse to the SWC file and select Open.
Select OK in the Add SWC... dialog box.
The ANE file now appears in the Library Path tab in the Properties dialog box.
Expand the SWC file entry. Double-click Link Type to open the Library Path Item Options dialog box.
In the Library Path Item Options dialog box, change the Link Type to External.
Now you can compile your application using, for example, Project > Build Project.
This is all done on iPad
Thanks for the help :-)
You don't need a native extension for this as it is part of AIR 3.4. See http://www.adobe.com/devnet/air/articles/ios-push-notifications.html for more information and a step-by-step guide on how to get it to work
Well the problem was resolved by opening the project properties panel , in the actionscript build packaging selecting Apple ios, there under the native extensions tab select package for all the extensions needed in the project.
The confusing part here for me was that there are 2 places than need to add the native extensions, one is the actionscript build path and the second is the actionscript build packaging.
The step of renaming the package to .swc and adding it to the build is not need from what I understand.

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 convert a mxml file to a compoent that i.e .swc file

hi i hav tried to covert .mxlml to .swc file using flex builder
it's not working when i integrate with other application...can any one say how to get .swc using SDK...pls i need very clearly
In Flex Builder (Or Flash Builder) you need to create a Flex Library project. Put that mxml file in the library project, right click and select "include in library" from the context menu.
The Flex Library project should generate a SWC with that class which you can then use in other proejcts by adding that SWC to the library path.
Flextras is right, but a little more clearly (since you haven't accepted it yet):
Within Flex Builder (I'm assuming Flex Builder 3, but it's probably the same in Flash Builder), go to File -> New -> Flex Library Project. Enter a name an click Finish. This creates your project.
Create (or copy) the files you wish to compile into the src folder in your new project. The trick is that when you copy a file to the src, it is NOT automatically included in the library's build, and hence it will NOT end up compiled in the resulting SWC.
To include these files in the library build, right click on the project in the Navigator panel and select Properties. Click on "Flex Library Build Path" on the left, and under the "Classes" tab on the right, click "Select All" (or check the boxes you wish to include manually).
Once your files are included in the library project's build path, simply build the project. The build should happen automatically, but you can go to the Project menu and select "Clean" to be sure. Ensure that your project compiles correctly (no compile errors), and a SWC file should be generated in the bin folder. Note that pretty much whenever you change anything within the project's file structure, you will probably need to repeat the step of clicking "Select All" in the library build path.

Actionscript classes to 1 SWC file

I'm using Flash Builder 4 (the version after Flex Builder 3, so very similar to Flex Builder 3) and have a bunch of actionscript classes that I frequently need to reference. I have them in a separate folder/package to keep things clean.
I know that it's possible to create a SWC from these actionscript files. My question is how do I do it in Flash Builder 4 or Flex Builder 3. Do I need other tools? My objective is just to use the SWC in the project and keep things clean instead of dragging around all these files.
Create a Flex Library project and put the code in the /src folder. Click on
project properties-> Flex Library Build Path -> Classes
to make sure all your classes are included.
You can set the 'Output folder' here to point to your main project /libs folder to have it automatically build into your project or just drag the .swc manually when it's created from your 'Output folder' to the 'libs' folder of your project. Hit the [OK] button and your .swc will be created. The code is now available in your main project.
In Flex Builder 3 you can right click the projects panel and choose New -> Flex Library Project. The steps to creating a project are very similar to creating a regular project. You just link the classes you want compiled into your SWC and tell Flex Builder where to put the compiled code.
other way is:
suppose you have a class Name MyCls which you want to compile into swc file.
create a Fla, and ctrl+shift+f12, check the publish item to SWC.
go to the action panel, type :
var v:MyCls;
finally, just compile this fla. it generate a swc which contains your MyCls;

How to exclude files from being copied to bin-debug on build

Using Adobe Flex Builder Pro stand-alone, how do I filter or exclude some files in my project source folder from being copied into the bin-debug folder during a build? Flex Builder is based on the Eclipse platform IDE, this could be as much of a question about Eclipse as it is Flex Builder.
You can prevent Flex from copying all extra files like this:
Within Flex Navigator panel, right-click on the Flex project
Choose Properties
Click on "Flex Compiler" on the left
Under "Compiler Options" DESELECT "Copy non-embedded files to output folder"
Click OK
If you want to include some but not others, then you can use a custom Ant build script to do the build and copy the limited files you want to copy.
Eclipse allows you to specify include and exclude patterns on the Java build path. The following describes how to exclude files from the Java path, there may be an equivalent on the Flex Build Path properties page.
Update: This is how it is done in Java, I imagine that the Flex Build Path would implement it in a similar way if at all. As someone has kindly voted me down for saying that it might be done this way it appears that this is not supported in Flex.
Open the project Properties (right-click->Properties or Alt-Enter)
Select Java Build Path and the Source tab.
Expand a source folder and select the Excluded: child item
Select Edit...
on the dialog, you can then specify one or more glob patterns to exclude files from the path
If you want to exclude specific resources but still include non-embedded files you can add a Resource Filter.
Open the project Properties
Select Resource > Resource Filters
Add a Resource Filter by clicking Add... on the right
Set Filter type to Exclude all
Set Applies to to Files and folders and select All children (recursive)
Specifiy the File and Folder Attributes (i.e.: Name matches ".git")
Click OK and then Apply to save your new Resource Filters.
Clean the project by going to Project > Clean... and clicking OK
This process can also be used to create an "Include Only" resource filter, essentially white-listing instead of black-listing.

Resources