首页 > 代码库 > flash显示qq在线聊天 - 转

flash显示qq在线聊天 - 转

package
{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.globalization.StringTools;
    import flash.net.URLRequest;
    import flash.net.navigateToURL;
    import flash.display.Bitmap;
    import flash.display.Loader;
    import flash.ui.Mouse;
    import flash.ui.MouseCursor;
 
 
    public class Main extends Sprite
    {            
        private var qq:String = "278919507";
        private var loader:Loader = new Loader();
        private var bit:Bitmap ;
        private var box:Sprite;
         
        public function Main():void
        {
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);
        }
 
        private function init(e:Event = null):void
        {
            removeEventListener(Event.ADDED_TO_STAGE, init);       
            box = new Sprite();
            upData();
        }
         
        public function upData():void
        {     
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCom); 
            var sUrl:String = "http://wpa.qq.com/pa?p=2:" + qq + ":41?" + Math.random();
            trace(sUrl);           
            loader.load(new URLRequest(sUrl));
        }          
 
        private function onCom(e:Event) :void
        {           
            bit = Bitmap(loader.content);  
            bit.height = 22;
            bit.width = 74;    
            box.addChild(bit);         
            addChild(box);         
            box.x = box.y = 10;
             
            //点击图标,以及切换鼠标
            box.addEventListener(MouseEvent.CLICK, onClick);
            box.addEventListener(MouseEvent.MOUSE_OVER, onm ouseOver);
            box.addEventListener(MouseEvent.MOUSE_OUT, onm ouseOut);
             
        }    
         
        private function onClick(e:MouseEvent):void
        {
            var sUrl:String = "http://wpa.qq.com/msgrd?v=3&uin=" + qq + "&site=qq&menu=yes";
            navigateToURL(new URLRequest(sUrl),"_blank");
            trace("test");
        }
         
        private function onMouseOver(e:MouseEvent):void
        {
            Mouse.cursor=MouseCursor.BUTTON;
        }
         
        private function onMouseOut(e:MouseEvent):void
        {
            Mouse.cursor=MouseCursor.ARROW;
        }
 
         
    }
 
}
做个笔记  避免找不到了
作者:菩提树下的杨过
出处:http://yjmyzz.cnblogs.com
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。