It should be as easy as instantiating the class ( and adding it to a container). Just look up the class documentation and have a go.
I'm having no luck.
I have added the mobilecomponents.swc where I believe the DateSpinner lives and tried the following:
var dateSpinner:DateSpinner = new DateSpinner();
dateSpinner.selectedDate = new Date(2013, 10, 10);
dateSpinner.minDate=new Date(2000, 0, 1);
dateSpinner.maxDate=new Date(2014, 0, 1);
No luck as it just does not display.
If I add a DateChooser via mxml it works.
If I add it via actionscript - it does not appear and throws no errors like DateSpinner.
var dateChooser:DateChooser = new DateChooser();
This is called from a class extending MovieClip and is added to the stage already after the ADDED_TO_STAGE event is called.
OK, this is outside my experience.
I don't think you can mix Flex components directly with Flash UI components - think you may need to use UIMovieClip.
Ya, not as easy as it initially appears.
Hopefully there is someone out there who can verify this is possible or better yet - how to do it.
Why are you using MovieClips in a Flex project?
It is mostly an actionscript project but has an initial Flex layer that lets me use Flex components outside of the AS portions.
I can call up a Flex component added to that layer.
It is not ideal though so I am trying to find a better way to add Flex components from AS classes.
I was hoping there was going to be a better solution than this which I initiated a year ago.
Why use a MovieClip for your class rather than a Flex container?
I know very little about Flex.
Can I add a Flex container from actionscript and then load a Flex component into it?
Ideally if you have a project using Flex, you should use Flex components, so your class should be subclassing a Flex container, not a MovieClip (unless there's a specific reason for using a MovieClip ).
I really don't have enough spare time to do anything but give you a nod in the right direction.
Almost entirely this project is built in AS3.
I would love to keep it there but I am trying to add some Flex Components as the man in charge does not have them available directly through actionscript.
And now some I find are only available in Mobile ( DateSpinner ).
I try to use as few Flex Components as possible.
So although it is set to Flex, it is for the most part an AS project.
Also, there are a number of things drawn. I'm not sure how flex containers deal with this but i do know it works fine in AS using MovieClips.