1 1:Enabler 2 import com.google.ads.studio.HtmlEnabler; 3 var enabler:HtmlEnabler = HtmlEnabler.getInstance(); 4 enabler.init(this); 5 enabler.addEventListener(StudioEvent.PAGE_LOADED, pageLoadedHandler); 6 ********exit Bug :必须 Enabler.getInstance().exit("exitTargetURL");************************ 7 8 2:ProxyEnabler 9 import com.google.ads.studio.ProxyEnabler; 10 ProxyEnabler.getInstance().exit("exitTargetURL"); 11 12 3:StudioEvent 13 import com.google.ads.studio.events.StudioEvent; 14 15 4:Expanding 16 import com.google.ads.studio.utils.StudioClassAccessor; 17 var expanding:Object = StudioClassAccessor. getClass(StudioClassAccessor.CLASS_EXPANDING)["getInstance"](); 18 expanding.expand(); 19 expanding.collapse(); 20 expanding.addEventListener(StudioEvent.EXPAND, expandHandler);expanding.addEventListener(StudioEvent.COLLAPSE_COMPLETE, collapseHandler); 21 22 5:VideoPlayer 23 getCurrentVideoController() 24 getElapsedSeconds() //played time 25 getTotalSeconds(); 26 myVideo.getCurrentVideoController().getNetStream().bufferTime=1;//设置缓冲的时间 注意刚开始时netStream是空的 27 myVideo.addEventListener(VideoEvent.COMPLETE,onVideoPlayComplete); 28 myVideo.addEventListener(VideoEvent.PLAY,onVideoPlay); 29 myVideo.addEventListener(VideoEvent.STOP,onVideoStop); 30 myVideo.addEventListener(VideoEvent.PAUSE,onVideoPause); 31 myVideo.addEventListener(VideoEvent.MID_POINT,onVideoMidPoint); 32 33 6:VideoEvent 34 import com.google.ads.studio.events.VideoEvent 35 36 7:close 37 ProxyEnabler.getInstance().reportManualClose(); 38 enabler.close(); 39 40 8:AssetLoader 41 import com.google.ads.studio.events.StudioEvent; 42 var childMovie:MovieClip; 43 function loadHandler(loadEvent:StudioEvent):void { 44 childMovie = loadEvent.content; // Alternatively, loaderInstance.getContentMovieClip() will also return the loaded MovieClip. 45 }; 46 loaderInstance.addEventListener(StudioEvent.LOAD, loadHandler); 47 loaderInstance.getMovieClipLoader().load(request:flash.net:URLRequest, context:flash.system:LoaderContext=null); //swf jpg gif png 48 49 9:LocalConnection 50 import com.google.ads.studio.localconnect.LocalConnectWrapper 51 send 52 var dataObject:Object = {message: "Hello World!"}; 53 localConnectComponent.sendData(dataObject); 54 localConnectComponent.sendData( dataObject, LocalConnectWrapper.PARENT_NAME);// Send data to parent (from a child). 55 localConnectComponent.sendData(dataObject, "child");// Send data to a specific child. 56 receive: 57 import com.google.ads.studio.events.StudioEvent; 58 function dataHandler(dataEvent:StudioEvent):void { trace(dataEvent.sender + " just sent me " + dataEvent.data ); }; localConnectComponent.addEventListener( StudioEvent.DATA_RECEIVED, dataHandler); 59 注意:父要设置子的channel 60 lc.sendData("data send"); 61 if(e.data=="data send") 62 http://dynamictestpage.appspot.com/?w=300&h=350&t=400&l=600&w=728&h=90&t=30&l=100 63 64 10:VideoPlayerAdvanced 65 videoPlayer.play() && pause() && next() && previous() && skipTo(a:int) && getPlaylist() 66 var videoController:EnhancedVideoController = videoPlayer.getCurrentVideoController(); 67 videoController.getVideoEntries()[0].setHigh("newVideo.flv"); 68 或者var videoController:EnhancedVideoController = new EnhancedVideoController(); 69 videoController.setReportingIdentifier("new identifier"); 70 videoController.setVideoObject(videoPlayer.getVideoObject()); 71 72 var videoEntry:VideoEntry = new VideoEntry("high.flv", "mid.flv", "low.flv"); 73 videoController.addVideoEntry(videoEntry); 74 videoPlayer.getPlaylist().addVideoController(videoController); 75 videoPlayer.getPlaylist().start(true); 76 77 11 fullScreen 78 判断是否支持全屏 enabler. isFlashFullScreenSupported(); 79 全屏 enabler.launchFullScreen(StageScaleMode.SHOW_ALL,StageAlign.TOP,new Rectangle(0,131,300,178)); 80 退出 enabler.exitFullScreen(); 81 enabler.addEventListener(StudioEvent.FULL_SCREEN, enterFullScreenHandler); 82 enabler.addEventListener(StudioEvent.FULL_SCREEN_EXIT, exitFullScreenHandler); 83 84 12 MDE multi-direction expand 多方向展开 85 expanding.setLeftChild("child_left"); 86 expanding.setRightChild("child_right"); 87 getExpandedDirection()