tags:

views:

242

answers:

1
+1  Q: 

Flash and Flex

Hi there,

Just a few quick questions from me:

What is the best way to inserting a Flash SWF file into a flex, that will enable me to have it start from frame 0 on reentry of that framework? Would this be States, Viewstack?

Is there a way of using forward and back buttons to navigate through displaying a set of States rather than selecting certain objects that will then change the state onscreen?

Is there some code anywhere that can show this?

Also buttons in Flash, is there a problem of them being selectable when they are displayed in Flash?

TIA - Regards

J

+1  A: 

If you use a Viewstack, you could put the SWF into a container, say a Canvas, and do something like this

<mx:ViewStack>
   <mx:Canvas show="(mySWFA.content as MovieClip).gotoAndPlay(0);">
      <mx:SWFLoader id="mySWFA" source="mySWFA.swf"/>
   </mx:Canvas>
   <mx:Canvas show="(mySWFB.content as MovieClip).gotoAndPlay(0);">
      <mx:SWFLoader id="mySWFB" source="mySWFB.swf"/>
   </mx:Canvas>
</mx:ViewStack>

I haven't tested this and I'm taking a bit of a guess on the .content part, but the basic idea is that the Viewstack will fire the show event when the stack index is changed. That will give you a hook to rewind your swf.

Also, a Viewstack can be set to obey the browser's forward and back buttons through the project properties->Flex Compiler->Browser Integration. It should automatically work once this is on.

Ben Throop