header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
cf_flex
Points:240
Posts:0

8/18/2010 10:20:55 PM

Title: stepper with AM/PM


Hi all,

i need to show the AM / PM in a stepper ,is there any possibility
provide me with some sample code


thanks in advance...



1
Prestine
Points: 190
Posts:0
8/19/2010 1:53:23 AM



Hello,

Run this files at your end. For the buttons you can set the style as per your requirement. Hope this will be of some help to you.

1] main.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:local="*">

		<mx:Script>
			<![CDATA[
				import mx.controls.Alert;
					private function handleclick():void{
						Alert.show("value is = " + customStepper.textValue);
					}
			]]>
		</mx:Script>
	
		<local:CustomStepper id="customStepper"/>
		
		<mx:Button label="Get Value" click="handleclick()" />
	
</mx:Application>


2] CustomStepper.mxml

  <?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" horizontalAlign="center" 
				horizontalGap="0" verticalAlign="middle"
				width="50">
	<mx:Script>
		<![CDATA[
			
			private function handleUp() :void{
				txtInputObj.text	=	"PM";
			}
			
			private function handleDown() :void{
				txtInputObj.text	=	"AM";
			}
			
			public function get textValue():String{
				return txtInputObj.text;
			}
		]]>
	</mx:Script>
	
	<mx:TextInput id="txtInputObj" width="30" text="AM"/>
	<mx:VBox verticalGap="0" width="20">
		<mx:Button label="Up" click="handleUp()" height="12"/>
		<mx:Button label="Down" click="handleDown()" height="12" />
	</mx:VBox>
</mx:HBox>

2
Prestine
Points: 190
Posts:0
8/20/2010 12:32:01 AM



Hello,

Try this example also. Hope this solves your problem.

1] main.html

<?xml version="1.0"?>
<!-- Simple example to demonstrate the NumericStepper control. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:local="*">

      <local:MyNumericStepper  id="ns" />

</mx:Application>
       

2] MyNumericStepper.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:NumericStepper xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()">
			<mx:Script>
				<![CDATA[
					import mx.controls.Button;
					import mx.controls.TextInput;
					
					private var inputField:TextInput;
					private var nextButton:Button;
					private var prevButton:Button;
					
					private function init():void{
						mx_internal::inputField.text	=	"AM";
					}
					
					private function handleNext(event:MouseEvent):void{
						mx_internal::inputField.setFocus();
						mx_internal::inputField.text	=	"PM";
					}
					
					private function handlePrevious(event:MouseEvent):void{
						mx_internal::inputField.setFocus();
						mx_internal::inputField.text	=	"AM";
					}
					
					override protected function commitProperties():void{
            
        			 }
        			 override protected function createChildren():void {
			            super.createChildren();
			            mx_internal::inputField.restrict = null;
			           
			            mx_internal::nextButton.addEventListener(MouseEvent.CLICK, handleNext);
			            mx_internal::nextButton.addEventListener(MouseEvent.MOUSE_DOWN, handleNext);
			            mx_internal::prevButton.addEventListener(MouseEvent.CLICK, handlePrevious);
			            mx_internal::prevButton.addEventListener(MouseEvent.MOUSE_DOWN, handlePrevious);
        			}
        			
        			public function get stepperValue():String{
        				return  mx_internal::inputField.text;
        			}
					
				]]>
			</mx:Script>
</mx:NumericStepper>



Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 0+3 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions