FlexÖнø¶ÈÌõµÄʹÓÃ
ÑùÕÅͼ£º
ʹÓ÷½·¨£º
ÉèÖÃApplication±êÇ©µÄpreloaderΪ MyComponent.MyDownloadProgressBar
<mx:Application preloader="MyComponent.MyDownloadProgressBar" >
ÏÂÃæÊÇMyDownloadProgressBar.asµÄ´úÂ룺
package MyComponent
{
import flash.display.*;
import flash.events.*;
import flash.filters.BitmapFilterQuality;
import flash.filters.BlurFilter;
import flash.geom.Matrix;
import flash.net.*;
import flash.text.TextField;
import flash.utils.*;
import flash.system.Capabilities;
import mx.events.*;
import mx.preloaders.*;
public class MyDownloadProgressBar extends Sprite implements IPreloaderDisplay
{
[Embed(source="logo.png", mimeType="application/octet-stream")]
public var _loadingLogo:Class;
private var dpbImageControl:Loader;
private var _barSprite:Sprite;
private var progressText:TextField;
private var ProgressBarSpritIsAdded:Boolean = false;
public function MyDownloadProgressBar() {
super();
}
// Specify the event listeners.
public function set preloader(preloader:Sprite):void {
//Listen for ÕýÔÚÏÂÔØ
preloader.addEventListener(ProgressEvent.PROGRESS, handleProgress);
//Listen for ÏÂÔØÍê³É
preloader.addEventListener(Event.COMPLETE, handleComplete);
//Listen for ÕýÔÚ³õʼ»¯
preloader.addEventListener(FlexEvent.INIT_PROGRESS, handleInitProgress);
//Listen for ³õʼ»¯Íê³É
preloader.addEventListener(FlexEvent.INIT_COMPLETE, handleInitComplete);
}
// Initialize the Loader control in the override
// of IPreloaderDisplay.initialize().
public function initialize():void {
//Ìí¼Ólogoͼ
dpbImageControl = new Loader();
dpbImageControl.contentLoaderInfo.addEventListener(Event.COMPLETE, loader_completeHandler);
Ïà¹ØÎĵµ£º
1.¹ØÓÚflexµ÷ÊÔ³ö´íеĽâ¾ö˼·:³ýÁËÍøÉÏ˵µÄflash debug°æ±¾Ã»×°Íâ,nodɱ¶¾Èí¼þÒ²ÊÇÒ»¸öÎÊÌâ »¹ÓоÍÊǵ÷ÊÔģʽµÄÎÊÌâ Óб¾µØģʽºÍÔ¶³Ìģʽ ¾ßÌåÐ޸ķ½Ê½µ÷ÊÔ״̬ÏÂÓÒ»÷µ÷ÊÔÆ÷Ñ¡Ôñ×Ô¼ºÏëÒªµÄ. 2.flex°ó¶¨Êý×éɾ³ýÔªËغólistûÓиüÐÂÊý¾Ý ¿ÉÒÔÓÃinvalidateList() 3.progressBar½ø¶Èû¸üпÉÄÜÊÇmodeÉ趨µÄÔÒò ......
×î½üÓÃflexÀ´×öÒ»¸ö¹¤×÷Á÷¶¨Òå±à¼Æ÷¡£ÔÚÍøÉÏÕÒÁ˺ܶàÀý×Ó£¬Ò²Ñ§µ½Á˲»ÉÙ¶«Î÷¡£
flexÊÇadobe¹«Ë¾³öµÄ¶ÔÓÚflashµÄÒ»¸ö²úÆ·¡£¶ÔÓÚѧ¹ýjavaµÄÈËÀ´ËµÔÙ¼òµ¥²»¹ýÁË¡£ÕâÀïÒ²²»¶à˵ÁË£¬¾Í¶ÔÓÚÕ⼸ÌìÔÚÏîÄ¿ÖÐÓöµ½µÄÎÊÌâ̸һÏÂ×Ô¼ºµÄ½â¾ö·½·¨ÓëÈÏʶ¡£
Ò»¡¢flexÖн«×Ô¼ºµÄÒ»¸öCanvas±ä³ÉΪͼƬ£¬±£´æµ½±¾µØ¡£
var bitmapData ......
Flexƽ̨֧³Ö·¶Î§¹ã·ºµÄ·¢²¼Ä£Ê½£¬ËüÃÇÊÇ£º
1. ¿Í»§¶Ëģʽ£¬¼´Ó¦ÓóÌÐòÖ»ÔËÐÐÔÚ¿Í»§¶ËÉ϶ø²»ÐèÒª·þÎñÆ÷×ÊÔ´¡£
2. ʹÓüòµ¥µÄRPC ·ÃÎÊ·þÎñÆ÷Êý¾Ý£¬ ¼´Ê¹ÓÃHTTPService £¨HTTP GET»òPOSTÇëÇó£©
ºÍ WebService£¨Í¨¹ýʹÓÃSOAP£© ¡£
3. Flex Data Servicesģʽ£¬¿ÉÒÔÌṩ¸üΪ¸ß¼¶µÄÌØÐÔ£¬È ......
as ÔËËã·ûÊÇ ActionScript 3.0 ÖеÄÐÂÔöÔËËã·û£¬Ò²¿ÉÓÃÀ´¼ì²é±í´ïʽÊÇ·ñΪ¸ø¶¨Êý¾ÝÀàÐ͵ijÉÔ±¡£µ«ÊÇ£¬Óë is ÔËËã·û²»Í¬µÄ
ÊÇ£¬as ÔËËã·û²»·µ»Ø²¼¶ûÖµ£¬as ÔËËã·û·µ»Ø±í´ïʽµÄÖµ£¨´úÌæ true£©»ò null£¨´úÌæ false£©¡£ÏÂÃæµÄʾÀýÑÝʾÔÚ¼ì²é Sprite ʵÀý
ÊÇ·ñΪ DisplayObject¡¢IEventDispatcher ºÍ Number Êý¾ÝÀàÐ͵ijÉÔ±Õâ ......