Flex is not that troublesome.
- <Mx: progressbar source = "msgeditor"/>
- <Mx: moduleloader id = "msgeditor" url = "View/contactpanel.swf"/>
Copy code You can. |
How to use code, flex has modulemanager import MX. Events. moduleevent;
Import MX. modules. modulemanager;
Import MX. modules. moduleloader;
Import MX. modules. imoduleinfo;
Protected VaR _ moduleinfo: imoduleinfo; Public Function Init (): void
{
_ Moduleinfo = modulemanager. getmodule ("testm.swf ");
// Add some listeners
_ Moduleinfo. addeventlistener (moduleevent. Ready, onmoduleready );
_ Moduleinfo. addeventlistener (moduleevent. setup, onmodulesetup );
_ Moduleinfo. addeventlistener (moduleevent. Unload, onmoduleunload );
_ Moduleinfo. addeventlistener (moduleevent. Progress, onmoduleprogress );
_ Moduleinfo. Load (); // var M1: moduleloader = new moduleloader ();
// M1.url = "tew..swf"; // The URL points to modone. mxml
// M1.loadmodule (); // sends a command to call the module
// This. addchild (M1 );
// URL = "tew..swf" width = "800" Height = "600"
}
Public Function onmoduleready (E: moduleevent)
{
Trace ("ready ");
// Cast the currenttarget
VaR moduleinfo: imoduleinfo = E. currenttarget as imoduleinfo;
// Add an instance of the module's class to
// Display list.
Trace ("calling imoduleinfo. Factory. Create ()");
This. addchild (moduleinfo. Factory. Create () as testm );
Trace ("somemodule instance created and added to display List ");
}
Public Function onmodulesetup (EVT: moduleevent)
{
Trace ("setup ");
}
Public Function onmoduleunload (EVT: moduleevent)
{
Trace ("Unload ");
}
Public Function onmoduleprogress (Event: moduleevent)
{
// Trace ("progress ");
Trace ("moduleevent. Progress completed ed:" + event. bytesloaded + "of" + event. bytestotal + "loaded .");
}