in a rush

experience is everything

in a rush header image 1

Local SharedObject

April 28th, 2008 · No Comments

“When you create a SharedObject, Macromedia Flash Player creates a new directory for the application and domain, and creates an empty *.sol file that stores the SharedObject data. The default location of this file is in a subdirectory of the user’’s home directory; for example: c:/Documents and Settings/username/Application Data/Macromedia/Flash Player/web_domain/lso.mxml.swf/. While usually predictable, the location of the StoredObject file can be anywhere that Flash Player has access to within its sandbox and can have any name that Flash Player assigns to it.

By default, Flash can save locally persistent SharedObjects of up to 100K in size. When you try to save a larger set of data, Flash Player displays the Local Storage dialog box, which lets the user allow or deny local storage for the domain that is requesting access.”

→ No CommentsTags: Flash · Flex

Dynamically adding to a Model

April 28th, 2008 · No Comments

One limitation of the Model tag is that if you supply one instance of a child tag in an <mx:Model> tag, there is no way for Flex to know if you intend it to be an array or a single property instance. You can work around this limitation by using an <mx:Object> tag instead of an <mx:Model> tag and declaring an <mx:Array> tag inside the <mx:Object> tag. As an added benefit, you can then dynamically add to the object creating an array of objects.

Here’’s the sample code:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*">
  3.  
  4. <mx:Script>
  5. <![CDATA[
  6. public var count:Number = 0;
  7.  
  8. public function addToModel():Void
  9. {
  10. var newRecord:Object = new Object();
  11. newRecord.name = "Toby";
  12. newRecord.sign = "Leo";
  13. newRecord.birthYear = "1984";
  14. test[ count++ ] = newRecord;
  15. }
  16. ]]>
  17. </mx:Script>
  18.  
  19. <mx:Object id="test"/>
  20.  
  21. <mx:Button label="Add" click="addToModel()"/>
  22.  
  23. <Inspect/>
  24.  
  25. </mx:Application>

→ No CommentsTags: Uncategorized

Using Eclipse for Flex 1.5 Development

April 28th, 2008 · No Comments

So you want to use Eclipse to do Flex 1.5 development? No fluff, I”ll get right to it.

What you are going to do is use the Flex 2 alpha and point it to the Flex 1.5 compiler. This will compile your application into a SWF, which will be put in your web site.

  • Start with getting the Flex 2 alpha plug-in (either stand alone or plug-in). Follow the installation instructions, if necessary, to get Flex Builder 2 running. Once it is working, create a new Flex Project using the menu bar: File > New > Flex Project
  • Now for the changes. Right-click the project that will use the Flex 1.5 compiler and select Properties. This will open the Properties dialog. In the list on of properties on the left hand side, select Builders. You are going to add a new builder and disable the existing one. When you deselect the existing ”Flex Builder” builder you will get a prompt. Just click OK.
  • Click the New button to create a new builder. The configuration chooser dialog will open. Select Program and click OK.
  • Now you are ready to set the new builder up. Give it a name like ”Flex 1.5”.
  • Set the Location to point to the mxmlc.exe file, most likely something like this: C:\\Program Files\\Macromedia\\Flex\\bin\\mxmlc.exe
  • Set the Working Directory to point to the directory holding the compiler. Something like this: C:\\Program Files\\Macromedia\\Flex\\bin\\
  • And now the hard part… the arguments. Click the variables button and select the project_loc variable. This is an eclispe variable which has the absolute file system path for the project. Double-click project_loc to select that variable and close the dialog. Now append to the end of the variable the path to the main application mxml for the project. Something like this: ${project_loc}\\Main.mxml
  • You need to add two more arguments; one that points to the flex-config.xml, and an output file. To do so, you will add the -configuration switch and the -o output file switch. They will look something like this: -configuration ${project_loc}\\WEB-INF\\flex\\flex-config.xml -o C:\\inetpub\\wwwroot\\mysite\\Main.swf

In the end the arguments will look something like this: ${project_loc}\\Main.mxml  -configuration ${project_loc}\\WEB-INF\\flex\\flex-config.xml -o C:\\inetpub\\wwwroot\\mysite\\Main.swf

  • One last thing I would do is run your application the old way and copy the source HTML from a dynamically created Flex site (i.e. view source from the browser). Then create a new HTML page with the HTML source you copied. Finally, change the references to the [filename].mxml.swf to your new SWF ([filename].swf)

That’’s it!

Thanks again to Marcin, Sean and Tony for sharing with me.

→ No CommentsTags: Eclipse · Flex

Creating your own Flex component

April 28th, 2008 · No Comments

Adobe Flex is composed of two distinct pieces; a set of pre-built components known as the client-side framework, and a set of runtime services that allow Flex applications to integrate with back-end systems. The client-side framework is a series of ActionScript class that you utilize in MXML or ActionScript. Did you know that you can create your own ActionScript classes and reference them the same way? Remember, MXML is just short-hand notation for ActionScript.

Start by creating an ActionScript class that extends the Flex Panel component.
compClassXPanel.as

  1. // Import the client-side framework components needed
  2. // The .* is a wildcard that will only import classes that are needed.
  3. import mx.containers.*;
  4. class compClassXPanel extends Panel
  5. {
  6. public function compClassXPanel() {}
  7. public function init():void {}
  8. }

Next, create a component that uses this class as it’s root node:
myComponent.mxml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <compClassXPanel xmlns="*" width="400" height="400">
  3. </compClassXPanel>

Finally, create your main application that invokes your custom component:
Main.mxml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*">
  3. <myComponent />
  4. </mx:Application>

Now, this is a very simple example of how you can do this. You would normally continue to build upon your extended class. The point is that your classes are really not that different from the client-side framework.

→ No CommentsTags: Flex

Getting Started with Flex

April 28th, 2008 · No Comments

When teaching or consulting Flex, you will often be asked for examples of how to do “xyz”. Here are few links that will help.Flex and CF:
Integrate Flex with CF security

File Upload:
File Upload in Flex/Flash in Internet Explorer

File Upload Using Flex/Central/Java

Architecture Ideas:
Cairngorm and an associated Breezo that will help explain the design patterns.

→ No CommentsTags: Cairngorm · ColdFusion · Flex

Feelin’ the Love From Your Logs

April 28th, 2008 · No Comments

I recently had some datasource issues that I was able to figure out with a bit more feedback from the JRun logs.

First, for those of you who are not system admins, make sure you make a copy of the files before you modify them.

Now, there are a couple of XML files that you can modify that will provide a lot more detail of what is going on.

The CF datasources are stored in the jrun-resources.xml file located in {CFMX install}\runtime\servers\default\SERVER-INF. Locate the datasource in question and change the debugging node (<debugging>false</debugging>) of that element from false to true. This will tell JRun to log more information about this resource. Note: there a lot of other options available several of which you can equate to datasource options in the CF Admin.

Next, we want to modify the the actual logging service. You can do this with the jrun.xml file located in the same directory as jrun-resources.xml above.
Find the LoggerService in the jrun.xml file. Set the following two entries to “true”:
<attribute name=”debugEnabled”>false</attribute>
<attribute name=”metricsEnabled”>false</attribute>

A few lines down from these entries, you can separate the logs into separate files by making the following change:

<attribute name=”filename”>{jrun.rootdir}/logs/{jrun.server.name}-event.log</attribute>
to
<attribute name=”filename”>{jrun.rootdir}/logs/{jrun.server.name}-{log.level}</attribute>

By changing “event.log” to “{log.level}” it will create separate log files for each type of event. This allows you to narrow in on suspected problems a bit easier.

Finally, the logs produced can be found in {CFMX install}\runtime\logs. Note: You will want to reverse these changes because they do cause a bit of overhead on the server.

→ No CommentsTags: ColdFusion · JRun

CFFunction Tip

April 28th, 2008 · No Comments

Extra white space can be a problem for some in ColdFusion. If you are creating ColdFusion Components (CFC) or User Defined Functions (UDF) then there is an attribute to the CFFUNCTION tag that can help.

The OUTPUT Attribute: You should add the attribute output=”no” to the CFFUNCTION tags in your CFC/UDF when it is not rendering display text. This will make it work like CFSILENT, when set to “yes” its like CFOUTPUT.

Note: CFSILENT suppresses all output that is produced by the CFML within the tag’s scope.

→ No CommentsTags: ColdFusion

Adobe AIR Training

November 28th, 2007 · No Comments

Just wanted to let everyone know, the Adobe certified AIR course that I have been building is almost ready. It will be offered as a beta class until the full product release. AIR 1.0 will be released on… ;)

This class is for those who already know Flex and ActionScript, basically you should have experience with classes and creating event listeners.

I’ve taught it at Adobe MAX in Chicago and will teach it at Adobe MAX in Barcelona. The reviews have been very positive (the last one ended with an ovation).

You should see the class appear on Adobe training partner sites later this year.

→ No CommentsTags: AIR

AIR Training is coming

November 2nd, 2007 · No Comments

My blog has been quiet lately due to a number of reasons, but the #1 reason is that I”m working on the AIR: Building Desktop Applications with Flex course for Adobe. Having been an instructor for many years and a developer for even longer, this is a great opportunity for me to give back to the community. And for those of you who have seen me in action, know that I do a lot of giving.

You can attend the first ever AIR class at Adobe MAX in Chicago and the second at MAX Europe in Barcelona. These are a pre- and post-conference course for which you can register.
I”m really excited about the course and I”m sure you will be too!
Speaking of giving, in addition to being at the MAX conferences, I”ll also be at AJAXWorld Expo in Santa Clara in September.

→ No CommentsTags: Uncategorized

Top 10 Reasons to Get Flex Builder 3

August 28th, 2007 · No Comments

If I were to create a Top 10 List, which I don”t, this would definitely be my list for “Why you have to upgrade to Flex Builder 3.” I actually got this list from Ted Patrick and enhanced it a little.

Top 10 List:

  1. With the new code model, search, refactoring, auto-complete you will code 3X faster
  2. The application Profiler will allow you to see and tune memory and performance\r\n
    • You will learn so much about coding in AS3 from this it’’s unreal
  3. Compiles faster!
  4. Maintain projects across SDKs, 2.01, 3.0, and onward (YES!!!)
  5. You will be able to build AIR applications and debug them seamlessly\r\n
    • Easily turn Flex applications into Desktop applications
  6. You will be able to work with Web Services (SOAP) using strong typing
  7. Get new advanced data visualization components (AdvancedDataGrid, TreeDataGrid) and hierarchical data providers
    • Components that we had to build in the past
  8. Enhanced design view for pixel perfect layout and advanced constraints\r\n
    • Coders, don”t knock this. Try it out and you”ll see the benefits real quick
  9. Skinning and styling from Illustrator, Fireworks, Flash, PhotoShop\r\n
    • This is awesome!! Quickly and easily bring comps in directly from the design tools
  10. Seamless support for Flex Framework Caching RSLs ( smaller FX swf files )
  11. Now if that’’s not convincing enough, you don”t know Flex!

→ No CommentsTags: Eclipse · Flex