Home > Flash, Flex > Load Flex Into Flash

Load Flex Into Flash

April 30, 2008

This question comes up a lot, mostly from the standpoint of creating lightweight app. managers in Flash CS3 that load independent portions of an application that are written in Flex. I’ve used this in the past for PureMVC applications that load other PureMVC apps, for example. The technique in the sample files is a quick hack, but hacks can be fun. No time for a full-on tutorial, so you’ll have to deconstruct it yourself. Pretty easy to figure out and you will probably be able to find the cleaner way to accomplish the task as well๐Ÿ™‚

The Flex -> Flash example shows how to create a simple Flex app. with a button that dispatches an event on click. The Flash CS3 Document class loads the .swf created by Flex and assigns a handler for the event. The handler manipulates the button and calls a public method defined in the Flex app’s SCRIPT block.

The same method can be used to load Flex into Flex and there are examples of both. The Flex -> Flex example shows a couple variations that may be of interest to you.

There is a README file with the code distribution. Download the files here and have fun!

Categories: Flash, Flex
  1. JT
    May 4, 2008 at 1:06 pm

    Interesting – might be able to use this on one of my projects at uni.

  2. Edmund Maruhn
    October 22, 2008 at 7:51 pm

    Seems to be very helpful!๐Ÿ™‚

    I saw you implement a cleanup method that is called via the __onInitialize() handler, but you never listen to something that calls this handler.๐Ÿ˜‰

    Greets
    Eddi

  3. October 23, 2008 at 5:28 am

    Probably leftover from converting the load Flash into Flex example; that one had some additional features that required the cleanup method. Ignore it๐Ÿ™‚

  4. Sagar Parikh
    March 20, 2009 at 2:51 am

    Thanks for the post. Very Helpful…

  1. No trackbacks yet.
Comments are closed.
%d bloggers like this: