This content has been marked as final. Show 4 replies
I didn't think you could have AS in Flash SWF brought into Flex, or at least it was ignored. You can access other Flex app swf AS though.
I'm not sure if this makes any difference, but I can activate the function within the embedded swf and have it output to the Flex console.
You can have a Flash swf in Flex as long as they use the same version of ActionScript. Actually, you can use a Flash 8 swf in Flex 2-3, but it is difficult to communicate with it.
But in this case there should be no problem.
You can access any public property of the loaded swf throught the SWFloader.content property.
There are some timing issues if you attempt this immediately on load. I have an example on www.cflex.net that shows how to do that.
But if the swf is fully loaded before you attempt to communicate iwth it, say on a user click, there should be no problem.
Generally you can do this by creating an AS file for your SWF, and setting it in the Publisher settings.
For example: If you name put 'example' in the Action Script setting box in the publisher settings, it will look for a file called example.as.
Your example.as would look like:
public class example extends MovieClip
function example ():void
public function start():void
except insteead of start() you would have your method read and return the data you needed. You may need to give some of your flash objects instances names so you can get to them more easily.
You would need to wait on the complete event in Flex, then you could use
(myexample.content as MovieClip).start()