~~NOTOC~~ ====== Fluocam ====== ---- dataentry extension ---- author_mail : emmanuel.gomez@fluocode.com esdebon description : Virtual camera for Starling and Mobile Devices lastupdate_dt : YYYY-MM-DD # the date you created the extension compatible : v1.1 # the Starling version you tested the extension with depends : # if the ext. depends on others, list them here tags : virtual camera, virtual cam, camera, cam, fluocode, fluocam homepage_url : https://github.com/Fluocode/Fluocam download_url : https://github.com/Fluocode/Fluocam/archive/master.zip ---- ===== Preview ===== Download Example: https://github.com/Fluocode/Fluocam/releases/download/0.8/sample.zip **Zoom**: CTRL + MOUSE DRAG **Move target cam**: On static bird drag the mouse wmode direct ===== Installation ===== a. If you’re using a Starling swc, you’ll need to create a starling.extensions package in your src folder. starling/extensions/fluocode/Fluocam/Fluocam.as starling/extensions/fluocode/FluocamControl.as ===== Implementation ===== import starling.extensions.fluocode.Fluocam; import starling.extensions.fluocode.FluocamControl; starling.simulateMultitouch = true; var cam:Fluocam = new Fluocam(world,480,320, false); addChild(cam); **The params in the constructor are:** Fluocam(world:Sprite, widthScene:Number=0, heightScene:Number=0, test:Boolean=true, explorer:Sprite=null, dragAndZoom:Boolean=true) Where: * **world**. - Is a Sprite that content all the objects to explore with the camera. * **widthScene** .- scene's width. * **heightScene** .- scene's height * **test**.- Show a picture to see the current position of the target camera (requires remove comments in Fluocam.as) * **explorer**.- Is a object in "your world" used like a "explorer" is recommendable keep null this value. * **dragAndZoom**.- Is a flag to activate or deactivate the "Explore Mode" (drag to move the camera and zoom gesture) ===== Methods ===== public function working(sw:Boolean=true):void cam.working(true) // Turn on the camera cam.working(false) // Turn off the camera //// The camera is working when since is add to the stage public function **changeTarget**(camTarget:Sprite, toMark:Sprite=null, refreshRate:int=1):void cam.changeTarget(objectInTheWorld) // Change the target to the sprite "objectInTheWorld" public function **goToTarget**(explorer:Sprite, toMark:Sprite=null, controlTo:Sprite=null):void cam.goToTarget(objectInTheWorld); // Go with a smooth move to the sprite "objectInTheWorld" public function **targetToTarget**(trgO:Sprite,trg:Sprite):void cam.targetToTarget(objectInTheWorld, otherObjectInTheWorld) //Move the camera from the first object to the second object public function **zoomToTarget**(zoom:Number,durationZoom:Number):void cam.zoomToTarget( 5.2, 1.5 ) // Zoom in the current position to scale 5.2 in 1.5 seconds public function **explore**():void cam.explore(); //Move the camera on the current target position and then give the control to the camera ===== Changelog ===== * //2013/12/04 19:26//: First public version ===== Source Code ===== %gist(7794184)% ===== User Comments ===== I hope you find it useful