This content has been marked as final. Show 10 replies
>>I have a Flash CS3 (.fla) file that contains many symbols linked to .as files (classes). There are over a hundred of them, and their code is organized neatly into packages. My question is about the organization of the flash content in my Flex project (those converted to a flex symbols). Should I be breaking out the symbols into their own .fla files, so I'm only maintaining one symbol per swc ?
No, not necessarily. Think of the published swc as a library with assets and by using mxml like
<local:BlueOval /> you are selecting the asset BlueOval from the published swc to be used in your Flex application.
>>Also, when you compile the .fla file after converting the symbol to a Flex component, do all the symbols you have converted in that .fla get exported again or is it a one at a time type deal (which I suspect is the case).
No, the whole fla gets published. So. let's assume you place a large jpg on the stage of your fla and then publish. The jpg won't show when you use the swc in a Flex project but the size of your swc has increased.
So, if your fla contains hundreds of assets and you don't use them all in your Flex project, you'd be better of maintaining the assets you are going to use, in a seperate fla.
>>So far I have found the way to add a folder to the lib folder and link the files, instead of importing them, but I'm not sure if his is correct or not. If I import them, now I have a copy of the files, but because they don't reside in the correct package, they become disconnected from the symbol in Flash. AHHHHHHHH!
Yes, you link to the folder, not import it. I have a seperate folder where I keep the fla assets and the packages. Something like:
----bin (here I keep the published swc's)
In a seperate Flex project 'FlashAssets' I link to that folder 'flashassets' (or you can link to 'classes' only) and you can edit the classes in Flexbuilder. Essentially you are just using an external editor to edit the classes.
In the fla files in the publish settings I make sure it publishes to that bin folder. Now, in a Flex project I can add that bin folder to my library path so it can find the swc's.
Hope this helps.
That worked well, and I have another pretty simple question. I've placed my shiny new Flex component on the stage and have added an event handler to it so when it is clicked, it calls a public function of the class which the component represents (the AS3 class it is linked to).
linked AS3 class
And the question?
Sorry about that.
I can export the Flex Component from flash, but It seems disconnected from it's code. The code I showed you is the class for the flex component I've created in flash. I can't seem to call any methods of the class.
What I was trying to do was place it on the screen and when it was clicked on, change it's appearance (using the showFault() method of the class). I can get it to come up, but I can't control it with showFault().
If I place the same instance on the stage in flash and try the same thing, it works the way I expected it to. I know it's a matter of scope, but I'm still at a loss.
When exporting the flex component from flash, there is no instance on the stage. I've attached the mxml, maybe there is something really missing.
Thanks for getting back to me, I appreciate the help.
AccessPanel_15Button extends MovieClip
That's a no go. The class that is connected to the symbol must extend UIMovieClip
Ah, I see where this is going.
When you use the Command to convert the symbol you have selected in the library, the command automatically assigns a class to the instance. By default... in the default package -> in the same directory where the fla is.
But, you want to connect it to AccessPanels.AccessPanel_15Button. And if you do, Flash starts complaining about the base class.
So, if you want to keep your packages intact...
There is a workaround. Let's assume the symbol you want to convert has a name AccessPanel15Button (this becomes the name of the component in Flex). Using the command 'Convert Symbol to Flex Component' the symbol will be assigned a class 'AccessPanel15Button'.
In the same folder as the fla add the attached class. Publish and in Flex point to the published swc.
Use the attached mxml to test.
Another way out is re-arranging the packages. Put the class that needs to be connected to the instance in the default package. I couldn't find a way yet to connect a symbol to a class that resides in another package.
I will try that, thanks so much for your help. I wouldn't have gotten even to this point in Flex without your help. I'll keep you posted (no pun intended). Thanks.
That worked perfectly, thank you very much. What I found was that I could leave the packages in tact for the child clips of the panel, and access them as just plain old movie clips from the panel instance (the parent flex component). Along those lines, is their an advantage to converting all of the children to flex components, or is it sufficient to leave them as movie clips ?
I realize that I've been hitting you up pretty hard, but it just seems like I'm into a situation where I'm sure I could make it work either way right now, but I'm not experienced enough with Flex to know if there are limitations to not converting the children into Flex components
(aside from the obvious which I think is that as movie clips, they will not be able to be added in to my app via mxml).
Good to hear that it is working out!
If you don't need to use the childs seperately, no. That's practically the same with the standard components. You can access any childs by way of the API of your Flash converted symbol so I don't see the need to convert every single child to a Flex Component. In fact, I'm working with the Kit in exactly the same way and I haven't run into any issues yet.