I have created an API in AS3 that uses Flex bindings. The API is being used by two other developers. I am delivering the API in an SWC that includes all code, including the required Flex libraries. The two other developers are building the API into AS3-only projects.
One developer is compiling using the Flex SDK through FDT. He includes the SWC in his project and he is able to bind any bindable property. When he uses ChangeWatcher.canWatch on a bindable property, it returns true.
The second developer is compiling using the Flash CS5 IDE. He includes the SWC in his project using the Actionscript settings window (merged into code). But none of the bindings, including ones internal to the API, are working. When he uses ChangeWatcher.canWatch on a bindable property, it returns false.
What could the Flash IDE be stripping out that causes ChangeWatcher to stop functioning? What is ChangeWatcher.canWatch actually checking? Is it the metadata, and if so, how can the metadata be preserved in the Flash IDE?
As far as I know, data binding is only supported in Flex.
It turns out the issue was that the [Bindable] metadata was being stripped out. To keep it in there I needed to trick the Flash IDE into keeping it. This can be done by enabling "Export as SWC" in the publish settings.
After doing this, all my bindings started working again.
Related
can any one help me that where is the SWC or run time library for the flex controls exist in the system?
Or can we provide our own library by using the controls in the dir
C:\Program Files\Adobe\flex_sdk_3.2\frameworks\projects\framework\src\mx
It is not very obvious what are you trying to ask but I'll try to guess :)
So the SWC with Flex controls is located here {Flex.SDK.root}/frameworks/libs/framework.swc and the corresponding RSLs are located here {Flex.SDK.root}/frameworks/rsls.
What about providing your own library to replace Flex controls I think it is not the right way. The best practice is not modify Flex SDK installation to have possibility to build your project on every computer with different environments (on a different developers computers or on client site).
And you should take in mind there are 4 standard ways to use code in Flash application:
Compile your code into SWF.
Use Runtime Shared Library aka RSL (which is SWF too).
Use SWZ which is signed and can be cached by Flash Player.
Use modules which are SWFs.
None of these ways doesn't suppose using Flex SDK in runtime. Flex SDK is being used only in process of building of your application.
So the best way to use some custom controls is to build them with your application using one of the ways I described above (excluding SWZ's which can be produced only by Adobe).
Just leave Flex SDK installation without changes and place classes/SWCs with custom controls in your project's classpath.
Hope this helps.
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.
I have a Flex Library Project which has both Flex specific classes, and Air specific classes.
When I reference the library in an Air project, the compiler complains about an overriding contextMenu in mx.containers.Panel, saying that the param should be of type NativeMenu (instead of ContextMenu). If I switch it over to NativeMenu then it compiles fine.
The issue is when I reference the library in a Flex Project. This time it complains that it doesn't know the type NativeMenu. If I try to change it back to ContextMenu, then I get the same error as above.
I've searched google to no avail (found that someone else encountered the exact same problem: http://forums.adobe.com/thread/598791?tstart=-1 )
The docs don't help too much either, except stating the above: http://livedocs.adobe.com/flex/3/langref/flash/display/InteractiveObject.html#contextMenu
I'm thinking that its just not possible to do the mixing of Flex vs Air SDKs that I want, but I was hoping that maybe someone has figured this out.
Thanks!
You can't really target the web Flash Player and the desktop Player using the same project.
I would recommend encapsulating out as much functionality as possible into a library project. Then create a single Flex project and a single AIR project, both using the same library project.
Each respective project can extend, or replace, the different functionality.
I am not sure if this is the exact same problem, but I was having an issue with being able to reference the AIR libraries in a Flex Library project and found the (rather simple) solution.
Using Flash Builder 4.5, when creating a Flex Library Project, (right-click .. New.. Flex Library Project) there is a checkbox for "Include Adobe Air Libraries" at the bottom. This must be checked or AIR libraries will not be included.
When you select the version of SDK/AIR you are using in the dropdown, the message should also indicate what the minimum version of AIR required is for your application.
Is there a way to create components compatible with Flex 3.5 by using Flash CS5? I'm stumped. Whenever I run the "Convert Symbol to Flex Component" command and then try to use the resulting .swc file in a Flex 3.5 app, I get multiple instances of the following error:
1046: Type was not found or was not a
compile-time constant: Matrix3D.
1046: Type was not found or was not a
compile-time constant: Vector3D.
Any help or suggestions?
I had the same problem. I found a work around, though. You need to create the component using Flash Builder by dragging a Flash Professional Component onto your application. (You must be in Design Mode to do this.) Then, in the properties sheet, there will be a button labeled "Create In Flash Professional..." Clicking this button will create a Flash Document with all the correct frameworks and sdks and launch Flash Professional.
The errors you are seeing are usually brought on by a version mismatch between the Flex SDK that the SWC was compiled against and the Flex SDK of your project.
When creating SWCs using the Flash Pro interface, I'm not sure if they can be used in Flex. Generally SWCs are not sharable between Flex and Flash. People either recompile the source code or generate a SWF and embed it or load it using a SWFLoader.
If you're using the Flex Component Kit for Flash make sure you're using the same kit that came with the SDK you plan to target.
I am using the flex SDK to compile actionscript 3 classes into an swf. Some components are not included with the SDK like the fl.controls components.
What options do I have for getting access to the flash components? I've seen others mention that I can export them to a swc file within Flash Pro, but I would rather not have to purchase Flash Pro to just use some components. Is there any other manual way to perform this without purchasing or using Flash Pro?
Thanks
You don't need to use Flash Pro to do that.
here's what I do:
create an Fla and dump all the components on the timeline that you need.
you can then remove them from there (or leave them), it doesn't really matter, as long as you see them in the library. You can even move them directly into the library.
Then under publish options select flash only, and in the flash tab select the export to swc option.
now when you compile, even when using Ctrl-Enter the swc gets compiled.
The next step would be different for you, because I use flash develop (which is free) I copy the swc into my project's lib folder, and in the program I right-click on it and select add to library. done.
I don't know how you select the add to library in flex, but it is possible. Flash develop uses the flex compiler and it does it, and flash does it as-well. so czech the project setting for this option.
You can get Free Flash Components here:
http://www.flashcomponents.net/components/free_flash_files.html?1=1&f=cprice&fv=0,0
They are not from Adobe but independent developers.
Here are set of 32 Flash UI Components for $99: http://www.flashloaded.com/flashcomponents/bitcomponentset/
I am pretty sure you have to purchase an Adobe Flash product to get the Adobe components. I used the components I got with CS4 for SDK development.