开发者

How using my MovieClip in other flash projects?

开发者 https://www.devze.com 2023-01-02 22:00 出处:网络
I worked in flash cs3. Have \"People.swf\"- library MovieClips, they have export for actionscript and first frame. Names classes \"Head1\"...\"Head2\" and so on.

I worked in flash cs3. Have "People.swf"- library MovieClips, they have export for actionscript and first frame. Names classes "Head1"..."Head2" and so on. How i make create object "Head1" in other flash pr开发者_Python百科oject?


load your "library.swf" into a new ApplicationDomain within your application and try something like that:

var _name: String = 'Head1';

try {
    var _class: Class = getDefinitionByName( _name ) as Class;
    var _instance: MovieClip = new _class() as MovieClip;

    addChild(_instance);
}
catch (e:Error) {

    trace('Error - Definition could not be found ! ['+ _name +']');
}

regards..


Don't want to copy & paste code here. See the useful examples in the official documentation on ApplicationDomain class. You can also find documentation on this class in your native language (russian) here.

0

精彩评论

暂无评论...
验证码 换一张
取 消