[flexcoders] Re: Flex + BazeDS: custom collections on Flex side

2010-01-17 Thread Sébastien Tromp
Hello again,

I did some additional tests, and have realized that I _have to_ explicitely
implement the Externalizable interface on the Java side to be able to use
custom serialization / deserialization on the Flex side. So apparently it is
not possible to use a standard class (like HashMap, or the Hibernate
PersistantMap) and map it to my custom class in Flex (i.e. customize only
the client part). Is this something you have noticed?

Regards,
-- 
Sébastien

2010/1/16 Sébastien Tromp sebastien.tr...@gmail.com

 Bumping the question, since I still have not resolved the issue.

 If there really is no other way I will try and revert back to an Object (or
 Dictionary) to store the data, and use the HashCollection simply as a
 wrapper around it.

 Thanks,
 --
 Sébastien


 2010/1/10 Sébastien Tromp sebastien.tr...@gmail.com

 (sorry, mislicked on the send button).

 What I want to do is to map all instances of java.util.Map coming from my
 server (as well as its Hibernate counterpart, the
 org.hibernate.collection.PersistentMap) to this HashCollection.

 To experiment in doing so, I am trying to add custom serialization to the
 HashCollection:

 [RemoteClass(alias=org.hibernate.collection.PersistentMap)]
 public class HashCollection extends ArrayCollection implements IMap,
 IExternalizable
 {

 public function HashCollection(source:Array = null)
 {
 super(source);
 }

 ...

 public override function readExternal(input:IDataInput):void
 {
 trace(read external);
 var test:Object = input.readObject();
 var otherTest:Object = input.readUTF();
 }

 public override function writeExternal(output:IDataOutput):void
 {
 trace(write external);
 super.writeExternal(output);
 trace(test);
 }
 }

 However I never go in the overridden readExternal and writeExternal - I
 always end up in the ArrayCollection methods.

 Does anyone has a clue either on my general issue (map PersistentMap and
 Map to my HashCollection class), or on why the overridden read- and
 writeExternal are never called?

 Regards,
 --
 Sebastien

  2010/1/10 Sébastien Tromp sebastien.tr...@gmail.com

 Hello,

 I am currently working with a Java server implementation, talking to a
 Flex client using BlazeDS.
 On my client side, I have implemented a custom HashCollection (
 http://code.google.com/p/agricola-online/source/browse/trunk/agricola-online-flex/src/main/flex/org/liveboardgames/common/dictionary/collections/HashCollection.as).
 Wh






[flexcoders] question about inheritance and events and overriding methods

2010-01-17 Thread Tim Romano
Let's say I have a class MYHTTPSERVICEBASE which extends 
mx.rpc.http.HTTPService.  This base class of mine checks whether it is 
being run in debug mode or release, and sets the base URL to localhost 
or the remote host.  Then I have individual http service classes that 
extend MYHTTPSERVICEBASE.

I want my http service layer to dispatch messages that my GUI layer will 
be listening for:

 publicfunction execute() : void {
 myResponder = new AsyncResponder(onResult, onFault);
 this.resultFormat= HTTPService.RESULT_FORMAT_TEXT;
 var token:  AsyncToken = this.send();
 token.addResponder(myResponder);
 }

privatefunction onResult(e:ResultEvent, token:Object=null):void {
  // Got Data? then instantiate and dispatch a bubbling event 
object that encapsulates the data
 // the GUI layer will be listening for this event
   }

Questions:
Can the event object  be dispatched from within the MYHTTPSERVICEBASE? 
Will the GUI hear it if it's dispatched from the base class?

In a class that extends MYHTTPSERVICEBASE, can I override the onResult() 
method that has been registered with the Responder by the base class?


Thanks for the help!



RE: [SPAM] [flexcoders] How long does it take to learn Flex and get a job?

2010-01-17 Thread Tracy Spratt
That question has no answer.  When will you know that have you learned
Flex?  I am not sure I have learned Flex and I have been writing production
applications for seven years.

 

You say 1 year, but how many hours a day?  If you write Flex apps for
forty hours a week for a year, then I would be confident you could qualify
for an entry level (whatever that is) position.  If you spend four hours a
week, I would not be so confident.

 

And there is much more to software development than just coding.

 

But still, go for it.  Don't wait until you have learned Flex.  Once you
get the basics of the language, start trying to find a job.  The pressures
of deliverables, deadlines, designer/client negotiation and solving business
problems are what will really make you learn a language. 

 

And I have found that resources like flexcoders can make me look a lot
smarter than I really am!

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of fred44455
Sent: Saturday, January 16, 2010 9:43 PM
To: flexcoders@yahoogroups.com
Subject: [SPAM] [flexcoders] How long does it take to learn Flex and get a
job?

 

  

I am new to Flex and started learning Flex 3 months ago. I have no
programming background. I wonder how long does it take to learn Flex and how
long will take me before I can apply for an entry level position? I gave
myself 1 year but I wonder if it is a realistic time frame? Thanks for your
time.

Fred.





Re: [flexcoders] question about inheritance and events and overriding methods

2010-01-17 Thread Aaron Hardy
I'll take a crack at it.

Can the event object be dispatched from within the MYHTTPSERVICEBASE?
Sure.  I think there may be a separate underlying question here though.  Are
you asking how?  Maybe you can clarify?

Will the GUI hear it if it's dispatched from the base class?
First of all, if the service classes you're talking about aren't on a
display list (it's very likely they are NOT) then an event doesn't bubble in
the traditional sense.  Nothing will hear the event unless it specifically
has added an event listener to your service object.  So if you want any view
component to hear the event being dispatched by your service object, the
view component will need to add an event listener to your service object.
Depending on the framework you're using, there may be some other mechanism
whereby the view can hear about a command's completion.   Something else you
can do (though some architecture developers will cringe) is dispatch the
event off the stage, the system manager, or the base application from your
command and then the view would add an event listener to whichever object
that is.

In a class that extends MYHTTPSERVICEBASE, can I override the onResult()
method that has been registered with the Responder by the base class?
Yes.  In the case of your sample code, if you override onResult in your
class that extends MYHTTPSERVICEBASE, it is the overriding function that is
passed into the responder.  That is, when you reference onResult, you're
referencing the most extended onResult function, not just the onResult
function in the class from which onResult is referenced.

I hope that makes sense.  It's very likely I misinterpreted your questions.

Aaron


On Sun, Jan 17, 2010 at 5:30 AM, Tim Romano tim_rom...@yahoo.com wrote:



 Let's say I have a class MYHTTPSERVICEBASE which extends
 mx.rpc.http.HTTPService. This base class of mine checks whether it is
 being run in debug mode or release, and sets the base URL to localhost
 or the remote host. Then I have individual http service classes that
 extend MYHTTPSERVICEBASE.

 I want my http service layer to dispatch messages that my GUI layer will
 be listening for:

 public function execute() : void {
 myResponder = new AsyncResponder(onResult, onFault);
 this.resultFormat= HTTPService.RESULT_FORMAT_TEXT;
 var token: AsyncToken = this.send();
 token.addResponder(myResponder);
 }

 private function onResult(e:ResultEvent, token:Object=null):void {
 // Got Data? then instantiate and dispatch a bubbling event
 object that encapsulates the data
 // the GUI layer will be listening for this event
 }

 Questions:
 Can the event object be dispatched from within the MYHTTPSERVICEBASE?
 Will the GUI hear it if it's dispatched from the base class?

 In a class that extends MYHTTPSERVICEBASE, can I override the onResult()
 method that has been registered with the Responder by the base class?

 Thanks for the help!

  



Re: [flexcoders] Can a canvas be scrollable without the scrollbars?

2010-01-17 Thread Aaron Hardy
I recently posted this in response to a similar question--sorry about that,
not trying to spam.  But this could help you out:
http://aaronhardy.com/flex/standalone-scrollbar/

If, in the example, you set the scroll policies to false on the canvas
you'll see the canvas scrolling without internal scrollbars.

Good luck!

Aaron

On Fri, Jan 15, 2010 at 1:11 PM, flexaustin flexaus...@yahoo.com wrote:



 Anyone know of a way to set the horizontalScrollPolicy and
 verticalScrollPolicy both to false so that the scrollbars don't show, but
 still have the canvas scroll?

 I have content that inside the canvas that will always be larger than the
 canvas so I want to be able to scroll without showing any scrollbars.

 This is like the little zoom panel/control in the bottom right-hand corner
 of Google maps.

 thx, j

  



[flexcoders] e4x to Datagrid not removing the tags when rendered

2010-01-17 Thread Quintjer
Hello all,
  I am importing an xml file in air to a datagrid but the data in the grid 
is still showing the tags.  I have tried everying that I can think of.  Earlier 
I tried imporing the file using HTTP server as an object and then got the data 
to display properly at that point but this has be be imported as xml.  AnyIdeas 
are greatly appreciated.



[flexcoders] Binding and Spark Skins

2010-01-17 Thread amiller.demandlending
Hi Everyone,

I have a sub-component which uses a String binding on a Label. The bindings 
works fine if I do not use a skinClass on the host component. If I do use a 
SparkSkin, my bindings do not execute on the sub-component. Instead, I get the 
value which I initialized it to.

Am I doing something wrong, or is this expected behavior?

If this is expected behavior, then what is the purpose of a SparkSkin if I have 
to explicitly redeclare all my control code in the skin?

I could just be misunderstanding the intended usage, but from what I understood 
in the docs it seems like a very powerful new feature.

Would anyone be able to enlighten me on the topic a bit more?


Here is the trimmed code for my host/sub

Host Component

s:SkinnableContainer skinClass=demand.skins.DSDoc 
fx:Metadata
[SkinState(normal)]
/fx:Metadata
fx:Script
![CDATA[   
[SkinPart(required=false)]
public var titleBar:IReportTitleBar

override protected function createChildren():void
{
if (!_titleBar)
{
_titleBar = new DCDocTitleBar();

this.addElementAt(IVisualElement(_titleBar), 0);
}
super.createChildren();
}
]]
/fx:Script
/s:SkinnableContainer
---

The title bar sub-component

s:SkinnableContainer 
fx:Script
![CDATA[
[Bindable]
public var label:String=Incorrect Label;
]]
/fx:Script
s:Label text={this.label}/
/s:SkinnableContainer


The host component skin

s:SparkSkin 
fx:Metadata
[HostComponent(demand.reports.DRDoc)] 
/fx:Metadata
s:states
s:State name=normal/
/s:states
controls:DCDocTitleBar id=titleBar /
/s:SparkSkin



Thanks in advance!

~Aaron



[flexcoders] Image Bounding Box

2010-01-17 Thread criptopus
When I place an image that is 400px x 200px inside a box that is 100px x 100px 
the image shrinks to 100px x 50px to fit inside the box as it should. Now I am 
trying to place a number of these boxes above each other and having the 50px of 
blank space is not good so I tried removing the height property expecting the 
bounding box to snap in to 50px well it didn't it snapped out to 200px the 
height of the original box before scaling.

How on earth do you get the box's bonding box to fit the image. I tried to 
detect the image height but it just said it was 0. Not helpful.

Any clues?

- Stephen Brown.



RE: [SPAM] [flexcoders] e4x to Datagrid not removing the tags when rendered

2010-01-17 Thread Tracy Spratt
First, the DataGrid dataProvider itself must be some kind of list.  It can
be an ArrayCollection, an XMLListCollection, an Array or XMLList(avoid these
if you plan to programmatically update the dataProvider)

 

There are two ways to get an HTTPService result into a dataProvider.  One is
to bind to lastResult.avoid this. Instead, use a resultHandler to assign the
appropriate list type to a variable, and bind to that.

 

If you dataProvider is valid, you might have just forgotten to specify the
dataField for the columns.

 

If you are setting that property, then you need to know that dataField can
only handle a string, not an expression, and the property specified must be
a top-level property of the dataProvider item.  If the dataProvider items
are XML nodes, the datafield must specify a first-level childNode(data in
the text node of that node) or an attribute.  If it is an attribute then you
need to use the @ symbol.  Example: dataField=@myAttribute.

 

Hope this helps.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Quintjer
Sent: Sunday, January 17, 2010 10:49 AM
To: flexcoders@yahoogroups.com
Subject: [SPAM] [flexcoders] e4x to Datagrid not removing the tags when
rendered

 

  

Hello all,
I am importing an xml file in air to a datagrid but the data in the grid is
still showing the tags. I have tried everying that I can think of. Earlier I
tried imporing the file using HTTP server as an object and then got the data
to display properly at that point but this has be be imported as xml.
AnyIdeas are greatly appreciated.





[flexcoders] Re: Image Bounding Box

2010-01-17 Thread criptopus
mx:Image id=img width=80 source=Image.png
complete=img.height = img.content.height / img.content.width * 80/

Got it working, here is the solution in case anybody else has the problem.

- Stephen



Re: [flexcoders] question about inheritance and events and overriding methods

2010-01-17 Thread Tim Romano
Thank you, Aaron, for the helpful answers. My intention would be to have 
each of the descendants of MYHTTPSERVICEBASE point to a different 
destination and raise an event specific to that destination, and to have 
a separate listeners for each kind of event. If I've understood you 
correctly, there is no need for each of the descendants to instantiate 
their own Responder and no requirement for them to override the base 
execute() method too.


Tim

/* this method is in the descendant class and overrides the base method */
private overrides function onResult(e:ResultEvent, 
token:Object=null):void {

   // raise a specific event
  }

/* these two methods are in the base class */
publicfunction execute() : void {
myResponder = new AsyncResponder(onResult, onFault);
this.resultFormat= HTTPService.RESULT_FORMAT_TEXT;
var token:  AsyncToken = this.send();
token.addResponder(myResponder);
}

privatefunction onResult(e:ResultEvent, token:Object=null):void {
   // this method is overridden by descendants
  }



On 1/17/2010 3:38 PM, Aaron Hardy wrote:


I'll take a crack at it.

Can the event object be dispatched from within the MYHTTPSERVICEBASE?
Sure.  I think there may be a separate underlying question here 
though.  Are you asking how?  Maybe you can clarify?


Will the GUI hear it if it's dispatched from the base class?
First of all, if the service classes you're talking about aren't on a 
display list (it's very likely they are NOT) then an event doesn't 
bubble in the traditional sense.  Nothing will hear the event unless 
it specifically has added an event listener to your service object.  
So if you want any view component to hear the event being dispatched 
by your service object, the view component will need to add an event 
listener to your service object.  Depending on the framework you're 
using, there may be some other mechanism whereby the view can hear 
about a command's completion.   Something else you can do (though some 
architecture developers will cringe) is dispatch the event off the 
stage, the system manager, or the base application from your command 
and then the view would add an event listener to whichever object that is.


In a class that extends MYHTTPSERVICEBASE, can I override the 
onResult() method that has been registered with the Responder by the 
base class?
Yes.  In the case of your sample code, if you override onResult in 
your class that extends MYHTTPSERVICEBASE, it is the overriding 
function that is passed into the responder.  That is, when you 
reference onResult, you're referencing the most extended onResult 
function, not just the onResult function in the class from which 
onResult is referenced.


I hope that makes sense.  It's very likely I misinterpreted your 
questions.


Aaron






Re: [flexcoders] question about inheritance and events and overriding methods

2010-01-17 Thread Aaron Hardy
I'm not sure I understand your question clearly but if I assume correctly I
think the answer will be yes, there is no need for each descendant to
instantiate its own responder.

Aaron

On Sun, Jan 17, 2010 at 6:37 PM, Tim Romano tim_rom...@yahoo.com wrote:



 Thank you, Aaron, for the helpful answers. My intention would be to have
 each of the descendants of MYHTTPSERVICEBASE point to a different
 destination and raise an event specific to that destination, and to have a
 separate listeners for each kind of event. If I've understood you correctly,
 there is no need for each of the descendants to instantiate their own
 Responder and no requirement for them to override the base execute() method
 too.

 Tim

 /* this method is in the descendant class and overrides the base method */
 private overrides function onResult(e:ResultEvent, token:Object=null):void
 {
// raise a specific event
   }

 /* these two methods are in the base class */

 publicfunction execute() : void {
 myResponder = new AsyncResponder(onResult, onFault);
 this.resultFormat= HTTPService.RESULT_FORMAT_TEXT;
 var token:  AsyncToken = this.send();
 token.addResponder(myResponder);
 }

 privatefunction onResult(e:ResultEvent, token:Object=null):void {
// this method is overridden by descendants

   }



 On 1/17/2010 3:38 PM, Aaron Hardy wrote:



 I'll take a crack at it.

 Can the event object be dispatched from within the MYHTTPSERVICEBASE?
 Sure.  I think there may be a separate underlying question here though.
 Are you asking how?  Maybe you can clarify?

 Will the GUI hear it if it's dispatched from the base class?
 First of all, if the service classes you're talking about aren't on a
 display list (it's very likely they are NOT) then an event doesn't bubble in
 the traditional sense.  Nothing will hear the event unless it specifically
 has added an event listener to your service object.  So if you want any view
 component to hear the event being dispatched by your service object, the
 view component will need to add an event listener to your service object.
 Depending on the framework you're using, there may be some other mechanism
 whereby the view can hear about a command's completion.   Something else you
 can do (though some architecture developers will cringe) is dispatch the
 event off the stage, the system manager, or the base application from your
 command and then the view would add an event listener to whichever object
 that is.

 In a class that extends MYHTTPSERVICEBASE, can I override the onResult()
 method that has been registered with the Responder by the base class?
 Yes.  In the case of your sample code, if you override onResult in your
 class that extends MYHTTPSERVICEBASE, it is the overriding function that is
 passed into the responder.  That is, when you reference onResult, you're
 referencing the most extended onResult function, not just the onResult
 function in the class from which onResult is referenced.

 I hope that makes sense.  It's very likely I misinterpreted your questions.

 Aaron


  



Re: [flexcoders] What server do I put my crossdomain.xml file on?

2010-01-17 Thread sasuke


Matthew-104 wrote:
 
 Hi - 
 
 I have a Flex app that uses an HTTPService to call a Servlet. The servlet
 retrieves a file on another domain and passes back to Flex where they are
 prompted by a Windows dialog to either save or open it: It works fine
 locally. 
 
 When deployed, I get this error:
 
 Error #2044: Unhandled SecurityErrorEvent:. text=Error #2048: Security
 sandbox violation: http://bopswdmmk1:15010/oats/FlexClient/OATSMain.swf
 cannot load data from
 http://da803299:8080/oats/FTPFile?filename=/oats/oatsftp/feed/Session.csv.01062010.
 
Hi there,

In our project we resolved this issue by making the servlet stream the file
to the Flex client (by opening the file and writing its contents to the
outputstream) instead of re-directing the client to the file server
(response.sendRedirect). This approach IMO has the advantage of the client
being unaware of the exact location as to where the files are stored along
with saving yourself the trouble of creating a crossdomain.xml file for your
file servers. Of course, YMMV. :-)

-sasuke

-- 
View this message in context: 
http://old.nabble.com/What-server-do-I-put-my-crossdomain.xml-file-on--tp27168580p27205916.html
Sent from the FlexCoders mailing list archive at Nabble.com.



[flexcoders] Advanced Datagrids and sortCompareFunctions for columns with custom sort compare function

2010-01-17 Thread sasuke

Hi all,

I have an Advanced datagrid(ADG) which displays nested data. The problem
comes when I use HierarchicalData as the dataprovider for my ADG instead of
a simple ArrayCollection; in this case the column sort functionality ceases
to work and this happens for those columns which have a custom sort compare
function specified for them. Is there any known issue with ADG which can
cause this sort of behaviour? Here is the markup I'm using:

mx:Script
![CDATA[
import 
mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;

import mx.utils.ObjectUtil;
import mx.collections.ArrayCollection;

[Bindable]  
private var dp:ArrayCollection;

private function onComplete(event:Event):void
{
var arr:Array = [
{ 'data':
{ 'name': 'tataku', 'date': new 
Date(2009, 12, 4), 'amt': 123.45 },
  'outer': 'hithere'
},
{ 'data':
{ 'name': 'Taka', 'date': new 
Date(2009, 12, 1), 'amt': 555.45 },
  'outer': 'ytheere'
},
{ 'data':
{ 'name': 'chamaku', 'date': new 
Date(2009, 12, 2), 'amt': 889.334 },
  'outer': 'athere'
}
];
dp = new ArrayCollection(arr);
}

private function amtLabelFunc(itemA:Object,
column:AdvancedDataGridColumn):String
{
return itemA.data.amt;
}

private function amtCompareFunc(itemA:Object, itemB:Object):int
{
return ObjectUtil.compare(itemA.data.amt, 
itemB.data.amt);
}

private function dateLabelFunc(itemA:Object,
column:AdvancedDataGridColumn):String
{
return itemA.data.date;
}

private function dateCompareFunc(itemA:Object, itemB:Object):int
{
return ObjectUtil.dateCompare(itemA.data.date as Date, 
itemB.data.date as
Date);
}

private function nameLabelFunc(itemA:Object,
column:AdvancedDataGridColumn):String
{
return itemA.data.name;
}
]]
/mx:Script

mx:AdvancedDataGrid width=100% variableRowHeight=true
sortExpertMode=true id=myAdg
defaultLeafIcon={null} folderClosedIcon={null} 
folderOpenIcon={null}
height=97%
creationComplete=onComplete(event) sortableColumns=true
!-- replacing the below HierarchicalData with ArrayCollection restores 
the
default behaviour! --
mx:dataProvider
mx:HierarchicalData source={dp} /
/mx:dataProvider
mx:columns
mx:AdvancedDataGridColumn headerText=Amount
labelFunction=amtLabelFunc
sortable=true sortCompareFunction=amtCompareFunc /
mx:AdvancedDataGridColumn headerText=Date 
labelFunction=dateLabelFunc
sortCompareFunction=dateCompareFunc /
mx:AdvancedDataGridColumn headerText=Name 
labelFunction=nameLabelFunc
/
mx:AdvancedDataGridColumn headerText=Name dataField=outer 
/
/mx:columns
/mx:AdvancedDataGrid

Any ideas/suggestions greatly appreciated.

TIA,
sasuke
-- 
View this message in context: 
http://old.nabble.com/Advanced-Datagrids-and-sortCompareFunctions-for-columns-with-custom-sort-compare-function-tp27205919p27205919.html
Sent from the FlexCoders mailing list archive at Nabble.com.