If you need capabilities that require Flash Builder, you would import the Flash Catalyst work into Flash Builder and work from there .. not the other way around. I think that is what you are asking.
Thank you very much for that, I thought that's how it was. But now my question is how. My website (www.alexpete.com) has a background image on it, I want to add an ActionScript piece that will make that image in the background random. I have the script, how do I replace the image with said script?
Thanks so much!
To edit the code of a Flash Catalyst project, you can import it into Flash Builder as follows:
- File > Import > Flash Builder Project
- Select the FXP file from Catalyst
- Make sure "Import new copy of project" is selected, then hit Finish
I'm not sure where you got the ActionScript code that you're planning to use, but it may be difficult to integrate into your project if it's not designed for use with Flex (a lot of AS code snippets you'll find online are just for general use in Flash, not tailored for Flex applications). But you'll probably want to do something like this:
- Locate the image you want to make random. If you're having trouble doing this, switch the view to Design mode, select the image with the mouse, and then switch back to Code mode to see the corresponding code highlighted.
- If there's no id attribute set on the image, add one (so you can refer to it in code later).
- If the tag is s:BitmapImage, change it to mx:Image (this is needed to make the contents dynamic)
- If the root s:Application tag doesn't have a creationComplete handler, add one (type it partway, then hit Ctrl+Space, then choose "Generate Handler").
- In the handler, add your code to randomly select an image filename.
- Then set <your image's id>.source = <filename>
Hope that helps!
One added note, once you transfer your project from Flash Catalyst into Flash Builder, you will be unable to reopen the project within Flash Catalyst.
Yes -- once you've edited a project in Flash Builder, you can't re-import it into Catalyst. You can, however, continue making changes to the UI/visual design in Catalyst and then merging those changes back into your Builder project.
This is easiest if you try to keep your business logic in Builder cleanly separated from your UI presentation code (which is a good practice for many other reasons as well). If you want to learn more about working with Builder and Catalyst together, I highly recommend watching Andrew Shorten's talk from MAX 2009.
Thanks so much for that, except, I'm having a bit of an issue. I think I have it, but I get lost with the "creationComplete" part... where will that be? Will it be part of that image I want to add the script to? I hope I'm not making a fool out of myself, this is my first attempt at anything Flash/Flex.
Look for the main.mxml file in the directory structure. Open it in Flash Builder. At the top of the file you will see <s:Application .....
that is where you would add the creationComplete element.