1 Replies - 1482 Views - Last Post: 30 May 2012 - 10:26 AM

#1 leixnt  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 30
  • Joined: 24-July 11

Flash File & ActionScript File Question

Posted 29 May 2012 - 07:33 AM

firstly, iam really fresh using flash AS
im interested creating Augmented Reality from this link tutorial
http://www.adobe.com...ed_reality.html

this is snippets code from that link (i success to create augmented use that tutorial) use Adobe Flash CS4
package {
      
    import flash.display.BitmapData;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.media.Camera;
    import flash.media.Video;
    import flash.utils.ByteArray;
    
    import org.libspark.flartoolkit.core.FLARCode;
    import org.libspark.flartoolkit.core.param.FLARParam;
    import org.libspark.flartoolkit.core.raster.rgb.FLARRgbRaster_BitmapData;
    import org.libspark.flartoolkit.core.transmat.FLARTransMatResult;
    import org.libspark.flartoolkit.detector.FLARSingleMarkerDetector;
    import org.libspark.flartoolkit.pv3d.FLARBaseNode;
    import org.libspark.flartoolkit.pv3d.FLARCamera3D;
    
    import org.papervision3d.lights.PointLight3D;
    import org.papervision3d.materials.shadematerials.FlatShadeMaterial;
    import org.papervision3d.materials.utils.MaterialsList;
    import org.papervision3d.objects.parsers.DAE;
    import org.papervision3d.objects.primitives.Cube;
    import org.papervision3d.render.BasicRenderEngine;
    import org.papervision3d.scenes.Scene3D;
    import org.papervision3d.view.Viewport3D;
    
    public class AugmentedReality extends Sprite
    {
        
        private var video : Video;        
        private var webcam : Camera;    

        private var flarBaseNode : FLARBaseNode;        
        private var flarParam : FLARParam;
        private var flarCode : FLARCode;
        private var flarRgbRaster_BitmapData : FLARRgbRaster_BitmapData;
        private var flarSingleMarkerDetector : FLARSingleMarkerDetector;
        private var flarCamera3D : FLARCamera3D;        
        private var flarTransMatResult : FLARTransMatResult;
        private var bitmapData : BitmapData;
        private var FLAR_CODE_SIZE : uint         = 16;
        private var MARKER_WIDTH : uint         = 80;

        
        [Embed(source="./assets/FLAR/FLARPattern.pat", mimeType="application/octet-stream")]
        private var Pattern : Class;
        
        [Embed(source="./assets/FLAR/FLARCameraParameters.dat", mimeType="application/octet-stream")]
        private var Params : Class;
        private var basicRenderEngine : BasicRenderEngine;
        private var viewport3D : Viewport3D;        
        private var scene3D : Scene3D;
        private var collada3DModel : DAE;
        private var VIDEO_WIDTH : Number = 640;  //Set 100 to 1000 to set width of screen
        private var VIDEO_HEIGHT : Number = 480;  //Set 100 to 1000 to set height of screen
        private var WEB_CAMERA_WIDTH : Number = VIDEO_WIDTH/2;  //Smaller than video runs faster
        private var WEB_CAMERA_HEIGHT : Number = VIDEO_HEIGHT/2;  //Smaller than video runs faster
        private var VIDEO_FRAME_RATE : Number = 30;  //Set 5 to 30. Higher values = smoother video
        private var DETECTION_THRESHOLD : uint  = 80;  //Set 50 to 100. Set to detect marker more accurately.
        private var DETECTION_CONFIDENCE : Number = 0.5;  //Set 0.1 to 1. Set to detect marker more accurately.
        private var MODEL_SCALE : Number = 0.8;  //Set 0.1 to 5. Set higher to enlarge model
        
        private var COLLADA_3D_MODEL : String = "./assets/models/licensed/hummer/models/hummer.dae";
        
        public function AugmentedReality()
        {
            prepareWebCam();
            prepareMarkerDetection();
            preparePaperVision3D();




but my question is, everytime i play movie
it start automatically to detect webcam
public function AugmentedReality()
        {
            prepareWebCam();



oh yeah, all that code above i write on AugmentedReality.as
can i use flash file (.fla) to load first (on my form has 2 button) so, after click one button, it goes to prepare webcam function?

Is This A Good Question/Topic? 0
  • +

Replies To: Flash File & ActionScript File Question

#2 BenignDesign  Icon User is offline

  • holy shitin shishkebobs
  • member icon




Reputation: 6018
  • View blog
  • Posts: 10,444
  • Joined: 28-September 07

Re: Flash File & ActionScript File Question

Posted 30 May 2012 - 10:26 AM

If you only want the code to play a movie, why are you asking it to prepare the webcam?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1