This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The Document object is used to represent BSON documents | |
and queries to perform mongodb operations. An empty BSON | |
document is just a blank Document instance */ | |
var document:Document = new Document(); | |
/* Documents whose properties are all String and number | |
type values can be created inline using the Document | |
constructor, {"hello":"world", "type":"message"} is | |
written inline as below */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onDBConnected(db:DB):void | |
{ | |
/* First create a Credentials object using your username/password */ | |
var dbCredentials:Credentials = new Credentials("db_user_name", "db_user_password"); | |
/* Add callback handlers for authentication problems and authenticated | |
Signals objects */ | |
mongo.db("myDatabase").authenticationProblem.add(onAuthenticationProblem); | |
mongo.db("myDatabase").authenticated.add(onDBAuthenticated); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Add a handler to the connected Signal object to hook | |
in to when the database has established a connection */ | |
mongo.db("myDatabase").connected.add(_onDBConnected); | |
/* Call connect() to try a connection with mongodb */ | |
mongo.db("myDatabase").connect(); | |
/* The Signal handler must accept a DB object, it is | |
a referece to the mongo.db("myDatabase") object. */ | |
function onDBConnected(db:DB):void |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Creating a Mongo object requires you have the | |
domain to your mongodb server and the port number, | |
the default is 27017.*/ | |
var mongo:Mongo = new Mongo("your.mongo.com", 27017); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This example shows how you would set the scroll position of a scrollable | |
component to the max scroll position in Flex 3 and how it is handled in Flex 4. | |
// Flex 4 | |
// myView = Some view class. | |
// myScroller = s:Scroller | |
// myContentContainer = s:Group | |
var maxScrollPosition:Number = myView.myContentContainer.height - myView.myScroller.viewport.height; | |
myView.myScroller.viewport.verticalScrollPosition = maxScrollPosition; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The SkinnableItemRenderer is used exactly like s:ItemRenderer. The difference being SkinnableItemRenderer | |
allows you to use SkinPart metadata in your ItemRenderer definition. As a result of being able to skin the | |
item renderer, the autoDrawBackground capabilities are lost as the super class is no longer Group/GroupBase. | |
This is the only lost functionality in SkinnableItemRenderer. The example Flex project is in the repository, | |
which includes the examples below. | |
Example Application: | |
<?xml version="1.0" encoding="utf-8"?> | |
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" |
NewerOlder