随笔 - 20  文章 - 2 评论 - 32 trackbacks - 0

地址http://www.onflex.org/flexapps/components/CustomPreloader/

代码
package preload
{
    import flash.display.Loader;
    import flash.utils.ByteArray;
    import flash.events.MouseEvent;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    
    
public class WelcomeScreen extends Loader//继承其他类吧???
    {
        
        [ Embed(source
="welcome.gif", mimeType="application/octet-stream") ]//要求这个progress bar加载前,先把welcome.gif下载好,以便代码之用
        public var WelcomeGif:Class;//建立一个空类
        public var timer:Timer;//建立一个定时器
        private var fadeInRate:Number  = .01;//设定透明度每次增加的量
        private var fadeOutRate:Number = .02;//设定透明度每次减少的量
        private var timeAutoClose:int = 500;
        
public var ready:Boolean = false
        
        
public function WelcomeScreen()//本类的构造函数,在实例化的时候首先执行
        {
            
this.visible = false;//不显示
            this.alpha = 0;//完全透明
            timer = new Timer( 1 );//建立定时器,时间间隔为1毫秒??
            timer.addEventListener( TimerEvent.TIMER, updateView );//建立一个显示的过程
            timer.start();

            
this.loadBytes( new WelcomeGif() as ByteArray );//把图片load进实例化为ByteArray的WelcomeGif类里面,详细看loadBytes的用法(这句应该是属于显示图片的关键语句吧)
            this.addEventListener( MouseEvent.MOUSE_DOWN, mouseDown );//建立鼠标帧听时间(实现点击鼠标就关闭???)             
        }
        
        
public function updateView( event:TimerEvent ):void//图片从全透明变成不透明的方法
        {
            
ifthis.alpha < 1)    this.alpha = this.alpha + this.fadeInRate;
            
this.stage.addChild(this)
            
this.x = this.stage.stageWidth/2 - this.width/2
            
this.y = this.stage.stageHeight/2 - this.height/2
            
this.visible=true;
            
ifthis.ready && timer.currentCount > this.timeAutoClose ) closeScreen()    //如果ready为true??与定时器的值大于上面设置的500,就关闭图片
        }
        
        
public function closeScreen():void//关闭图片的方法,去掉2个帧听,加入一个新的帧听,让图片渐渐消失
        {
            timer.removeEventListener( TimerEvent.TIMER, updateView );
            timer.removeEventListener( MouseEvent.MOUSE_DOWN, mouseDown);
            timer.addEventListener( TimerEvent.TIMER, closeScreenFade );                    
        }
        
        
public function closeScreenFade( event:TimerEvent ):void//图片渐渐消失的过程,透明度不断变小,当透明度不大于0(就是为0时),timer停止,图片被去掉
        {
            
ifthis.alpha > 0){
                
this.alpha = this.alpha - fadeOutRate;
            } 
else {
                timer.stop()
                
this.parent.removeChild(this);
            }        
        }        
        
        
public function mouseDown( event:MouseEvent ):void//这里简单,老鼠一点,就关闭了
        {
            closeScreen();        
        }
                
    }
}

注释的不一定准确,发现错误,欢迎指正...
这是主要的类,其他的比较简单,详细可以打开连接后,右击,点ViewSource...

欢迎有共同兴趣的一起研究,请联系:QQ165619258,MSN:gd_gz_boy@hotmail.com
posted @ 2007-03-08 14:17 gzboy 阅读(1904) 评论(0) 编辑
http://xinye0123.blogspot.com/index.html

不错不错...
posted @ 2007-03-06 22:13 gzboy 阅读(131) 评论(0) 编辑
想用flex + C# + sql server做...

不过对FLEX不太熟悉...有空研究研究...
posted @ 2007-01-27 17:52 gzboy 阅读(632) 评论(2) 编辑

能够实现Flash 直接搜索数据库,再播放视频...

衍生出来的程序,可能可以实现在一个列表页面中点击其中一个视频...

FLASH播放器自动播放...不会出现任何刷新...

地址也能够完美隐藏(截取系统封包除外,但是截取IE封包是没办法获得地址了)...

用FMS提供流...不会在客户端产生播放文件...

演示地址:http://bb.feel2u.com

posted @ 2007-01-25 13:15 gzboy 阅读(779) 评论(10) 编辑
在FMS安装目录下的appliaction目录下建立test1文件夹...

然后打开flash 8插入以下代码...
  1 function Record()
  2 {
  3     video_r._visible = true;
  4     video_p._visible = false;
  5     play_bt.enabled = false;
  6     record_bt.label = "停止";
  7     rapStatus = "recording";
  8     videoinfo.text = "文件信息:" + videoName + ".flv";
  9     rap_status.text = "当前状态:正在录制";
 10     netStream.publish(videoName, "record");
 11     RecordInterval = setInterval(RecordTime, 1000);
 12 
 13 function RecordStop()
 14 {
 15     rap_status.text = "当前状态:录制完成";
 16     record_bt.label = "录制";
 17     play_bt.enabled = true;
 18     clearInterval(RecordInterval);
 19     timeNum = 0;
 20     netStream.close();
 21     rapStatus = "recordstop";
 22     videolist.addItem({label: videoName});
 23 
 24 function RecordTime()
 25 {
 26     ++timeNum;
 27     rap_status.text = "当前状态:录制中 - " + Math.floor(timeNum / 60+ "" + timeNum % 60 + "";
 28 
 29 function PlayVideo()
 30 {
 31     video_r._visible = false;
 32     video_p._visible = true;
 33     record_bt.enabled = false;
 34     play_bt.label = "停止";
 35     var playvideo = videolist.selectedItem.label;
 36     video_p.attachVideo(netStream);
 37     rapStatus = "playing";
 38     netStream.play(playvideo);
 39     netStream.onStatus = function (PlayInfo)
 40     {
 41         if (PlayInfo.code == "NetStream.Play.Stop")
 42         {
 43             rapStatus = "playstop";
 44             netStream.close();
 45             rap_status.text = "当前状态:播放完毕";
 46             play_bt.label = "播放";
 47             record_bt.enabled = true;
 48         } 
 49     };
 50 
 51 function PlayStop()
 52 {
 53     video_r._visible = true;
 54     video_p._visible = false;
 55     video_r.attachVideo(my_cam);
 56     record_bt.enabled = true;
 57     play_bt.label = "播放";
 58     rapStatus = "playstop";
 59     netStream.close();
 60     rap_status.text = "当前状态:播放停止";
 61 
 62 var ser_url = "rtmp://192.168.1.68/r_p";
 63 var rec_date = new Date();
 64 var videoName = String(rec_date.getFullYear()) + String(rec_date.getMonth() + 1+ String(rec_date.getDate()) + String(rec_date.getHours()) + String(rec_date.getMinutes()) + String(rec_date.getSeconds()) + String(rec_date.getMilliseconds());
 65 var netConn = new NetConnection();
 66 netConn.connect(ser_url);
 67 var netStream = new NetStream(netConn);
 68 var my_cam = Camera.get();
 69 if(my_cam == null)
 70 {
 71     rap_status.text = "当前状态:没有找到MAC";
 72 }
 73 else
 74 {
 75     video_r.attachVideo(my_cam);
 76     my_cam.setQuality(0100);
 77     my_cam.setKeyFrameInterval(15);
 78     my_cam.setLoopback(true);
 79     my_cam.setMode(32024030true);
 80     netStream.attachVideo(my_cam);
 81     my_cam.onStatus = function(infoObj:Object)
 82     {
 83         if (my_cam.muted) {
 84         // If user is denied access to their Camera, you can display an error message here. You can display the user's Camera/Privacy settings again using System.showSettings(0); 
 85         trace("User denied access to Camera");
 86         System.showSettings(0);
 87         }
 88     }
 89     var my_mic = Microphone.get();
 90     if(my_mic == null)
 91     {
 92         rap_status.text = "当前状态:没有找到MIC";
 93     }
 94     else
 95     {
 96         netStream.attachAudio(my_mic);
 97         my_mic.onStatus = function(infoObj:Object)
 98         {
 99             if (my_mic.muted) {
100             // If user is denied access to their Camera, you can display an error message here. You can display the user's Camera/Privacy settings again using System.showSettings(0); 
101             trace("User denied access to Camera");
102             System.showSettings(0);
103             }
104         }
105     }
106 }
107 var rapStatus = "free";
108 netConn.onStatus = function (info)
109 {
110     if (info.code == "NetConnection.Connect.Success")
111     {
112         conn_status.text = "连接状态: 连接成功";
113     }
114     else
115     {
116         conn_status.text = "连接状态: 连接错误";
117     }
118 };
119 var timeNum = 0;
120 record_bt.onRelease = function ()
121 {
122     if (rapStatus == "free" | rapStatus == "recordstop")
123     {
124         Record();
125     }
126     else if (rapStatus == "recording")
127     {
128         RecordStop();
129     } 
130 };
131 play_bt.onRelease = function ()
132 {
133     if (rapStatus == "free" | rapStatus == "playstop" | rapStatus == "recordstop")
134     {
135         //trace(videolist.length);
136         if(videolist.length > 0)
137         {
138             PlayVideo();
139         }
140         else
141         {
142             rap_status.text = "当前状态:没有视频";
143         }
144     }
145     else if (rapStatus == "playing")
146     {
147         PlayStop();
148     }
149 };


其中conn_status,rap_status,videoinfo为testarea...

play_bt,record_bt为按钮...

videolist为list...

video_r,video_p为视频元件(建立方法为:按ctrl+L,然后右击,新建视频,命名,拖到场景中,把实例改为前面的名称就可以了)...

剩下的...自己试吧...

参考例子的声明:
    Powerd By:Cincn.com
    Create By:KeeRula;
    此教程及附带源文件仅做网友个人交流学习使用.请勿用于商业用途.需要商业版请联系MSN:Myproductgroup@hotmail.com.
    FLASH技术交流学习群:25448796.
    版权保护:北联科技.

欢迎交流:msn:gd_gz_boy@hotmail.com
posted @ 2007-01-20 21:40 gzboy 阅读(569) 评论(0) 编辑
摘要: http://esd.mercury.com/akdlm/trial/lr/LR8DownLoad.exeloadrunner8.0下载地址...Licence :AEABEXFR-YTIEKEKJJMFKEKEKWBRAUNQJU-KBYGBAIBDCNIY-AKFM-ASCEKJJJJSYJKIEAZKEKEKEHX-KDNCY阅读全文
posted @ 2007-01-11 09:48 gzboy 阅读(2380) 评论(7) 编辑
摘要: 在很多情况下我们需要将指定的数据库中的所有表都列出来。在使用c#进行软件开发时,我们有哪些方法可是实现这个目的呢?本人对此进行概要的总结,有以下6中方式可以实现这个目的。1、sqldmoSQLDMO是操作SQLServer的理想的方式,如果您的数据库是SQLServer就可以考虑使用这种方式。在C#中使用SQLDMO需要添加SQLDMO的引用,然后在当前的文件中using SQLDMO;即可以使用...阅读全文
posted @ 2006-12-30 11:33 gzboy 阅读(2097) 评论(0) 编辑
摘要: 服务器IP固定...本机ADSL上网,IP不固定...都采用SQL SERVER 2005...通过发布和订阅的方式,未成功过...最后因为快照代理的身份验证失败...具体好象是因为进程帐户的身份验证失败...其实,我非常想知道,什么是进程帐户...怎么设置...请有经验的倾囊相助...感谢感谢...我参考的是这篇文章:http://www.knowsky.com/print.asp?id=340...阅读全文
posted @ 2006-12-18 10:50 gzboy 阅读(219) 评论(0) 编辑
摘要: flex2下载(正式版)http://211.148.188.195/flex/flex2b.exeflex2 注册码Flex License: 1307-1581-4356-2616-4951-7949 (Commercial Version) 1307-1581-4356-2939-1231-4484 (Education Version) Charting License: 1301-458...阅读全文
posted @ 2006-11-27 14:45 gzboy 阅读(1579) 评论(0) 编辑
摘要: 单击【开始】→【程序】→【管理工具】→【IIS管理器】,逐步展开“本地计算机”、“网站”,在你的网站上右击,选择【属性】,单击“HTTP头”选项卡→单击“MIME类型”按钮,再单击“新建”按钮,在“扩展名”框...阅读全文
posted @ 2006-11-24 17:09 gzboy 阅读(5189) 评论(3) 编辑
仅列出标题  下一页