![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Nov 2007
Posts: 388
OS: Mac OS X 10.5.7 and XP SP2
|
Actionscript problem with resizing video object resolutio
Hi,
I have a problem with my AS3 code. The user can type their desired width and height for the video in two boxes and hit a button that triggers the updateResolution function. Everything works except for when I redeclare video = new Video() in the updateResolution function, the variables that the user set don't register. If I manually say: video = new Video(1024,768); it works fine, but for some reason the vars don't have the same effect... video = new Video(setWidth, setHeight); Does anyone have any suggestions? Thanks!!! Code:
//Initial vars for resolution
var setWidth:int = 800;
var setHeight:int = 600;
//Display the webcam feed on the screen
var cam:Camera = Camera.getCamera();
var video:Video = new Video(800, 600);
video.width = 320; //Changing it on the screen only so it fits
video.height = 240; //The actual resolution remains 800x600
cam.setMode(800, 600, 15, true);
video.attachCamera(cam);
stage.addChild(video);
video.x = 320;
//updateRes is my button, of course
updateRes.addEventListener(MouseEvent.MOUSE_DOWN, updateResolution);
function updateResolution(e:MouseEvent):void{
setWidth = Number(userWidth.text); //userWidth and userHeight are the text inputs
setHeight = Number(userHeight.text);
cam.setMode(setWidth, setHeight, 15, true); //This works fine with the setWidth/setHeight vars
stage.removeChild(video);
video = new Video(setWidth, setHeight); //This does not
video.width = 320;
video.height = 240;
video.attachCamera(cam);
stage.addChild(video);
video.x = 320;
}
|
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,879
OS: Vista, various linux distros
|
Re: Actionscript problem with resizing video object resolutio
Why not just allow people to re-size the window without using numeric values? (sorry i don't really know the situation so it doesn't matter).
Anyway, instead of "Number(userWidth/Height.text);" try using: Code:
parseInt(userWidth/Height.text); .... Or try and delete the video object before re-setting it ("delete video").... just because you should probably unload the object. Post back with more info... Cheers, Jamey |
|
|
|
|
|
#3 (permalink) |
|
Registered User
Join Date: Nov 2007
Posts: 388
OS: Mac OS X 10.5.7 and XP SP2
|
Re: Actionscript problem with resizing video object resolutio
Thanks for the reply, I'll give those a shot tomorrow.
I thought parseInt was exclusive to javascript and Number() was its actionscript equivalent. I already tried "delete video;" but it wouldn't let me. I haven't tried new Number yet. By the way, this is an AIR application that allows people to take a snapshot using their webcam. The video.width and video.height adjust the video object displayed on the screen (the preview window in the GUI is always 320x240) but the actual Video(width, height) dimensions remain behind the scenes and make up the actual resolution when the picture is taken and saved to the user's desktop. Thanks again, I'll post back soon with the results. |
|
|
|
|
|
#4 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,879
OS: Vista, various linux distros
|
Re: Actionscript problem with resizing video object resolutio
The parseInt function is a core ECMAScript(/Javascript) function, Actionscript is based on ECMAScript so all the core functions are still applicable (parseInt, setInterval/setTimeout). etc. Just the client-side JS code isn't (you can't go using the document object in AS).
http://www.adobe.com/support/flash/a...ionary621.html "Number(*)" creates a new Number object, hence if the new operator is used it may help. Anyway, try it out and see what happens, post back with your results. Cheers, Jamey |
|
|
|
|
|
#5 (permalink) |
|
Registered User
Join Date: Jan 2009
Posts: 4
OS: Windows Vista Home Premium SP1 64 bit addition
|
Re: Actionscript problem with resizing video object resolutio
I have the same problem as FredT, I am trying to destroy the initial video from my web cam and change the output resolution of the image. Is there a way I can dynamically alter the image size?
|
|
|
|
|
|
#6 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,879
OS: Vista, various linux distros
|
Re: Actionscript problem with resizing video object resolutio
Maybe you could put the video object in a parent movie clip(_root.createEmptyMovieClip) and use the removeMovieClip() function?
Anyway i have another one for you fredT, video could be a reserved word (well "Video" is of course)... i'm really just throwing out ideas right now. |
|
|
|
|
|
#7 (permalink) |
|
Registered User
Join Date: Jan 2009
Posts: 4
OS: Windows Vista Home Premium SP1 64 bit addition
|
Hi guys!
I made a site using freewebs and now it put viruses all over my computer!!! can you help me change my LINKS? so that i don't spread my viruses to my friends!!??? thank you so much
|
|
|
|
|
|
#9 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,879
OS: Vista, various linux distros
|
Re: Actionscript problem with resizing video object resolutio
I can help your understanding a little. Freewebs does not download anything to your pc or use anything volatile so it's not the reason for the viruses... Also Freewebs have a long standing reputation to uphold so i know they wouldn't start going that way...
Anyway, go to the Virus help forum and read the instructions there, someone will help you out. Cheers, Jamey |
|
|
|
![]() |
| Thread Tools | |
|
|