Showing posts with label Flex. Show all posts
Showing posts with label Flex. Show all posts

Friday, May 13, 2011

Flex 3.5 and using asdocs

I just noticed that running asdocs on 3.5 will throw the following error:

Loading configuration file C:\Program Files\Adobe\Adobe Flash Builder 4\sdks\3.5.0\frameworks\flex-config.xml
Adobe ASDoc
Version 3.5.0 build 12683
Copyright (c) 2004-2007 Adobe Systems, Inc. All rights reserved.
Error: ” is not a directory
Use ‘asdoc -help’ for information about using the command line.

This is happening because the asdocs folder, and more importantly asdocs/templates folder wasn't included in the 3.5 distribution of the Flex SDK.  Simply copy asdocs from 3.4 or another 3.x sdk and it'll work.

Thursday, March 10, 2011

Using hand cursors in the flex tree

Normally getting hand cursors to show on flex components involves setting useHandCursor="true", buttonMode="true", and mouseChildren="false". Sadly this blows up the tree as you aren't able to select anything.  The way around this is to set  useHandCursor="true" buttonMode="true" on your <mx:Tree/> component and then set super.mouseChildren = false in an itemRenderer like so:

package somepackage
{
import mx.controls.treeClasses.TreeItemRenderer;
import mx.controls.treeClasses.TreeListData;

public class ReportsTreeItemRenderer extends TreeItemRenderer
{
public function ReportsTreeItemRenderer()
{
super();
}

override public function set data(value:Object):void
{
super.data = value;

if( super.data )
{
super.mouseChildren = false;
if( TreeListData(listData).depth == 1 )
setStyle('fontWeight', 'bold');
else {
setStyle('fontWeight', 'normal');
}
}
}
}
}

Tuesday, July 13, 2010

Scrolling ViewStack Contents

I ran into an interesting issue with a Flex app today as I couldn't constrain the contents of a viewstack properly. I ultimately wanted a scrollbar to appear if it's contents were larger than what the parent would allow. To enable this properly, the children all had height of 100%, the viewstack had a height of 100%, and the key setting was to give a minHeight of 50 or something small to the viewstack itself.

I also tried using resizeToContent which is great, but it still wouldn't allow the viewstack to get very short until I put the minHeight in.

Friday, July 02, 2010

Crossdomain for LiveCycle

I've been asked this question numerous times so I figured I would post it here. When you need to deploy a crossdomain.xml file for a LiveCycle install running JBoss, you'll have to dump it in the following location:

C:\Adobe\LiveCycle8.2\jboss\server\all\deploy\jbossweb-tomcat55.sar\ROOT.war

Wednesday, June 02, 2010

Compc not found...

I was setting up another project today and I ran into an odd issue with compc in my ant tasks. Here is the error that I was getting:

compile:
[compc] java.lang.NoClassDefFoundError: flex2/tools/Compc
[compc] Caused by: java.lang.ClassNotFoundException: flex2.tools.Compc
[compc] at java.net.URLClassLoader$1.run(Unknown Source)
[compc] at java.security.AccessController.doPrivileged(Native Method)
[compc] at java.net.URLClassLoader.findClass(Unknown Source)
[compc] at java.lang.ClassLoader.loadClass(Unknown Source)
[compc] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
[compc] at java.lang.ClassLoader.loadClass(Unknown Source)
[compc] at java.lang.ClassLoader.loadClassInternal(Unknown Source)
[compc] Could not find the main class: flex2.tools.Compc. Program will exit.
[compc] Exception in thread "main"

BUILD FAILED
D:\xx\xx\xx\build.xml:91: compc task failed.

This was the actual location of my flex_sdk:

C:\Program Files\Adobe\Adobe Flash Builder 4 Plug-in (2)\sdks\3.2.0.3958

Oddly enough, I tried all sorts of different combinations to reproduce this in another location to no avail. After digging through the following posts I moved the sdk to the root of my drive and that seemed to do the trick.

For more reading:
http://bugs.adobe.com/jira/browse/SDK-13003
https://bugs.adobe.com/jira/browse/SDK-13602

Saturday, January 10, 2009

LiveCycle Authentication with ColdFusion

Here's a snippet of ColdFusion code that will allow you to athenticate a LiveCycle user using the AuthenticationManagerService service that's shipped with LCES 8.2. You can then use the results to pull the user's oid, userId, full name, etc, from the authenticateResponse.

More importantly, you can use the assertion string to implement SSO with SAML. Once you have the assertion, you can call validateAssertion on the same service to validate the user and get their information. In other words, you can perform the authentication using ColdFusion, and then for example, pass the assertion to your flex app so that you don't force the user to authenticate again.

<cfset username = "administrator">
<cfset password = toBase64('password')>

<cfsavecontent variable="xml">
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<m:authenticate xmlns:m="http://adobe.com/idp/services">
<m:username><cfoutput>#username#</cfoutput></m:username>
<m:password><cfoutput>#password#</cfoutput></m:password>
</m:authenticate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
</cfsavecontent>

<cfhttp url="http://servername:portnumber/soap/services/AuthenticationManagerService?wsdl" method="post">
<cfhttpparam type="cgi" name="SOAPAction" value="authenticate">
<cfhttpparam type="xml" name="authenticateRequest" value="#xml#">
</cfhttp>

<cfset xml = xmlParse(cfhttp.filecontent)>
<cfset assertion = xmlSearch(xml, "//*[local-name()='assertion']")>
<cfoutput>#htmleditformat(assertion[1].xmltext)#</cfoutput>

Friday, January 09, 2009

Authentication with Flex Remoting in Workspace

If you're getting the following error, it probably means that you have a RemoteObject call within your flex application that's loaded up as a workspace task (process / form / etc). You won't see this error if you're using the same credentials to log into workspace as what you're using for your remoting call, but it'll pop up if you try to log into workspace with another random user.

That being said, you should not authenticate your endpoints in flex and simply ensure that all users who need access to your workspace task have both "Services User" and "LiveCycle Workspace User" roles assigned to them.

fault = (mx.rpc::Fault)#2
errorID = 0
faultCode = "Channel.Authentication.Error"
faultDetail = "Cannot re-authenticate in the same session."
faultString = "warn"
message = "faultCode:Channel.Authentication.Error faultString:'warn' faultDetail:'Cannot re-authenticate in the same session.'"
name = "Error"
rootCause = (mx.messaging.messages::ErrorMessage)#3

Thursday, January 08, 2009

Configuring a livecycle workspace process / task for all users

We created a flex application that we in turn wanted to load up within the Adobe Livecycle Workspace ES (8.2). When originally deployed, only the super administrator was able to view it, but no other workspace enabled users. Here are the steps to configure your task properly.
  • Log into the Adobe LiveCycle Administration Console
  • Click on Services
  • Click on Applications and Services
  • Click on Service Management
  • Find and click on your applicable service
  • Click the security tab
  • Click on "Add Principal"
  • Click on "All Principals", or the user(s) / group(s) in question
  • Select the "INVOKE_PERM" permission
  • Make sure to save your changes
If the user in question can't login to workspace at all, make sure they have the "LiveCycle Workspace User" role assigned to them.

Wednesday, December 10, 2008

Flex DocumentReference and LiveCycle 8.2

If you plan to use a DocumentReference to send a file to LiveCycle, such as an xml file, you need to ensure that you're using the latest adobe-remoting-provider.swc found xxx\LiveCycle8.2\LiveCycle_ES_SDK\misc\DataServices\Client-Libraries.

Previous versions of the DocumentReference allow for xml, but with 8.2, you need to send your document within the text property.

Look at "LCDS-325" at http://help.adobe.com/en_US/livecycle/8.2/lcds_releasenotes.html if you want more details or plan to fix this change on the LiveCycle side, but at the end of the day, it's easier to simply update your swc and text property.

Get current user for a workspace enabled flex application

Here is a sample code snippet if you have to pull user information or user credentials from the signed-in workspace user when a flex application is loaded as a process/form in workspace.

import lc.core.ISessionManager;
import lc.domain.SessionMap;
import mx.utils.ObjectUtil;

var session : SessionMap = SessionMap( Application.application.session );
var sessionManager : ISessionManager = ISessionManager( session.getObject( "lc.core.ISessionManager" ) );

trace( ObjectUtil.toString( sessionManager.authenticatedUser ) );

You'll see that authenticated user is mapped to lc.domain.User. You'll need the latest fds.swk and fds_rb.swc for this. Below is an example of what you'll get back.

(lc.domain::User)#0
address = (null)
description = (null)
displayName = "Super Administrator"
domain = (null)
email = ""
emailAliases = (null)
firstName = (null)
groups = (null)
initials = (null)
isOutOfOffice = false
lastName = (null)
locale = (null)
oid = "8D1446F6-A3DD-F4C2-378B-1B46089140AA"
session = (null)
telephone = ""
timezone = (null)
userid = "administrator"


Tuesday, March 13, 2007

Issues with DataGrid Column Visibility

A friend of mine passed along an interesting problem regarding DataGrids. They had the need to hide certain columns and then dynamically load the data. When doing this as expected, such as dataGridName.dataProvider = yourArrayName, the hidden columns would not stay hidden. The workaround to this issue is to track the visibility of each DataGridColumn, set the column to visible, and then override it with the visibility status we stored.

View the example here and download the code here.

Definately not optimal, but it works... ;-)

Form Validation

Paul Rangel from Wheeler Street Design put together a simple form validator that works quite well. The only thing that you have to be aware of is the fact that you need to initialize the validators property after your form fields are added if you're using states.

Wednesday, February 21, 2007

Internal Build Error

I recently ran into an issue with Flex Builder where I was getting the "An internal build error has occurred. Please check the Error Log." error when trying to debug my project. Absolutely nothing worked including all the normal practices such as cleaning the project, recreating the workspace, manually deleting the bin folder, reinstalling Flex Builder, etc.

After performing all of these tasks I was still getting "Uncaught exception in compiler" in the error log, which by the way is the .log file in the .metadata folder of your workspace. After further analysis, I tied the issue back to a missing semi-colon after a variable declaration in my class such as:

public class SomeClass
{
      public var blah:Object
}

If you ever find yourself in this situation, start rolling back code and begin to do a detailed analysis for syntax errors that normally do not pose any problems.

Wednesday, February 14, 2007

Flex tree's with a context menu

Recently on the flexcoders list a question was posed regarding how to get the item that was 'right-clicked on' when dealing with a tree. There are a few steps to follow if you plan to implement a context menu that is dynamic based on individual tree items.

First, you need to use the itemRollOver event of the <mx:Tree> component to track the last item that was rolled over, and save it to a variable for later use. Then when the ContextMenuEvent.MENU_SELECT event is triggered, you will refer back to this variable as it holds a reference to the itemRenderer and therefore the data you need access to.

You can view an example here and view the code here...

Updated Flex Style Explorer v2.0.1

I just realized that Adobe Consulting released a new version of the Flex Style Explorer. The style explorer is great if you want to see what you can do with CSS in flex. It's also a good way to start working with styles, although you must keep in mind that this is just the beginning of how you can tweak the look and feel of your flex applications.

http://examples.adobe.com/flex2/consulting/styleexplorer/Flex2StyleExplorer.html

Friday, January 26, 2007

Flex Performance

Brandon Purcell from Adobe put together a great article discussing flex performance and optimization. This articles includes many tips and tricks, along with general best practices to increase client performance.

http://www.adobe.com/devnet/flex/articles/client_perf_print.html

Thursday, January 25, 2007

Where's the problem?

I recently ran into an issue with Flex Builder where the Problems tab wasn't accurately reporting information. It would show me the error, but it would simply show the project name under the resource column.

All the normal attempts to resolve the issue didn't work including cleaning the project, recreating the project, and even reinstalling Flex Builder (w/2.0.1). Finally, the only thing that resolved it was deleting all of the files and rebuilding my source code from SVN.

Tuesday, December 19, 2006

More on Flash Activation

Continuing with my last post, SWFObject is another script that can be used to automatically activate a flash movie. I prefer this as it's a bit more flexible when dealing with menus that can hover above flash movies.

http://blog.deconcept.com/swfobject/

Activating Flex Apps and Flash Movies

It amazes me how many flex and flash apps that I run into that don't account for the ActiveX Activation Issue in IE. To prevent making a user click on the flash movie to activate it, and then interact with it, you can include a simple JavaScript file to automatically activate all flash movies upon load.

Learn more and download the necessary files from http://www.sitepoint.com/article/activex-activation-issue-ie. Then go ahead and add the following line to your application:

<script type="text/javascript" src="objectSwap.js"> </script>

Monday, December 11, 2006

Organizing your flex apps with code behind

As your flex apps get bigger and bigger, you may notice that many of your mxml files keep growing at an astonishing rate. First you just have a few component calls, then a couple of events, next thing you know it's ballooned to an mxml page with hundreds of lines of code. While this might not necessary be a bad thing, it can make it more difficult for other members of your team.

The following article describes how you can use code behind to help structure and organize your flex apps, all in a very simple and convenient way.

http://www.adobe.com/devnet/flex/quickstart/building_components_using_code_behind/