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:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* 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
Go Back   Tech Support Forum > Design Forum > Web Design & Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Web Design & Programming Discussion of web design, and server-side & client-side scripting

Reply
 
LinkBack Thread Tools
Old 01-11-2009, 03:32 PM   #1 (permalink)
Registered User
 
FredT's Avatar
 
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;
}
FredT is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
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

Old 01-11-2009, 06:01 PM   #2 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
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 "new Number..."
....

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
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 01-11-2009, 09:09 PM   #3 (permalink)
Registered User
 
FredT's Avatar
 
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.
FredT is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 01-12-2009, 05:21 AM   #4 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
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
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 01-12-2009, 06:53 PM   #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?
klbricks is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 01-13-2009, 03:16 AM   #6 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
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.
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-21-2009, 07:40 PM   #7 (permalink)
Registered User
 
Join Date: Jan 2009
Posts: 4
OS: Windows Vista Home Premium SP1 64 bit addition


Smile Re: Actionscript problem with resizing video object resolutio

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
klbricks is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-21-2009, 07:44 PM   #8 (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

COME ON GUYS!!! cant anyone HELP me!!!!!!!!!!!
klbricks is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-22-2009, 06:10 AM   #9 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
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
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 04:37 AM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85