I want to load an swf into a flex 4 application in order to use its classes.
var ldr:Loader=new Loader();
ldr.load(new URLRequest(\"file://path/to/fileswf\")
private var _loader:SWFLoader = new SWFLoader();
private var _uicomponent:UIComponent = new UIComponent();
private function swfLoaded(event:Event):void
{
Alert.show("inside swf Loaded");
var content:DisplayObject =_loader.content;
_uicomponent.addChild(content);
}
public function loadSWF () : void
{
_loader.addEventListener(Event.INIT, swfLoaded);
_loader.load("http://intelliveysoft.com:5080/myelearn/Admin.swf");
addElement(_uicomponent);
}
Try this. It will work
Create another container to place the displayObject in:
// container ( IVisualElement ) for DisplayObjects
var container:UIComponent = new UIComponent();
addElement( container );
// displayObject goes to container
var displayO:Sprite = new Sprite();
container.addChild( displayO );
well in flash builder 4 full version, there isn't any this.rawChildren.
The best approach to resolve the issue would be to convert each required class to a flex component and to use it on your flex application:
download and install flex component kit http://www.adobe.com/cfusion/entitlement/index.cfm?e=flex_skins
create a movie clip
convert to flex component
add the relevant functions to this class
a skeleton for a class that is attached to a movieclip that is about to be converted to a flex component:
package {
import mx.flash.UIMovieClip;
import flash.text.TextField;
import flash.events.Event;
import flash.events.MouseEvent;
public dynamic class challenge_screen extends UIMovieClip {
public function challenge_screen() {
super();
}
}
}
this.rawChildren.addChild( ldr ) should work