BBFlash

BBFlash is mapped to flash file, which used to get framerate, flash version and create movie clip.


                    ...
                   //load flash file
                    BBFlash flash = BBFlashFactory.LoadFlash ("flashs/demo-swf.bytes");
            
                    //check the flash version
                    CCDebug.Log ("Flash version:{0}", flash.flashVersion);
            
                    //check the frame rate
                    CCDebug.Log ("Frame rate:{0}", flash.frameRate);
            
                    //create movie clip from flash
                    BBFlashMovie demo = flash.cteMovie ("wizard");
                    ...
					
BBFlashMovie

BBFlashMovie is mapped to movie clip of flash.


                    ...
                    //create movie clip from flash
                    BBFlashMovie demo = flash.createMovie ("wizard");
                    
                    //set loop mode, default value is true
                    demo.loop = true;
            
                    //set fps, default value is same with flash file.
                    demo.fps = 60;
                    
                    //play whole movie
                    demo.play ();
            
                    //play movie with specify frame
                    demo.gotoAndPlay (0, 90);
            
                    //play movie with specify label
                    demo.gotoAndPlay ("wait_start", "wait_end");
                    
                    //get the bounds of movie clip
                    CCDebug.Log ("Bounds is {0}", demo.bounds);
                    
                    //set the tween mode. 
                    //The default mode is SkipNoLabelFrames which will skip frames withtout label if needed. 
                    demo.tweenMode = kTweenMode.SkipNoLabelFrames;
                    
                    //set the frame event mode. Let's talk later.
                    demo.frameEventMode = kFrameEventMode.LabelFrame;
                    ...
					
Flash Events

1. Callback after movieclip played.


                    ...
                    //play movie with a callback
                    demo.play (onMovieClipEnded);
                    ...
                    
                    void onMovieClipEnded(BBFlashMovie mc){
                        CCDebug.Log ("The movie is finished now.");
                    }
					

2. Callback when playing movieclip.


                    ...
                    //only frames which has label will pop up a event.
                    demo.frameEventMode = kFrameEventMode.LabelFrame;
            
                    //all frames will pop up a event.
                    demo.frameEventMode = kFrameEventMode.EveryFrame;
                    
                    //play movie with a callback
                    //regist frame event listener. Tip: all children of movie will pop up its event.
                    demo.frameListener = delegate(BBFlashMovie obj) {
                        if(obj == demo && obj.currentLabel == "mov_start"){
                            CCDebug.Log ("The movie is start to mov.");
                        }
                    });
                    ...