Search code examples
actionscript-3apache-flexmxml

How to add frames to a flash movie using Flex SDK


I'm new to Flash authoring and just started using the mxmlc Flex SDK tool to compile MXML and ActionScript3 sources into a swf file.

I've been able to compile and run some examples and tests; now I want to define multiple frames for my movie and attach objects to them frames, e.g. sprites, sounds, etc.

How do I add frames using only MXML and ActionScript 3? If this isn't possible, what do I need to do to create frames?


Solution

  • While technically possible - it's essentially never done from a Flex point of view. But because Flex sits on top of the Flash Player stack it is still governed by the rules of what Flash originally started out as - as is still used for - an animation tool.

    Flash is the primary tool you want to use if you need to manually add frames/scenes (as part of an animation sequence. Here you can also attach timeline code (the old school "AS2"ish way), or associate a class that needs to be bound to a particular graphic / movieclip from the library.

    For strictly Flex based applications (data centric UI) the compiler automatically generates a 3-part frame sequence to handle the original FP problem of running/starting frame code before total assets are loaded.

    The technical: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7a92.html

    It's a compiler option under frames - however you really do need to know what your doing to work with this.

    From what I can understand of what you're trying to do: "attach objects to the frames", again - this is the Flash perspective. With Flex any graphical element is declared in code with a new operator, and attached to the "current timeline" via addChild / addElement of a DisplayObjectContainer.