码迷,mamicode.com
首页 > 其他好文 > 详细

flash显示qq在线聊天 - 转

时间:2014-07-31 12:37:56      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:blog   http   color   io   cti   ar   div   line   

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, onMouseOver);
            box.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
             
        }    
         
        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
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

flash显示qq在线聊天 - 转,布布扣,bubuko.com

flash显示qq在线聊天 - 转

标签:blog   http   color   io   cti   ar   div   line   

原文地址:http://www.cnblogs.com/xhmf/p/3880061.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!