问题
I am unable to use DateSpinner component in my flex mobile application. I am only interest to print date but not time. How can I achieve this in my flex mobile project. Platform is Flash Builder 4.6.
<s:HGroup verticalAlign="middle">
<s:SpinnerListContainer>
<s:DateSpinner id="dt" />
</s:SpinnerListContainer>
</s:HGroup>
The above code gives following error. TypeError: Error #1009: Cannot access a property or method of a null object reference. DateSpinner.as:1290
回答1:
In the example code for the DateSpinner control, they are not wrapping it in a SpinnerListContainer. So perhaps that's your problem. Have you tried the DateSpinner by itself?
It appears to me that the SpinnerListContainer is intended to be used with a SpinnerList control. And that SpinnerList is for more generic lists, while DateSpinner is a stand alone component used specifically for dates/times.
回答2:
The given code doesn't work when displayMode property is set to "date" only.
<s:DateSpinner id="ds"
selectedDate="{new Date(2010, 11, 15)}"
minDate="{new Date(2000, 0, 1)}"
maxDate="{new Date(2200, 11, 31)}"
minuteStepSize="5" displayMode="date" />
when I use <s:DateSpinner id="dt" displayMode="dateAndTime" /> its works fine but it do not works when I set displayMode="date"
even the simplest form to dataspinner gives error, like you use
<s:DateSpinner id="ds" />
回答3:
i've the same problem. After debugging the as-code i found a problem with determine the textsize. So i look at my console output i found this warning: This component requires that the embedded font be declared with embedAsCFF=false.
Thereafter i configured my Font-Style:
@font-face {
src: url("assets/Sintony-Regular.ttf");
fontFamily: Sintony-Regular;
advancedAntiAliasing: true;
embedAsCFF: false;
embed-as-cff: flase;
font-lookup: embeddedCFF;
fontWeight: normal;
}
s|DateSpinner {
font-family: Sintony-Regular;
}
Now my DateSpinner works. But many other components gives the warning: This component requires that the embedded font be declared with embedAsCFF=true. It's not a fully solution, but a beginning. Mybe i have to use different font-face declarations.
Hope it works for you, too
来源:https://stackoverflow.com/questions/18560650/using-date-spinner-in-flex-mobile-application