This content has been marked as final. Show 12 replies
First, to attempt this you should use Flash CS3 so that you are using ActionScript 3 in both Flash and Flex.
Second, don't use the Flash UI components like Button, Label, etc. which appear to be the same as their Flex counterparts, but they are not. If your Flash component loads one of those classes into the Flash Player before the Flex definition, the Flex definition won't get loaded and anything using them may not work properly as you've found out.
We realize this shortcoming and are looking into normalizing these classes.
Look into the Flex Component Kit for Flash CS3 on Adobe Labs. This will be more fully-featured in Flex 3.
I'm working with a pure ActionScript 3.0 project that does not use Flex. I'd like to take component assets created by an artist in Flash CS3 and use them in the pure ActionScript application.
In this case, is it kosher to use the regular Flash UI component set? The problem I'm having is how to import the definitions of the fl - package classes that make up the Flash UI components.
Or, would it make more sense to have the artist use the Flex components in CS3? What are the requirements for using those components in my ActionScript? I'd rather not have to get too deeply into Flex, can I just use the Flex component classes in my ActionScript without having to set up full-on Flex projects and so forth?
If you aren't using ANY Flex components, such as mx.core.Application, and just using Flex Builder as an ActionScript editor, then you have free reign to use whatever Flash components you want.
You should be able to just add import fl.controls.*; to your ActionScript 3 file and create a control and add it.
Great, that's what I was hoping to hear. :)
However, "import fl.controls.*" does not work for me. I get the compile time error "1172: Definition fl.controls could not be found." Do I need to add a library path or something like that?
(I tried adding C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\Components\User Interface as an SWC folder, but that caused an error too.)
In the Project Properties->Build Path, click the Library tab (not the source tab) and add the following directory (click Add SWC Folder):
C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\Components\User Interface
You need all of the SWCs in there.
AND remove any Flex SWCs from that path.
Thanks Peter... I tried that, but I get these mysterious errors in the Problems window:
An internal build error has occurred. Please check the Error Log.
Unable to load SWC Accordion.swc
Blimy - I forgot about that. You need Flex 3 to do a complete build using Flex Builder and Flash CS 3.
Sorry to have wasted your time on this. I ran into this myself when CS3 came out but had forgotten that until I saw the error. You can't use FB 2 for this type of thing. All-Flash projects have to be done in Flash.
Ah well... when is Flex 3 going to be available? :)
So if instead I wanted to use that Adobe Labs Flex Component Kit, I would have to use Flex then? I know zero about Flex... I'd appreciate it if you could point me towards any resources that would help me figure out what would be required, so I could decide whether or not it is worth it for us to pursue this path.
OK, i have flex 3 and the same errors result any ideas?
same thing here
i dont think there is a way to import a UI component to AS3 project.
Maybe Adobe should make a fix or maybe they should export a special package so AS3 project would be able to get some normal UI components. Right now the only way i could find a solutiond for that problem is some opensource UI projects.
I'm not using flex, but I'm getting strange issue from components.
import fl.controls.ProgressBar worked a few days ago, now it won't work.
the ProgressBar.as (and the swc) is right where the installer put it.
but it throws an 1172 Definition not found Error every time.
I've called Adobe and am waiting a response. I've trouble shot this enough that I do not think it's a bug. Even if I copy the livedocs progressBar example and paste it, it gets the 1172 plus other errors related to component definition not importing.
meanwhile, an older AS3 program from last week, using the same code, imports fl.controls packages and compiles just fine.
it is possible to import any UIComponent made in FLASH CS3 or even previous versions into Actionscript and use them. The process is more complex though.
I'll try to explain:
First make sure that when you created the UIComponent it actually exists as a class with in the flash movie, this is give it a LINKAGE NAME.
Second compile this SWF or SWC and put it in the path of your flex Proyect.
Third use de [EMBED] compiler command to include this class into your AS class, the way to do it is this:
private var UI:Class;
Once you do that you can use the class each time you want:
var tmp:MopvieClip= new UI();
if You don't want to load the hole movie, you can add elements of it, just read the documentation on the EMBED Command. One thing I've used though is to clone child element's of the movie and use them in my class later.
Some tips I've found out:
1.- The object created is a MovieClip whith one Child Element that's a Loader class.
2.- You have to implement a Listener to make sure the Embed element is loaded before use it or you'll get an error.
3.- You'll then be able to access all the elements in the movieclip created with Flash CS 3 or 2.
4.- I've noticed that there are some compiling isues when using filters in button frames, I've only used the CS2 Actionscript preview and not CS3 so I don't know if this was solved.