-
Captain Egghead
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
-
Senior Member
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. -
-
Captain Egghead
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
-
Captain Egghead
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
-
Senior Member
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 (url, loadFinished, null);
function loadFinished (event:Event):void
{
var loadedName:Sprite = event.target.content;
mc.addChild (loadedName);
loadedName.addEventListener (Event.ADDED, addHandler);
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|