Lets say you want to call a remote function with Flex’s RemoteObject and in the Response Handler you wish to access some of the variables you used in your calling function. You could use class variables so that they are available in your Response Handler. But thats not always the preferred way.
Another option that I like to use is to define the response handler in your calling Method as a closure. That way you will have access to all variables that are in the scope of the calling method in your handler function.
Here is an example on how to achieve this:
public function callRemoteMethod( myvar:String ):void {
myRemoteObject.myRemoteFunction( myvar ).addResponder(
new ItemResponder(
function(re:ResultEvent, a:AsyncToken ):void {
//the resonder has access to myar
trace(myvar ) ; trace(re.result) ;
},
function(f:FaultEvent, a:AsyncToken):void {
Alert.show(‘An Error occurred’) ;
}
)
) ;
}
I created a simple Joomla! component. It’s purpose is to demonstrate how a Flex Application can be integrated into a component. The Flex Application is communicating with its Joomla! backend through AMFPHP. AMFPHP1.9 is included in this example setup.
You can download and install this component via the Joomla Administration Interface and link a menu item to it, to see it in action.
You can also download the source code for the simple Flex Application to see how it connects to the gateway.
download flex example source code
The Email Validator’s static method validateEmail requires 3 parameters according to the Flex 3.2 API Documentation:
Parameters
validator:EmailValidator — The EmailValidator instance. |
|
value:Object — A field to validate. |
|
baseField:String — Text representation of the subfield specified in the value parameter. For example, if the value parameter specifies value.email, the baseField value is “email”. |
I’m wondering why it is that I have to specify the actual String value of my textfield as value parameter and then also have to specify “text” as baseField.
I would have thought as value I should specify mytextfield and as baseField “text” as it is done in all other places. I find that confusing.
But this method will only work when used like this for example:
var result:Array = EmailValidator.validateEmail( myemailvalidator , mytextfield.text , “text” ) ;
Ever had to choose a new secure password but couldn’t think of anything and ended up using the same old insecure password as always?
Well here is the solution. It comes in form of a little Unix/Linux programm, called pwgen. It automatically generates difficult passwords that are designed to be easily memorized by humans.
This Flex Application is a frontend for pwgen. You can use it to generate as many passwords as you like.
I recently ran into problems when trying to set the currenState property on a component that was part of a TabNavigator.
I had the component as a direct child in the TabNavigator.
Setting the currentState property in the component resulted in Null pointer exceptions in the Flex Framework – RemoveChild Class.
I got around it by first adding a canvas to my TabNavigator and then adding my component inside the canvas. This fixed the problem.
It is because of flex’s deferred instantiation. Flex called the creationComplete handler on my custom component even though its components were not added yet.
Thats why the RemoveChild tag in my states failed.
By first embedding the component into a canvas and then into the TabNavigator, it only created the canvas but not any parts of my component.
A list of the best libraries for Flex and Flash that can save heaps of development time and add extra functionality to your projects.
If you use ant to build and deploy your application,
the scp task comes in quite handy to automatically upload you project to the production server.
In your ant build.xml file you can add a line like this to your target
<scp file=”${zipfile}” todir=”${server.username}:${server.password}@${server.name}:” trust=”true” />
Where ${zipfile}, ${server.username}, etc are properties that where earlier declared
e.g. <property name=”server.name” value=”192.168.0.1″ />
The ant scp task depends on an external library that can be found here.
You need to download the jsch-0.1.42.jar and copy it into your eclipse ant library folder
e.g. /Applications/Adobe\ Flex\ Builder\ 3/plugins/org.apache.ant_1.7.0.v200706080842/lib/
(on mac I had to copy this file to ~/.ant/lib to work )
Important! You need to restart Flex Builder after that.
After that you can run your ant target and the zip file will be uploaded to your server through scp
Flashplayer is using a separate cache to store remote shared libraries ( RSL ) .
It wont be cleared by just emptying the browser cache.
To clear the flashplayer cache go to:
http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager03.html
Uncheck the checkbox: “Store common Flash components to reduce download times”
This will delete the Flashplayer Cache.
After that check it again and done