Archive

Archive for the ‘Adobe Flash’ Category

Flex Random Password Generator

June 26th, 2010 Erich Cervantez 4 comments

Here’s a nice static method for creating random passwords…should the need ever arise ;)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public static function generateRandomPassword( length:int = 7 ) : String
{
	//characters to use in password
	var _salt : String = "abchefghjkmnpqrstuvwxyz0123456789ABCHEFGHJKMNPQRSTUVWXYZ";
 
	//initialize vars
	var _password : String = '';			
	var _i:Number = 0;
 
	//loop 
	while ( _i <= length )
	{
		var _num : Number = Math.random() * _salt.length;
		_password += _salt.charAt( _num );
		_i++;
	}
 
	return _password;
}

Enjoy!

Categories: Adobe Flash, Adobe Flex Tags:

Apple vs Adobe Peace Plan from InfoWorld

May 10th, 2010 Erich Cervantez No comments

InfoWorld has published a four-point “peace plan” aimed at reducing collateral damage from the current Apple vs Adobe war.

The article discusses the history between the two companies, outlines a compromise and allows readers to vote on the proposal.

http://www.infoworld.com/print/122878

Categories: Adobe Flash, General Tags:

The Future of Web Content – HTML5, Flash & Mobile Apps

I didn’t get a chance to read this article back in February by ColdFusion-mastermind Jeremy Allaire, but it’s a good one nevertheless and still very relevant for those of us in the Flash community.

Give it a try:
The Future of Web Content – HTML5, Flash & Mobile Apps

Categories: Adobe Flash, General Tags:

Flex 4 & ColdFusion 9 Remoting Recap

December 29th, 2009 Erich Cervantez No comments

It’s been a couple of years since I worked with ColdFusion and Flex together, but I remember I always like the combination and chose it for my new little Xuland social networking project I’ve been working on (see previous posts).

I had to remember how the whole Flex-ColdFusion remoting setup would work again and I had to overcome a couple of hurdles. I thought I’d share the experience as it would have helped me get up to speed quickly.

Here’s a quick recap of setting up your Flex application to remote to ColdFusion:

  1. Install ColdFusion (I installed mine to the default C:\ColdFusion9 directory)
  2. In FlexBuilder, create a new Flex project
  3. While creating the project, select an Application server type of “ColdFusion” and check the “Use remote object access service” with the “ColdFusion Flash Remoting” option selected.
    .
    servertechnology
  4. On the next screen, in my case I’m using a Standalone installation and had to uncheck the “Use default location for local ColdFusion server”. Of course, the root folder was C:\ColdFusion9. I clicked Validate Configuration which validated that the root folder existed.
    .
    serverlocation
  5. I happen to use ColdFusion primarily for access to a MySQL datasource, so I had to setup the datasource in the ColdFusion admin first (this information should be readily available anywhere)
  6. Once the datasource was setup, I first created a value-object (VO) in ColdFusion to represent the object (in this case, a User) I wanted to pass back to the Flex application
    .
    UserVO.cfc:

    1
    2
    3
    4
    5
    
    <cfcomponent output="false" alias="com.xyz.coldfusion.vo.UserVO">
    	<cfproperty name="userID" type="numeric"/>
    	<cfproperty name="username" type="string"/>
    	<cfproperty name="password" type="string"/>
    </cfcomponent>
  7. After the VO, I created a data-access object (DAO) to query the datasource for a user and return a UserVO to the calling Flex application
    .

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    <cfcomponent output="yes">
    	<cffunction name="getUserByID" 
    		access="remote" 
    		returntype="com.xyz.coldfusion.vo.UserVO">
     
    		<cfargument name="userID" type="numeric" required="yes"> 
     
    		<cfquery name="getUser" datasource="xuland">
            	SELECT * 
    		FROM tblUsers
    		WHERE userID = '#userID#'
    		</cfquery>
     
    		<cfreturn getUser>
     
    	</cffunction>
    </cfcomponent>
  8. Back in the Flex project, I setup my RemoteObject tag to point towards the ColdFusion DAO component I created in the last step:
    .

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    <!-- Remote Services -->
    <mx:RemoteObject id="userService"
    	 destination="ColdFusion"
    	 source="com.xyz.coldfusion.dao.UserDAO"
    	 showBusyCursor="true">
     
    	<mx:method name="getUserByID" 
    		   result="resultHandler(event)" 
    		   fault="faultHandler(event)"/>
     
    </mx:RemoteObject>
  9. Create your result and fault handlers (here we just display an Alert)
    .

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    <fx:Script>
    	<![CDATA[
    		import mx.controls.Alert;
    		import mx.rpc.events.FaultEvent;
    		import mx.rpc.events.ResultEvent;
     
    		private function resultHandler( event : ResultEvent ) : void
    		{
    			Alert.show( event.result.toString() );
    		}
     
    		private function faultHandler( event : FaultEvent ) : void 
    		{
    			Alert.show( event.fault.faultString );
    		}
    	]]>
    </fx:Script>
  10. Finally create a button or method to call the service:
    .

    1
    
    <mx:Button click="userService.getUserByID( 1 )"/>
  11. Much of this logic may be abstracted off into controllers, delegates, commands or other framework-specific components but this is a fairly simple example of installing, configuring and executing a remote object service call from Flex to ColdFusion.

Categories: Adobe Flash, Adobe Flex, ColdFusion, Events Tags:

Adobe Flex 4 LiveDocs Documentation & Language Reference

December 29th, 2009 Erich Cervantez 2 comments

At work, I wanted to review some information on the Adobe Flex 4 LiveDocs help documentation and had a lot of trouble finding it online.

Luckily at some point in the past, I managed to bookmark it at home and am reposting it here in case anyone else might be interested. Here is the link to the Flex 4 help documentation, which is a fantastic resource. I hope it comes in handy ;)

Adobe Flex 4 Documentation:

http://help.adobe.com/en_US/Flex/4.0/UsingSDK/index.html (PDF)

Flex 4 ActionScript Language Reference:

http://livedocs.adobe.com/flex/gumbo/langref/index.html

Download the trial copy of Flash Builder 4, read the above documentation and experiment by building your own test applications.

There are quite a few changes from Flex 3 to Flex 4 and the earlier you get acclimated to the new features, the better prepared you’ll be when the final product ships ;) Good luck!

Categories: Adobe Flash, Adobe Flex, Events Tags:

Editing HTML in Flex Builder 3

March 28th, 2009 Erich Cervantez 4 comments

Rarely have I ever had a need to edit HTML in Flex Builder. Other editors (Dreamweaver, for instance) were always available or I managed to get by with Flex Builder’s built-in plain text editor. Lately, however I’ve been working with HTML and Flex together more often and I decided to hunker down and get an HTML-editor plug-in installed in Flex Builder.

A quick solution was installing the PHP Development Toolkit plug-in (PDT) which could handle not only PHP code hinting and editing (if you needed that sort of thing), but also handled HTML as well.

Here were the steps I had to run through to get the PDT plug-in working in Flex Builder 3. First, we’ll need to install some pre-requisite frameworks and tools (like GEF, EMF and WST):

• First, from within Flex Builder, click

        Help –> Software Updates –> Find and Install –>
        Search for new features to install

• Check Europa Discovery Site and click Finish

• Expand Europa Discovery Site results

• Uncheck “Show the latest version of a feature only

• Find these groups and check the version listed:

        Graphical Editors and Frameworks
          • Graphical Editing Framework 3.3.2

        Java Development
          • Eclipse Java Development Tools 3.3.2

        Models and Model Development
          • Eclipse Modeling Framework (EMF) Runtime + End-User Tools 2.3.2
          • XML Schema Infoset Model (XSD) Extender SDK 2.3.2

        Web and JEE Development
          • Web Standard Tools (WST) Project 2.0.2

• Click Next

• Click the I accept the terms in the license agreement radio button

• Click Finish

Now that that’s done, we’ll get on to the PDT installation:

• From within Flex Builder again, click

        Help –> Software Updates –> Find and Install–>
        Search for new features to install

• Click New Remote Site, and type in “PDT” for the name and http://download.eclipse.org/tools/pdt/updates/ for the URL

• Click Finish

• Uncheck “Show the latest version of a feature only

• Expand PDT

• Check PDT SDK 1.0.3 and click Finish

• Restart the Flex Builder workbench

• Once Flex Builder has restarted, click Window in the upper toolbar, then click

        Preferences –> General –> Editors –> File Associations

• Select “.html” and “.htm” and for each extension highlight “HTML Editor” and click Default. .
• Once you’re all done click OK.

That’s it!

Categories: Adobe Flash, Adobe Flex Tags:

Flash Player 10 Coming in 2010 to Mobile Smartphones

February 17th, 2009 Erich Cervantez No comments

At Adobe MAX San Francisco, I remember Kevin Lynch (CTO, Adobe) speaking in his keynote about the fact that they have been working to get Flash Player 10 on smart-phones. Considering Flash Player 10 had been released just a short time before MAX, we knew it would take quite some time for that realization to come true. However, today at the GSMA Mobile World Congress in Barcelona, Adobe announced a date. In early next year, Flash Player 10 should be available on smartphones running Windows Mobile, Google’s Android, Nokia S60/Symbian, and the new Palm operating systems.

Currently, about 40% of mobile phones come shipped with Flash Lite. With the introduction of the full Flash Player 10 engine to smartphones, developers can now trust that their applications will run, without dumbing their code down to AS2 or Flash Lite.
Read the full article here: http://reviews.cnet.com/8301-13970_7-10164745-78.html
Categories: Adobe Flash Tags: