• 用xml配置加载cs中为ActionScript导出的类


    private var swfLoader:Loader;
    private function loadSwf():void
    {
    // TODO Auto Generated method stub
    swfLoader = new Loader();
    swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,swfLoadCompleteHandler);
    swfLoader.load(new URLRequest("music.swf"));//music.swf是把cs中所有声音类放在music.fla中导出的swf
    }

    protected function swfLoadCompleteHandler(event:Event):void
    {
    // TODO Auto-generated method stub
    swfLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,swfLoadCompleteHandler);
    var swfInfo:LoaderInfo = LoaderInfo(event.target);
    var i:int = 0;
    var len:int = picList.length;
    for(i;i<len;i++)
    {
    var picVo:PicVo = PicVo(picList[i]);
    picVo.swfInfo = swfInfo;
    var soundClass:Class = picVo.swfInfo.applicationDomain.getDefinition(picVo.className) as Class;//picVo.className是cs中定义好的类名解析xml后存在PicVo类中
    var sound:Sound = new soundClass();
    picVo.sound = sound;
    }

    }

  • 相关阅读:
    CSS常用伪类
    HTML5常用API
    HTML5新技术FormData提交表单数据
    WebPack打包后如何调试
    layui的初体验(layer的使用)
    java数组
    java:注解
    java反射:框架设计的灵魂
    885历年编程题
    2020年专业课编程题
  • 原文地址:https://www.cnblogs.com/kuailezoe/p/2974956.html
Copyright © 2020-2023  润新知