This content has been marked as final. Show 10 replies
The Embed tag is used to embed static swf content (artwork or skins) that doesn't contain any AS3 code.
Use the Flex Component kit for Flash to convert the mp3 player to a Flex component.
luigil, thanks for your response.
does that mean there is no way to communicate with a swf that has been embedded? if so it's a real shame.
re: swc. can i just save the movieclip as a swc in flash, then move all the actionscript from the flash file to flex? or do i need to do more to migrate the content? if the actionscript is in flex, how can i tell the swf to go to frames etc?
Well, since the SWFLoader.content property is the root timeline of your loaded swf, you can call functions that are defined on the root timeline.
Using the Flex Component kit for Flash you can have a document class for your mp3player in Flash and call functions that are defined there from Flex. So, you don't 'move' the actionscript from the Flash to Flex, you just use the AS connected to your swf in Flex. In your case it seems to me that this would be a better solution for you to use than using the SWFLoader.
so i put my as3 in a package (making all the functions public) and save my movie as an swc - is the document class automatically included in the swc? or do i need to tick/change something?
then i put the swc in my lib path for the app, but how do i drop the clip on the stage and execute the functions?
sorry for all the questions...
1. You must be using the Flex Component Kit for Flash
2. Select the clip in the library that you want to turn into a component for Flex
3. Use the command (command menu in Flash) to convert the clip to a Flex Component
4. Publish -> your swc is ready
If you don't have a document class, one is made automatically and it has the same name as the name of the clip in the library
You can provide a document class. Look at the linkage identifier for the clip in the library. There you will see what the name of the class is. Create the class yourself and Publish. Now add the swc to your library path in Flex. Now you can use the component as any other component in Flex. So, put the clip on the stage using mxml or in ActionScript using var myplayer = new MyPlayer();
thanks luigi, i will follow your instructions and see how i get on!
thanks for the advice.
i have created the swc and i'm able to make the component appear on the stage (no errors when compiled) by using
myplayer = new MyPlayer();
or by using
but i'm still unable to run the as3 code for the player - am i missing a step where you define which action script to embed in the swc?
In Flash, select the clip you have converted to a Flex Component. Check the linkage indentifier. Here you see which class is connected to the clip (the class name has exactly the same name as the name of the clip in the library. That class (your actionscript) must be in the same directory as your fla file. If everything checks out, Publish. Go to your Flex project and update the library path.
thanks luigi, i'll give it a go...