re: [flexcoders] Find the value of a radiobutton in a radio group
I think I am finding that the problem is in the nextQuestionPlease() method. The reference to questionsVS is null and I can't figure out why. Here is the function: public function nextQuestionPlease():void { questionsVS.selectedIndex=currentQuestion; } Here is the viewStack: mx:ViewStack id=questionsVS width=98% height=100% paddingLeft=10 questions:question1 / questions:question2 / questions:question3 / questions:question4 / /mx:ViewStack In my init I set it to 0 and it appears how it should. How can I instantiate it? From: Wally Kolcz wko...@isavepets.com Sent: Monday, March 09, 2009 6:43 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Find the value of a radiobutton in a radio group I am trying to make a AIR app that is a test. I have radiobuttons with a value of either 0 or 1 depending on if its correct or not. I want to pass the value to a function that keeps score. I am running into a problem on determining the value of the passed question to see if the app should add a 1 to the score or not. I keep getting 'Error #1069: Property value not found on Number and there is no default value.' when I click the button. Here is my radiobuttongroup: mx:Label fontWeight=bold text=1. Which layer(s) of the OSI Reference Model provide(s) for internetwork connectivity? / mx:RadioButtonGroup id=group1 / mx:RadioButton paddingLeft=10 groupName=group1 label=Data Link value=0 selected=true / mx:RadioButton paddingLeft=10 groupName=group1 label=Physical value=0 / mx:RadioButton paddingLeft=10 groupName=group1 label=Session value=0 / mx:RadioButton paddingLeft=10 groupName=group1 label=Network value=1 / mx:RadioButton paddingLeft=10 groupName=group1 label=Presentation value=0 / mx:Button label=Next click=testMod.checkSingle(group1.selectedValue) / Here is my function: public function checkSingle(answer:Object):void { if (answer.value !=0) { Application.application.score += 1; } nextQuestionPlease(); } How can I get it to find the value and determine if it should add 1 or not. Thanks.
RE: [flexcoders] Find the value of a radiobutton in a radio group
It is my strong preference that anyone asking a question about an error post the entire stacktrace. It is like a fingerprint and makes it much faster for me and others to identify problems. In the original post, you are using selectedValue as the parameter which will be 0 or 1, not the radiobutton itself. The rb should be in the rbg's selection property Alex Harui Flex SDK Developer Adobe Systems Inc.http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Wally Kolcz Sent: Monday, March 09, 2009 8:12 AM To: flexcoders@yahoogroups.com Subject: re: [flexcoders] Find the value of a radiobutton in a radio group I think I am finding that the problem is in the nextQuestionPlease() method. The reference to questionsVS is null and I can't figure out why. Here is the function: public function nextQuestionPlease():void { questionsVS.selectedIndex=currentQuestion; } Here is the viewStack: mx:ViewStack id=questionsVS width=98% height=100% paddingLeft=10 questions:question1 / questions:question2 / questions:question3 / questions:question4 / /mx:ViewStack In my init I set it to 0 and it appears how it should. How can I instantiate it? From: Wally Kolcz wko...@isavepets.com Sent: Monday, March 09, 2009 6:43 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Find the value of a radiobutton in a radio group I am trying to make a AIR app that is a test. I have radiobuttons with a value of either 0 or 1 depending on if its correct or not. I want to pass the value to a function that keeps score. I am running into a problem on determining the value of the passed question to see if the app should add a 1 to the score or not. I keep getting 'Error #1069: Property value not found on Number and there is no default value.' when I click the button. Here is my radiobuttongroup: mx:Label fontWeight=bold text=1. Which layer(s) of the OSI Reference Model provide(s) for internetwork connectivity? / mx:RadioButtonGroup id=group1 / mx:RadioButton paddingLeft=10 groupName=group1 label=Data Link value=0 selected=true / mx:RadioButton paddingLeft=10 groupName=group1 label=Physical value=0 / mx:RadioButton paddingLeft=10 groupName=group1 label=Session value=0 / mx:RadioButton paddingLeft=10 groupName=group1 label=Network value=1 / mx:RadioButton paddingLeft=10 groupName=group1 label=Presentation value=0 / mx:Button label=Next click=testMod.checkSingle(group1.selectedValue) / Here is my function: public function checkSingle(answer:Object):void { if (answer.value !=0) { Application.application.score += 1; } nextQuestionPlease(); } How can I get it to find the value and determine if it should add 1 or not. Thanks.
RE: [flexcoders] Find the value of a radiobutton in a radio group
That part seems to work fine no that I went through the debugging values. Its a null reference which ties to the questionsVS viewstack. Here is the error for that. TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.ipexpert.tests::test1/nextQuestionPlease()[D:\wkolcz\My Documents\Flex Builder 3\IPExpertBrainBuster\src\com\ipexpert\tests\test1.mxml:49] at com.ipexpert.tests::test1/checkSingle()[D:\wkolcz\My Documents\Flex Builder 3\IPExpertBrainBuster\src\com\ipexpert\tests\test1.mxml:22] at com.ipexpert.questions.q1::question1/___question1_Button1_click()[D:\wkolcz\My Documents\Flex Builder 3\IPExpertBrainBuster\src\com\ipexpert\questions\q1\question1.mxml:21] thiscom.ipexpert.tests.test1 (@872c0a1) [inherited] _1087624319currentQuestion1 _964308170questionsVSnull currentQuestion1 _documentDescriptor_mx.core.UIComponentDescriptor (@872e629) questionsVSnull testID1 From: Alex Harui aha...@adobe.com Sent: Monday, March 09, 2009 8:21 AM To: flexcoders@yahoogroups.com flexcoders@yahoogroups.com Subject: RE: [flexcoders] Find the value of a radiobutton in a radio group It is my strong preference that anyone asking a question about an error post the entire stacktrace. It is like a fingerprint and makes it much faster for me and others to identify problems. In the original post, you are using selectedValue as the parameter which will be 0 or 1, not the radiobutton itself. The rb should be in the rbg's selection property Alex Harui Flex SDK Developer Adobe Systems Inc. Blog: http://blogs.adobe.com/aharui From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Wally Kolcz Sent: Monday, March 09, 2009 8:12 AM To: flexcoders@yahoogroups.com Subject: re: [flexcoders] Find the value of a radiobutton in a radio group I think I am finding that the problem is in the nextQuestionPlease() method. The reference to questionsVS is null and I can't figure out why. Here is the function: public function nextQuestionPlease():void { questionsVS.selectedIndex=currentQuestion; } Here is the viewStack: mx:ViewStack id=questionsVS width=98% height=100% paddingLeft=10 questions:question1 / questions:question2 / questions:question3 / questions:question4 / /mx:ViewStack In my init I set it to 0 and it appears how it should. How can I instantiate it? From : Wally Kolcz wko...@isavepets.com Sent: Monday, March 09, 2009 6:43 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Find the value of a radiobutton in a radio group I am trying to make a AIR app that is a test. I have radiobuttons with a value of either 0 or 1 depending on if its correct or not. I want to pass the value to a function that keeps score. I am running into a problem on determining the value of the passed question to see if the app should add a 1 to the score or not. I keep getting 'Error #1069: Property value not found on Number and there is no default value.' when I click the button. Here is my radiobuttongroup: mx:Label fontWeight=bold text=1. Which layer(s) of the OSI Reference Model provide(s) for internetwork connectivity? / mx:RadioButtonGroup id=group1 / mx:RadioButton paddingLeft=10 groupName=group1 label=Data Link value=0 selected=true / mx:RadioButton paddingLeft=10 groupName=group1 label=Physical value=0 / mx:RadioButton paddingLeft=10 groupName=group1 label=Session value=0 / mx:RadioButton paddingLeft=10 groupName=group1 label=Network value=1 / mx:RadioButton paddingLeft=10 groupName=group1