• 什么时候使用e.target.content和e.target as MovieClip


    /*content : DisplayObject 
    包含使用 Loader() 或 URLLoader() 
    方法加载的 SWF 文件或图像(JPG、PNG 或 GIF)文件的根显示对象。 
    下以情况使用e.target.content:想得到由Loader加载的显示对像时 */
    var url:URLRequest = new URLRequest("路径");
    var loader:Loader = new Loader  ;
    loader.load(url);
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
    function loadComplete(e:Event):void
    {
    	//此处可得到loader的引用:loader的显示对像 
    	var _tempMc:DisplayObject= e.target.content;
    }
    //以下情况使用e.target as MovieClip:想得到监听对像的引用
    mc.addEventListener(MouseEvent.CLICK,clickHandler);
    function clickHandler(e:MouseEvent)
    {
    	//此处可得到mc的引用 
    	var mc1:MovieClip = e.target as MovieClip;
    }
    
  • 相关阅读:
    【leetcode】反转字符串
    【leetcode】反转字符串 II
    053-669
    053-668
    053-667
    053-666
    053-665
    053-664
    053-663
    053-662
  • 原文地址:https://www.cnblogs.com/602147629/p/2039153.html
Copyright © 2020-2023  润新知