Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8069433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:00:57+00:00 2026-06-05T13:00:57+00:00

I do not really know much in regard to Flash or Action Scripts but

  • 0

I do not really know much in regard to Flash or Action Scripts but I have been having a bit of trouble with AS3 and webcams. I have a script that connects to a webcam and then sends its output to a php script that saves the captured image. This works all except for one problem. It seems that the maximum resolution allowed for the actual Camera object is 320×240. I went to the extreme of hooking a Canon 60D up as a webcam because I have a normal webcam that is supposed to have max resolution of 1280×720 and all I can get is a 320×240 image from it. What I have found so far is the max I can get out of the Canon is also 320×240. Maybe I have been looking at this to long but I am stumped. Below is a sample of the action script where videoCapture should be 1024×768. What happens instead is a 1024×768 image is created with a black background and in the top left is a 320×240 image from videoCapture. I could obviously resize this but that would defeat the purpose being poor quality. Is there something I am missing here or maybe some limitation of Flash even?

// adds event listener to the stage for keydown events.
stage.addEventListener(KeyboardEvent.KEY_DOWN, detectEnterKey);

import flash.display.Bitmap;
import flash.display.BitmapData;
import com.adobe.images.JPGEncoder;
import flash.ui.Keyboard;
import flash.events.KeyboardEvent;

var bandwidth:int = 0;
var quality:int = 100; 

var cam:Camera = Camera.getCamera();

var videoCapture:Video = new Video();

var previewPortData:BitmapData = new BitmapData(1024, 768, true, 0x00000000);
var previewPort:Bitmap = new Bitmap(previewPortData);

function onCameraStatus(evt):void {
  if (evt.code == "Camera.Muted") {
    Security.showSettings(SecurityPanel.CAMERA);
  }
}

// detects the keycode looking for enter key pressed.
function detectEnterKey(event:KeyboardEvent):void {
  //trace("keycode: "+event.keyCode);
  if (event.keyCode == Keyboard.ENTER) {
    previewPortData.draw(videoCapture);
    var myEncoder:JPGEncoder = new JPGEncoder(100);
    var byteArray:ByteArray = myEncoder.encode(previewPortData);
    var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream");
    var saveJPG:URLRequest = new URLRequest("save.php");
    saveJPG.requestHeaders.push(header);
    saveJPG.method = URLRequestMethod.POST;
    saveJPG.data = byteArray;
    var urlLoader:URLLoader = new URLLoader();
    urlLoader.addEventListener(Event.COMPLETE, sendComplete);
    urlLoader.load(saveJPG);

    function sendComplete(event:Event):void {
      trace("compete");
    }   
  }
}

if (cam == null) {

  Security.showSettings(SecurityPanel.CAMERA);

} else {

  cam.addEventListener(StatusEvent.STATUS, onCameraStatus)
  cam.setQuality(bandwidth, quality);
  cam.setMode(1024, 768, 30, false);

  videoCapture.attachCamera(cam);
  videoCapture.width = 1024;
  videoCapture.height = 768;
  addChild(videoCapture);

  previewPort.x = 430;
  previewPort.y = 50;
  addChild(previewPort);

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T13:00:59+00:00Added an answer on June 5, 2026 at 1:00 pm

    I also just had this problem. Solved it by including the width and height parameters when creating the Video object instead of setting them afterwards via Video.height and Video.width. Once i did that, all bitmapData taken from that video was correctly sized.

    This is how i originally created the video that did not work (looked fine, but resulted in incorrectly sized bitmaps):

    var vid = new Video();
    vid.width = 640;
    vid.height = 480;
    ...
    

    This worked (bitmaps from this video were correctly sized):

    var vid = new Video(640, 480);
    ...
    

    Would love to know why the first way doesn’t work. Maybe that’s the bug mentioned above. (I didn’t have access to that site so couldn’t see it.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this question is not really important.. however I've been wondering: Which of
I know this is possible but I'm not really sure where to start. Has
I am sorry for the title but I really do not know how to
I have a little problem about using jQuery (I really do not know jQuery
I know this might seem a controversial question but it really is not meant
I know this probably really simple but Im not sure what im doing wrong...
I have built a horizontal scrolling website. I don't really know much about Java
I have been developing and tweaking things as much as I can and know
I don't really know much about the internals of compiler and JIT optimizations, but
I am a web designer, and dont really know much about PHP. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.