A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Embed Flex 2.0 swf into Flash (8 or 9)

  1. #1
    Captain Egghead cembert's Avatar
    Join Date
    Aug 2001
    Posts
    212

    Embed Flex 2.0 swf into Flash (8 or 9)

    Trying to embed a flex 2.0 swf into flash and having some major problems.
    I have attempted this in 2 ways.

    -Import Flex swf directly to stage. Gives me 2 blank keyframes.
    -load it using the Loader class. Gives me errors.

    Any help would be appreciated.
    -Chris
    eggheadstudio.com...version 2.0...coming soon

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    You can only load Flex 2 movies into Flash 9/AS3 movies. This is the script:

    var url:String = "flexmovie.swf";
    var urlRequest:URLRequest = new URLRequest(url);
    var urlLoader:Loader = new Loader();
    urlLoader.load (urlRequest);
    addChild (urlLoader);

    If you want to communicate with the Flex movie you need to use an Eventdispatcher.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Captain Egghead cembert's Avatar
    Join Date
    Aug 2001
    Posts
    212
    What if I want to bring the flex swf in at a certain size and allow it to be scaled by user...Eventdispatcher?
    eggheadstudio.com...version 2.0...coming soon

  4. #4
    Captain Egghead cembert's Avatar
    Join Date
    Aug 2001
    Posts
    212

    reply

    I am attempting to load it from within a mc. Does not seem to work when I attempt to do so.
    eggheadstudio.com...version 2.0...coming soon

  5. #5
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    I once created a Loaderclass, which saves a lot of scripting:
    http://flashas3.flashscript.biz/Load...aderClass.html
    The class contains already an Eventdispatcher. Below is a script for a Flash movie, where I load a Flex movie into a Sprite, which is then resized. The Flex movie has a button named myBut, which i am tracing here. All works fine.

    PHP Code:
    import flash.events.Event;
    import Flashscript.helper.LoaderClass;
    //
    var mc:Sprite = new Sprite();
    addChild (mc);
    var 
    url:String "chapter4_10.swf";
    var 
    lc:LoaderClass = new LoaderClass ();
    lc.initLoader (urlloadFinishednull);
    function 
    loadFinished (event:Event):void
    {
        var 
    loadedName:Sprite event.target.content;
        
    mc.addChild (loadedName);
        
    loadedName.addEventListener (Event.ADDEDaddHandler);
        function 
    addHandler (event:Event):void
        
    {
            try
            {
                
    trace (event.target.getChildByName("myBut"));
                
    mc.width=200;
                
    mc.height=200;
            }
            catch (
    Error)
            {
                
    trace ("error");
            }
        }

    - The right of the People to create Flash movies shall not be infringed. -

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center