[flexcoders] Flex builder compiler

2009-03-23 Thread diehlryan
I have many, many issues with the Flex Builder compiler.  I will start
with this one: incremental compilation.  The docs state that by default,
FB compiler has incremental compilation turned on, which I don't believe
in the slightest.  If you run a command line build with
-incremental=true, the compiler generates .cache files.  FB doesn't
generate anything, does it just use a different mechanism to detect
changes?

I have a somewhat complex project structure, 1 Flex project with 6
supporting library projects.  If I make a simple change in one of the
library projects, I get a 7 minute compile time as FB goes and rebuilds
everything under the sun.

I have done any optimizations I can think of, including giving FB a full
gig of ram in the heap, using RSLs, closing unused projects, etc.  What
am I missing here?



[flexcoders] Flex builder annoyance - library projects

2008-10-29 Thread diehlryan
Does anyone else find it annoying that you must explicitly specify the
classes that are included in your library project via the Flex Library
Build Path?  This is especially annoying in a team environment when
someone else adds a new class, and I have to explicitly add it in
order to get a successful compilation.  (I won't even go into the
issues I have with the compiler).

If you look at how Eclipse handles this, you specify a source folder
and then can optionally specify anything that should be excluded from
compilation.  This way, you can just say my code is here and it
picks up everything unless you tell it not to.  

Even if the compiler needs to know exactly which files to use, I think
a nice feature would be to automatically generate that
flexLibProperties file for you.  



[flexcoders] Re: Flex builder annoyance - library projects

2008-10-29 Thread diehlryan
Agreed, in fact we're already using Ant in conjunction with our
Continuous Integration system.  I find that it's a must in a larger
project.  I've run into cases where FB just plain doesn't report
compilation errors, even after a clean.  

I'm just wondering whether others feel my frustration in this regard,
and whether moving to the Java/Eclipse model would be an improvement,
or whether there's a good reason to stay with the current model.



[flexcoders] Re: Using ampersand character in contextmenuitem label

2008-10-27 Thread diehlryan
I haven't tried this, but try using the amp; in place of  like you
would have to do in MXML...

menu.customItems.push(new ContextMenuItem('1Test amp; test'));



[flexcoders] XML object ?xml version=1.0 ? line

2008-10-14 Thread diehlryan
This seems like a simple question but I haven't been able to find an
answer.  I want to prepend the standard xml version, encoding line to
my XML object before sending it to the server:


?xml version=1.0 encoding=UTF-8?
...


How do I do this?  I've tried using prependChild on the root node, but
it only inserts a blank line.  



[flexcoders] Re: XML object ?xml version=1.0 ? line

2008-10-14 Thread diehlryan
Same result, nothing shows up.

var xml:XML = new XML(?xml version='1.0'?result/result);

Output is 
result/




[flexcoders] AS3 interface question

2008-06-26 Thread diehlryan
I'm running into a wall when trying to use extension with interfaces.
 The example I'm about to provide works using Java, so I believe the
OOP practices behind it are valid.  But I can't figure out how to
accomplish the same thing in Flex, I keep running into compiler
issues.  The example is a condensed version of something I'm working
on, for simplicity sake.  

Let's say you have a bunch of events that all have some common
functionality, like the ability to have a nextEvent.  Also, a subset
of those events also have additional functionality, they can be
filtered by a type of criteria.  We'll call them search events.

Now, there are some parts of the application that can work with any
type of search event, and any type of criteria.  But when the
individual searches are executed, that implementation expects a
specific type of search event and search criteria.  That's my end goal
here.

Here are the interfaces I'm using:

public interface ICriteria
{
// just a marker
}

public interface ICustomCriteria extends ICriteria
{
function get name():String;
function set name(name:String):void;
}

public interface IEvent
{
function get nextEvent():IEvent;
function set nextEvent(event:IEvent):void;
}

public interface ISearchEvent
{
function get criteria():ICriteria;
function set criteria(criteria:ICriteria):void;
}

So far, so good.  And now the implementing classes:

// would like to make this an abstract class, but not supported in AS
public class BaseEvent implements IEvent
{
private var _nextEvent:IEvent;

public function set nextEvent(event:IEvent):void
{
this._nextEvent = event;
}

public function get nextEvent():IEvent
{
return this._nextEvent;
}
}

// would like to make this an abstract class, but not supported in AS
public class BaseSearchEvent extends BaseEvent implements ISearchEvent
{
private var _criteria:ICriteria;

public function set criteria(criteria:ICriteria):void
{
this._criteria = criteria;
}

public function get criteria():ICriteria
{
return this._criteria;
}
}

Those base classes are fine and compile correctly.  Now if you
remember from the requirements, there are some places that can work
with any type of ISearchEvent, and some places that can only work with
an individual subclass.  Here is where the compiler errors come in. 
Doing what I am about to do works in Java, and I'm wondering if there
is a way to accomplish it in AS3.  

public class CustomSearchEvent extends BaseSearchEvent
{
private var _criteria:ICustomCriteria;

public override function get criteria():ICustomCriteria
{
return this._criteria;
}

public override function set criteria(criteria:ICustomCriteria):void
{
this._criteria = criteria;
}
}

The above class does not compile because the method signatures for
get/set criteria are different than those specified in the interface.
 But from an OO perspective, I think this is a valid thing to want to
do.  If you're working with an ISearchEvent instance, you should be
able to subclass the base class and provide custom behavior.  The
ICustomCriteria is a subclass of ICriteria, so you should be able to
substitute them in this context.  Is there another way to accomplish
this?  Or is this just a language feature that's not there?



[flexcoders] Re: A great feature for Flex Builder would be getter and setter automation.

2008-06-25 Thread diehlryan
One place that is somewhat painful for me is when dealing with
interfaces and vars vs. getters/setters.  Most of the time my
interfaces use methods only, but there are occasions where it makes
sense to toss a property in there.  Since you can't have var in an
interface, I find myself writing getters and setters.  Small pain, but
a pain.  

Oh, another one.  When you're extending the Cairngorm ServiceLocator.
 Back in the days before getService was deprecated, we used vars to
represent the services, because that was simple.  When we upgraded to
getWebService, things broke because it uses describeType to find
read/write accessors.  Another place where it would be handy to have
the auto-generation.  (I know, could have changed their
implementation, but wasn't as well-versed at the time).



[flexcoders] Re: warning: multiple describeType entries for 'selectedItem'

2008-06-23 Thread diehlryan
I'm running into the same warning, the binding works though.  Anybody
able to figure out why this is happening?



[flexcoders] MenuBar filter function

2008-04-21 Thread diehlryan
I'm using an XMLListCollection as a dataprovider for a MenuBar.  I'm
trying to find a way to easily filter out menu items based on a
visible property of the data provider.

On the top level of the MenuBar, this is easy.  I set a filterFunction
and only return visible nodes.  

However, I also need to filter out nested levels of the menu.  If my
data provider looks like this:

menu
mainMenu label=File visible=true
menuitem label=Save visible=true /
menuitem label=Save All visible=false /
/mainMenu
mainMenu label=Edit visible=false

/mainMenu
/menu

I need to filter out the Save All item, while showing File - Save. 
Does anyone know a way to do this?  I looked into using the
DataDescriptor, but it only has an enabled or toggled property.  Also
looked into extending the menu itemrenderer but I thought I would post
before going too far down that road.



[flexcoders] Re: Calling a Module Function from the Parent Application

2008-03-11 Thread diehlryan
One nice way to do this is to define an interface, IBuildingModule or
something like that, and make the module implement it.  

package com.example
{
public interface IBuildingModule
{
function loadBuildingRecord():void;
}
}

// make the module implement it
mx:Module xmlns:mx=http://www.adobe.com/2006/mxml;
implements=com.example.IBuildingModule ...

public function loadBuildingRecord():void
{
// load the record
}

/mx:Module


Now, after loading the module, you can strongly-type it to the
interface, which means you get nice things like code completion and
compile-time checking.  It's also more apparent to someone else what
you're trying to do with the code.  So to call the method from the
application, you would do:

private function ShowInput():void
{
if(gTableName == Building){
var mod:IBuildingModule = modBuilding_In.child as IBuildingModule;
mod.loadBuildingRecord();
currentState = Building In;
}
}




[flexcoders] Re: Error in web service from Flex 2 to Flex 3

2008-03-05 Thread diehlryan
I've filed a bug report regarding this issue:

https://bugs.adobe.com/jira/browse/SDK-14873
https://bugs.adobe.com/jira/browse/SDK-14873

Please consider voting, thanks.



[flexcoders] Re: Error in web service from Flex 2 to Flex 3

2008-03-03 Thread diehlryan
Does anyone from Adobe have any input on this?  I can provide more
details on our implementation if necessary.



[flexcoders] Re: Error in web service from Flex 2 to Flex 3

2008-02-29 Thread diehlryan
I saw your earlier post about the HttpService issue and I was really
really hoping that wasn't it.  Might play around with it some more
this weekend and see what I can dig up.



[flexcoders] Re: Error in web service from Flex 2 to Flex 3

2008-02-29 Thread diehlryan
I did some more digging and found that my issue is separate from the
HttpService issue.  I'm running into problems during the serialization
and deserialization of the SOAP request and response.

Errors occur whenever the web service uses enum types in the
request/response.  I have a different example outlined below for each
case.  Again, this all worked using Flex 2.

Example 1:  getUsers(startIndex : uint, maxResults : uint)

Request takes two native arguments, and the request is serialized
correctly, makes it to the server, and the server sends the correct
response.  The response consists of an array of UserDTO objects, which
look like:

public var id: String
public var name : String
public var userStatus : String  // type is a Java Enum on the server
side, should be deserialized to a String
etc.

When the response is deserialized, I debugged through and everything
works correctly until the XMLDecoder gets to the userStatus variable,
where I get the following FaultEvent:

Cannot find definition for type
'http://enums.usergroup.docfinity.com::UserStatus''


Example 2: getUsersByCriteria(startIndex : uint, maxResults : uint,
criteria : UserCriteria)

The UserCriteria object defines search parameters for the result set. 
The UserCriteria object looks like:

public var groupIds : Array // array of group Id strings to search in
public var name : String
public var userStatuses : Array // array of UserStatus values, which are
really strings since AS doesn't support Enums
etc.

When the request is serialized, I debugged through and everything works
correctly until the XMLEncoder gets to the userStatuses variable, where
I get the following error:

Cannot find definition for type
'http://enums.usergroup.docfinity.com::ArrayOfUserStatus'


Conclusion: Both of those error messages are related to constructs that
use Java Enums which were previously serialized into Strings.  In the
WSDL, those Enum definitions look like this:

xsd:simpleType name=UserStatus
 xsd:restriction base=xsd:string
 xsd:enumeration value=ACTIVE/
 xsd:enumeration value=INACTIVE/
 xsd:enumeration value=DELETED/
 /xsd:restriction
/xsd:simpleType

xsd:complexType name=ArrayOfUserStatus
 xsd:sequence
 xsd:element maxOccurs=unbounded minOccurs=0
name=UserStatus nillable=true type=ns1:UserStatus/
 /xsd:sequence
/xsd:complexType

Once I saw that, I remembered reading a note in the documentation about
XSD types that Flex doesn't support:

The following XML Schema structures or structure attributes are ignored
and are not supported in Flex 3:
simpleType
 restriction
 enumeration
 /restriction
/simpleType

So if they're ignored and not supported, I would at least imagine that
it would go back to the base type of the simpleType (string in this
case), and serialize using that, instead of breaking.  Am I on the right
track here?  Is this a bug or a known issue with a work-around?  Anybody
from Adobe familiar with this?



[flexcoders] FormItemLabel style

2007-10-22 Thread diehlryan
I can style a FormItemLabel to be bold using a global style, but I
can't figure out how to style a Form on a single component only and
not affect the other forms throughout the application.  I can get it
working via ActionScript and using the StyleManager, but again, this
affects all instances of FormItemLabel throughout the application:

StyleManager.getStyleDeclaration(FormItemLabel).setStyle(fontWeight,
bold);

It does work if I do the previous line on init, and then reset it when
the user leaves the form, but it feels kinda hacky, and there is a
noticeable delay while the styles are regenerated at runtime.  Does
anyone know of a nice way to do this?  I suppose I could subclass
FormItem or FormItemLabel, but that seems like overkill just to set a
style.  Thanks.



[flexcoders] Re: FormItemLabel style

2007-10-22 Thread diehlryan
I'm not trying to set it on a Label per se, I'm trying to set the
style on the label that gets generated in a FormItem.  

mx:FormItem id=...  label=User Id: 

I've tried setting the fontWeight style on the FormItem itself, but
that will style the control as well as the label.  

--- In flexcoders@yahoogroups.com, Scott - FastLane [EMAIL PROTECTED] wrote:

 If you only want to set it for one label, can't you just set it on the 
 label declaration i.e. mx:Label fontWeight=bold text=Your Label
Text/
 
 hth
 Scott
 
 Scott Melby
 Founder, Fast Lane Software LLC
 http://www.fastlanesw.com
 
 
 
 diehlryan wrote:
 
  I can style a FormItemLabel to be bold using a global style, but I
  can't figure out how to style a Form on a single component only and
  not affect the other forms throughout the application. I can get it
  working via ActionScript and using the StyleManager, but again, this
  affects all instances of FormItemLabel throughout the application:
 
 
StyleManager.getStyleDeclaration(FormItemLabel).setStyle(fontWeight,
  bold);
 
  It does work if I do the previous line on init, and then reset it when
  the user leaves the form, but it feels kinda hacky, and there is a
  noticeable delay while the styles are regenerated at runtime. Does
  anyone know of a nice way to do this? I suppose I could subclass
  FormItem or FormItemLabel, but that seems like overkill just to set a
  style. Thanks.
 
 





[flexcoders] Re: How to use Image encoders?

2007-08-31 Thread diehlryan
Try enabling smoothing on the bitmap.  This should make the image look
a little nicer when scaled down.  From your example:

...
var snap:Image = new Image();
Bitmap bitmap = new Bitmap(bd);
bitmap.smoothing = true;
snap.source = bitmap;
snap.percentHeight = 20;
snap.percentWidth = 20; 
return (snap);
}