Re: [flexcoders] Re: Httpservices as3 class

2010-03-10 Thread Tim Romano
Do I infer correctly that your HTTPService is working properly but that 
you're having problems when binding the results to the GUI?

You can see the data that has been returned?

Are you using ResultEvent or AsyncResponder? If you're using 
AsyncResponder with the public release of the beta, note below:


// these handlers stubs are necessary because of Adobe bug 
http://bugs.adobe.com/jira/browse/SDK-22883

protected function onFaultEventHandler(e:FaultEvent): void{};
protected function onResultEventHandler(e:ResultEvent):void {};


 overrideprotected  function  onResult(e:ResultEvent , 
token:Object=null):void {


var ans: String = decodeURI(e.result.toString());// 
UTF-8 to string


// I am using JSON, not XML, and here the results are 
converted to an ArrayCollection
// and then an event is dispatched which the GUI is 
listening for, passing the ArrayCollection


}

}


Regards
Tim Romano


On 3/9/2010 10:00 AM, valdhor wrote:



 Does anybody have a httpservice class, implemented in as3, for flahs 
builder

 4?
 I am trying to create an application in as3, connecting and returnig 
dynamic

 data from php...
 So I need to have my hhtpservice created at runtime and calling my data
 functions dynamically...
 snip
 I tried to created one, but I have some problems when loading and 
setting

 data to my dataproviders...






Re: [flexcoders] Need to filter UTF-8 characters from string

2010-03-10 Thread Tim Romano

On 3/9/2010 2:29 AM, flex flex wrote:

I have a string of which contains lots of special characters from 
different standerds. I want to filter the string and want only those 
characters which are supported by UTF-8.

Does anyone have any idea for this?
I have a sample string as-
!#x22;#$%#38;#x27;()*+,-./0123456789:;#x3C;=#x3E;@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~#x22;#x27;#38;#x3C;#x3E;¡¢£¤¥¦§¨©ª#x22;®¯°±²³´µ·¸¹º#x22;¼½¾¿×÷ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿOEoeS(s(Yf^~--#x27;#x27;,#x22;#x22;#x22;+++o...0/00EUR^(TM)




http://en.wikipedia.org/wiki/UTF-8

Regards
Tim Romano


[flexcoders] My Flex app seems to have stopped working in Firefox after installing latest Windows security patches

2010-03-04 Thread Tim Romano
This morning I installed several Windows XP and IE security patches 
(list below).

The Flex app I've been developing, which uses HTTPService to get 
JSON-formatted results from a webservice, seems to have stopped working 
in Firefox 3.6 (yet it still works in IE and in Opera).

2010-03-0408:39:42:234 900 70Agent  * Updates to 
install = 4
2010-03-0408:39:42:625 900 70Agent  *   Title = 
Security Update for Windows XP (KB972270)
2010-03-0408:39:42:625 900 70Agent  *   Title = 
Update for Microsoft Silverlight (KB979202)
2010-03-0408:39:42:625 900 70Agent  *   Title = 
Update for Windows XP (KB955759)
2010-03-0408:39:42:625 900 70Agent  *   Title = 
Cumulative Security Update for Internet Explorer 8 for Windows XP (KB978207)

Anyone else having similar problems?
Thanks
Tim Romano





Re: [flexcoders] Strategies for switching between testing and deployment addresses

2010-02-24 Thread Tim Romano
I'm too new at Flex to do anything fancy like reading files from the O/S 
file system, so I use the Project compile option.


-locale en_US -define=CONFIG::debug,true

Then I have me some constants:

   public static  const DEBUGMODE:Boolean =  CONFIG::debug;
   public static const DEBUG_BASEURL:String = http://localhost/foo/;
   public static const RELEASE_BASEURL:String = 
http://www.somedomain.com/foo;;


And then in my wrapper for the HTTPService:


if ( SearchConstants.DEBUGMODE) {
baseURL = SearchConstants.DEBUG_BASEURL ;
}else{
baseURL= SearchConstants.RELEASE_BASEURL ;
}

All you have to do is change the compiler settings to debug, false and 
-- voilà -- or wa-la if you like that better. There's still the 
forgetting to change the compiler options issue, but it's probably a 
good habit to examine the Compiler options before each compile, and this 
approach inculcates a good habit.


Take this with a grain of salt; I'm new to Flex; my expertise, if I have 
any at all, is not in Flex programming.

Regards
Tim Romano




On 2/21/2010 8:00 PM, David Adams wrote:


I've been writing some small programs that use HTTPService calls to
fetch data from a back-end. During testing, I'm using 127.0.0.1 or an
IP address on my subnet. When I deploy, I update the IP address in
service definitions to the right external address and build the app.
Or at least I mean to. It's all too easy to accidentally change the
addresses for internal testing and then forget to switch them back
before building.

Is there a best practice or simple strategy for putting the IP address
somewhere outside of the source code that it can easily be edited
without a rebuild?

Thanks for any advice.

__




Re: [flexcoders] SQL Question

2010-02-22 Thread Tim Romano
Hard to know for sure from the way you've put the question, but the IN 
lists seem malformed to me.


Correct:
IN (a, b, c)

Incorrect:
 (a, b, c)

Regards
Tim Romano




On 2/20/2010 6:04 PM, Wally Kolcz wrote:


I know this is out of the core topic, but I am banging my head on this
simple issue..or probably is...

I am trying to write a SQL query (in ColdFusion) for my database (MySQL
5) when I am looking for a passed in argument value in the column (which
is set as a varchar).

I am passing in '0' for the ageGroup and 'kids' for the accountType I
have 'kids'

My Query is:

Select CONCAT(roomDisplay, (National)) as roomDisplay,
CONCAT(cfqueryparam value=#arguments.ageGroup#,
-, roomDisplay, -, National) as roomID
FROM chatrooms
WHERE cfqueryparam value=#arguments.accountType# IN
(accountType)
AND cfqueryparam value=#arguments.ageGroup#
cfsqltype=cf_sql_integer / IN (ageGroups)
ORDER BY roomDisplay ASC

I have a record where 'ageGroups' is '0, 1, 2, 3, 4, 5, 6, 7, 8' and the
'accountType' is 'kids, siblings, parents'

I keep getting 0 returns but I know both values exist in at least 1 record

What am I doing wrong?





No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.435 / Virus Database: 271.1.1/2702 - Release Date: 02/21/10 
19:34:00

   




[flexcoders] best place to make feature requests

2010-02-10 Thread Tim Romano
Where's the best place to make feature requests for FlashBuilder?
Thanks


[flexcoders] ExternalInterface : debugging, DOM, Export Release Build

2010-02-10 Thread Tim Romano
My browser-deployed Flex app, built in FB4, is using the 
ExternalInterface. The Flex app gets some search terms from the user, 
goes out to a webservice for some data, and then pushes some html markup 
out to a DIV in the HTML document using the ExternalInterface.call() 
method.
I send the content across the bridge as a parameter to javascript 
function that appends a child to the target DIV. Nice and simple with 
the EI. However, I have a couple of questions about the logistics of 
developing this sort of application in FlashBuilder.

When Export Release Build is chosen from the Project menu in FB4, it 
destroys and recreates the HTML deployment wrapper for the SWF. Is there 
any way for the developer to provide an HTML document template to FB, 
marked up with comments/metadata tags, such that only the Adobe 
browser-sniffing code and SWF-embed code gets overwritten but the rest 
of the HTML document (the user-portion) remains intact?

Also, is it possible to set up a project in FB4 that uses the 
ExternalInterface, where you can step through code in the debugger and 
also see pushed content being rendered in the HTML document hosting the 
SWF?  In debug mode it seems not possible to work with your actual HTML 
host document and its javascript functions-- or am I missing something 
obvious? I am pretty new to FB and that could easily be the case.

Finally, will future versions of the ExternalInterface expose the DOM of 
the hosting document via ActionScript object wrappers?

Thanks






Re: [flexcoders] HTTPService token: a bug or by design?

2010-02-09 Thread Tim Romano

To answer my own dumb question.

var token: AsyncToken;
token = send();
var myResponder : AsyncResponder= new AsyncResponder(onResult, onFault, 
token);

token.addResponder(myResponder);
function onResult(e:ResultEvent , token:Object=null):void {}



On 2/8/2010 6:05 PM, Tim Romano wrote:


I've run into one bug in the mx.rpc.http.HTTPService class in FB4 beta
2 -- the AsyncResponder's onResult function fires *twice* unless you
wire up a dummy eventhandler. And so I am wondering if the following is
not also a bug:

var myResponder : AsyncResponder= new AsyncResponder(onResult, onFault);
var token: AsyncToken;
token = send();
token.addResponder(myResponder);
function onResult(e:ResultEvent , token:Object=null):void {}

The token parameter is always null in the onResult function. Isn't that
parameter supposed to contain the token to which the Responder was added?

Thanks
Tim Romano







[flexcoders] HTTPService token: a bug or by design?

2010-02-08 Thread Tim Romano
I've run into one bug in the mx.rpc.http.HTTPService class  in FB4 beta 
2   -- the AsyncResponder's onResult function fires *twice* unless you 
wire up a dummy eventhandler.  And so I am wondering if the following is 
not also a bug:

var myResponder : AsyncResponder= new AsyncResponder(onResult, onFault);
var token: AsyncToken;
token = send();
token.addResponder(myResponder);
function  onResult(e:ResultEvent , token:Object=null):void {}

The token parameter is always null in the onResult function. Isn't that 
parameter supposed to contain the token to which the Responder was added?

Thanks
Tim Romano



Re: [flexcoders] Steve Jobs on Flash .......

2010-02-06 Thread Tim Romano
If the rumors about Bing are true, then this panning could also have 
something to do with Silverlight. If I were at MSFT and my role was to 
ensure that Silverlight succeeded in knocking Flash off (as Word knocked 
off WordPerfect back in the day, e.g.) then I'd be looking for chinks in 
Adobe's armor wherever they may be.


On 2/1/2010 2:26 PM, Paul Andrews wrote:


It's just commercial tactics.

You'd never guess he has his own tied-in development system to support.
Why wouldn't he knock flash?

hworke wrote:
 
http://news.yahoo.com/s/pcworld/20100201/tc_pcworld/stevejobsdissesapplerivalsduringtownhallmeeting 
http://news.yahoo.com/s/pcworld/20100201/tc_pcworld/stevejobsdissesapplerivalsduringtownhallmeeting



 Jobs has previously called out Adobe Flash, currently the
 dominant animation platform on the Web, for being too slow to be 
useful and Flash Lite, Adobe's versio n of Flash for mobile devices, 
as not advanced enough for the iPhone. So it's no surprise to hear 
Jobs called out Flash during Apple's Town Hall, but his language this 
time sounds a little over the top. Jobs reportedly called Adobe a lazy 
company, and said that when a Mac crashes it's usually because of Flash.


 Whether or not that's true, it's clear that Jobs is not a fan of 
Adobe's multimedia platform. The iPhone is routinely criticized for 
its inability to render Flash-based Web pages, videos and games, and 
early criticisms about the iPad also decry the lack of Flash 
compatibility on Apple's latest device.










[flexcoders] rendering HTML markup in AdvancedDataGrid

2010-02-06 Thread Tim Romano
I am considering using an AdvancedDataGrid in hierarchical mode but am 
not sure it can do what my app needs to do, or if it can, whether the 
approach will be efficient--execute quickly and use up a lot of memory. 
I haven't worked with the AdvancedDataGrid before.

The grid will look like this:

[v] Category A
   [v]  Title 1
* passage one blah blah blah
* passage two
[v] Title 2
[v] Title 3
 .
 .
 .
   [v]  Title n

[v]Category B
   [v]  Title 1
   [v]  Title 2
   [v]  Title 3
 .
 .
 .
 Title n
etc
etc

When the user clicks on a Title node to expand it, some passages 
excerpted from the corresponding document would be fetched from the 
database, already formatted as HTML like this:

span class='foo'this is an excerpt span class='abc'100 to 
1000/span characters in length/span.

A style sheet  must control how the css classes in the passage excerpts 
are rendered. The grid might have as many as 100 rows, and each row 
could contain a couple of  paragraphs of html text.  Up to 1K each, but 
more typically around 100-200 characters.

If I create an item-renderer using TextArea, will 100 TextAreas be 
created if the grid has 100 Title rows even if only 3 titles are 
expanded by the user? Or are the item renderers created only for the 
rows that actually get expanded and displayed? Is there another way to 
render HTML markup in the ADG?

Thanks


Re: [SPAM] [flexcoders] rendering HTML markup in AdvancedDataGrid

2010-02-06 Thread Tim Romano

Thanks for the reply, Tracy, about the ItemRenderers.

+1 on the htmlText warning. I've used the htmlText of the TextArea in an 
AIR app, which I'm converting from local DB to webservice mode now. The 
html rendering in Flex of the sort of html markup example I gave below 
is better than bad but is far from rich. Adobe gets a very low passing 
grade from me on its htmlText + CSS rendering in Flex. I don't need 
typographic control (kerning, ligatures, etc) but I do want support for 
basic CSS-- I could never get padding and margins to work. Font-family, 
bold, italics, font-size do work.


Tim



On 2/6/2010 2:08 PM, Tracy Spratt wrote:


Item Renderers are only created for the visible rows plus a few 
buffers.  Performance is primarily determined by the rendering and 
item data access.


Be aware that htmlText only renders a small subset of html tags.

Tracy Spratt,

Lariat Services, development services available



*From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] 
*On Behalf Of *Tim Romano

*Sent:* Saturday, February 06, 2010 12:36 PM
*To:* flexcoders@yahoogroups.com
*Subject:* [SPAM] [flexcoders] rendering HTML markup in AdvancedDataGrid

I am considering using an AdvancedDataGrid in hierarchical mode but am
not sure it can do what my app needs to do, or if it can, whether the
approach will be efficient--execute quickly and use up a lot of memory.
I haven't worked with the AdvancedDataGrid before.

The grid will look like this:

[v] Category A
[v] Title 1
* passage one blah blah blah
* passage two
[v] Title 2
[v] Title 3
.
.
.
[v] Title n

[v]Category B
[v] Title 1
[v] Title 2
[v] Title 3
.
.
.
Title n
etc
etc

When the user clicks on a Title node to expand it, some passages
excerpted from the corresponding document would be fetched from the
database, already formatted as HTML like this:

span class='foo'this is an excerpt span class='abc'100 to
1000/span characters in length/span.

A style sheet must control how the css classes in the passage excerpts
are rendered. The grid might have as many as 100 rows, and each row
could contain a couple of paragraphs of html text. Up to 1K each, but
more typically around 100-200 characters.

If I create an item-renderer using TextArea, will 100 TextAreas be
created if the grid has 100 Title rows even if only 3 titles are
expanded by the user? Or are the item renderers created only for the
rows that actually get expanded and displayed? Is there another way to
render HTML markup in the ADG?

Thanks





No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.435 / Virus Database: 271.1.1/2671 - Release Date: 02/06/10 
07:35:00

   




[flexcoders] my HTTPService POSTs are showing up as GETs in FB4 beta 2: is POST implemented?

2010-01-25 Thread Tim Romano
I would be grateful if someone could confirm that HTTPService POST 
actually works in FB4 beta 2.When I set the method = POST, the 
header shows up as a GET in the Fiddler traffic monitor, and so the 
parameters I'm trying to send to the remote server never arrive; only 
the name/value pairs in the query string arrive at the destination URL.

Thanks


[flexcoders] Dog woofs, Cat meows; can the same listener listen to either and how do you remove the eventlistener?

2010-01-23 Thread Tim Romano
The question is at the very bottom. Here's the scenario:

Let's say I have a base class Animal, and subclasses Dog and Cat that 
extend Animal.
Animal has a protected Speak() method which Dog and Cat each override: 
when aDog instance and aCat Speak(), they each raise an event, a 
CreatureSpeakingEvent.


class Dog extends Animal {
override protected class Speak() {
  var sound:String = woof;
   var eventObj:CreatureSpeakingEvent = new CreatureSpeaking ( 
CreatureSpeakingEvent, sound,  true, false );
 this.dispatchEvent(eventObj);
}
}

class Cat extends Animal {
override protected class Speak() {
  var sound:String=meow;
   var eventObj:CreatureSpeakingEvent = new CreatureSpeakingEvent ( 
CreatureSpeakingEvent, sound,  true, false );
 this.dispatchEvent(eventObj);
}
}

In the main class, which can instantiate either or both of these 
animals, a listener is attached to the CreatureSpeakingEvent event:

var aDog = new Dog();
var aCat = new Cat();
aDog.addEventListener(CreatureSpeakingEvent, onCreatureSpeaking);
aCat.addEventListener(CreatureSpeakingEvent, onCreatureSpeaking);

The onCreatureSpeaking() function listens:

private function onCreatureSpeaking(e:CreatureSpeakingEvent) {
//  is the following cast to the base-class Animal acceptable?
Animal (e.target).removeEventListener(CreatureSpeakingEvent, 
onCreatureSpeaking);
}


Thanks for the help!
Tim




Re: [flexcoders] Problem losing values from query results to RESULT.DATA

2010-01-20 Thread Tim Romano

What happens if you don't put any quotes around the column aliases?
Tim

On 1/19/2010 4:55 PM, charliecrystle wrote:


Weird issue:

I have a query that works fine--produces expected results:
SELECT COUNT(tagsLU.tagid) as 'tagcount', tag.tagname as 'tagname' 
FROM TagsLU Inner Join tag on tag.tagid=tagslu.tagid Group By 
tag.tagname Order By tagcount DESC






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

2010-01-19 Thread Tim Romano
Thanks very much, Aaron, for taking the time to compile the code on your 
end. Without your help, I'd have been spinning my wheels on this for days


It appears to be a compiler/debugger bug  in beta 2.  I started 
commenting out code and recompiling and then uncommenting and 
recompiling and eventually the error icon jumped to a line with no code 
on it at all. So I closed FB completely and reopened it and  the code 
compiled and I was able to debug it.


I got rid of the calls to super() BTW and moved the params parameter out 
of the constructor to the execute() function.


Tim


On 1/18/2010 9:10 PM, Aaron Hardy wrote:


I just tried it on my machine and it compiled without any problems 
after I took out the dependencies I didn't have access to.  I never 
got the error you mentioned.  Maybe it's referring to something else?  
Cut everything out of your project (maybe make a new one) except the 
onResult function you believe may be the cause and see if you still 
get the error.  I suspect you won't.  Good luck!


Aaron






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

2010-01-18 Thread Tim Romano
I am having trouble with an override, getting Method marked override 
must override another method.


No problem at all doing this:

in the BASE CLASS:
protected  function foo(): void{}
in the SUBCLASS
override protected function foo(): void{}


But the error given above occurs here:
in the BASE CLASS
protected  function  onResult(e:ResultEvent, token:Object=null):void {}
in the SUBCLASS
   override protected function  onResult(e:ResultEvent, 
token:Object=null):void {}



I don't see why it's not working. All of the requirements set out here 
seem to be satisfied:

http://livedocs.adobe.com/flex/3/html/help.html?content=04_OO_Programming_11.html

 I've included the class implementations below. Is the cause of the 
error evident?


Thanks again for the help, it's appreciated doubly because I'm stumped 
by this.

Tim
=== BASE CLASS ==
package TESTREST
{
import mx.rpc.http.HTTPService;
import mx.rpc.AsyncResponder;
import mx.rpc.AsyncToken;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;

import OEREST.events.*;
import OEUTIL.BindableArrayCollection;
import json.*;
import OEUTIL.SearchConstants;

public class MYHTTPSERVICEBASE extends HTTPService
{

private var _params: Object;
private function get Params(): Object {return _params;}
public function MYHTTPSERVICEBASE(destination: String, 
params:Object = null)

{

var _params: Object=params;
var baseURL: String;

if ( SearchConstants.DEBUGMODE) {
baseURL = SearchConstants.DEBUG_BASEURL ;
}else{
baseURL= SearchConstants.RELEASE_BASEURL ;
}

super(baseURL, destination);

}

public  function execute(): void {
var myResponder : AsyncResponder= new 
AsyncResponder(onResult, onFault);

this.resultFormat= HTTPService.RESULT_FORMAT_TEXT;


var token: AsyncToken;
if ( this.Params == null) {
this.method=GET;
 token = this.send();
} else {
this.method=POST;
token = this.send(Params);
}

token.addResponder(myResponder);
}

protected function foo(): void {}

protected function  onResult(e:ResultEvent, 
token:Object=null):void {}


protected function onFault(evt:FaultEvent, token: 
Object=null):void {}



}
}


== SUBCLASS 
package TESTREST
{
public class TestService extends TESTREST.MYHTTPSERVICEBASE
{

import mx.rpc.events.ResultEvent;

protected  const DEBUGMODE:Boolean =  CONFIG::debug;
protected const DEBUG_BASEURL:String = 
http://localhost/OESharpDeploy/;

protected const RELEASE_BASEURL:String = ;

import TESTREST.events.*;
import json.JParser;


public function TestService()
{
var dest: String =getServiceURL();

var selTitles : Array =new Array(1,2,3,4,5,6,7,8,9,10,11,12);
var ss:String = JParser.encode(selTitles);
var params:Object =  {selectedTitles: ss};

super( dest, params);
}



private  function getServiceURL(): String {
if (DEBUGMODE) {
return DEBUG_BASEURL + /SSQ.ashx ;
}else{
return RELEASE_BASEURL + /SSQ.ashx ;
}

}


override  protected function foo(): void{}

 override protected function  onResult(e:ResultEvent, 
token:Object=null):void {}



}
}




On 1/17/2010 10:49 PM, Aaron Hardy wrote:


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 
mailto: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

[flexcoders] not legal to override a function with an optional parameter, e.g. foo(s: String=null) ?

2010-01-18 Thread Tim Romano
I've been asking general questions about inheritance and am splitting 
this question off as a separate one because it's very specific.

It appears that you cannot override a function with optional parameters?

protected function foo(a:String, s:String=null): void {}

Isn't the signature considered the same if you do this?

override protected function foo(a:String, s:String=null): void{}


Thanks

Tim




[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: [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] HTTPService Responder ResultEvent -- how to know when the JSON data sent via HTTP are complete?

2010-01-13 Thread Tim Romano

Tracy,
Yes.  Thanks for the info.
Tim

On 1/13/2010 12:51 AM, Tracy Spratt wrote:


You are using Firefox, I bet.  I have sent this behavior and I think 
it is just a bug in FF.


Tracy Spratt,

Lariat Services, development services available


  The status bar says Transferring data from localhost... and that 
status message never goes away. sn ip




[flexcoders] HTTPService Responder ResultEvent -- how to know when the JSON data sent via HTTP are complete?

2010-01-12 Thread Tim Romano
I started learning FlashBuilder/Flex by diving in and writing an AIR 
application against SQLite with asynchronous connections and Responder objects. 
The responder's resultsHandler is passed a flash.data.SQLResult object that 
exposes a complete status property.  Lovely.

Now I am trying to rewrite that AIR application as a browser-deployed Flex app 
using an HTTPService against a RESTful webservice that returns JSON data. The 
webservice is working, and the Flex HTTPService is pulling the JSON string 
down, but there doesn't seem to be anything analogous to the complete 
property that was available with the asynch data connection in the AIR app.  
Not so lovely.

The result-handler specified in the HTTPService responder has two parameters, 
the ResultEvent and the AsyncToken. The ResultEvent exposes a statusCode 
property. The result-handler can be called more than once. The 
ResultEvent.statusCode = 200 each time the handler is called.  How do you know 
when the remote data are complete?

I will keep googling as I'm sure this question must be commonplace, but so far 
I haven't found the answer.

Thanks for the help.


Re: [flexcoders] HTTPService Responder ResultEvent -- how to know when the JSON data sent via HTTP are complete?

2010-01-12 Thread Tim Romano
Jeff,
Thanks for the reply. I am confused by the behavior of my Flex app. The status 
bar says Transferring data from localhost... and that status message never 
goes away. But, as you suggested, the data are complete:  I pop the raw JSON 
string returned by the webservice into a TextArea, and it's all there, a string 
literal representing an array of objects:[{...},{...},{...}], and the 
string literal decodes into a well-formed ActionScript array.

Is there something my results-handler has to do to clear that status message?
Tim


  


  Maybe I’m missing something here,
but to my understanding when the result event of your HTTP service fires, your
call IS complete.  You should have access to the json string that was
pulled back from the service.  Is there something else you need that the
json string doesn’t’ supply?

[flexcoders] Channel.Security.Error : guidance please

2010-01-05 Thread Tim Romano
 If I understand this document correctly:

http://kb2.adobe.com/cps/142/tn_14213.html

the Channel.Security.Error (Security error accessing url) that I get when 
trying to access a webservice hosted at www.flash-mx.com from my desktop 
FlashBuilder (beta 2) development environment is probably the result of there 
not being a crossdomain.xml policy file at the root of www.flash-mx.com that 
permits access from *.

mx:WebService id=webService 
 wsdl=http://www.flash-mx.com/ws/months.cfc?wsdl; 
mx:operation name=getMonths 
 resultFormat=object 
 result=getMonths_result(event); 
 fault=getMonths_fault(event); / 
/mx:WebService

Do RESTful webservices avoid cross-domain security issues when the SWF client 
is running on a domain other than the one hosting the webservice? 

Thanks


[flexcoders] possible to derive rowIndex from DataGrid's rightClick event?

2009-12-15 Thread Tim Romano
In an AIR app, I'd like to be able to know what row of a DataGrid the 
user has right-clicked on.* The rightClick event of the DataGrid is a 
MouseEvent and does not expose rowIndex (unlike the rowClick event which 
is of type ListEvent).  Is there a way to derive the rowIndex in the 
grid's rightClick eventhandler? 
Thanks

*I'm hoping to make a CheckBoxDataGrid interactive in two ways --  normal 
check-box multi-selection mode, which is working fine, but also a 
right-click-on-single-row  mode, where the row is not selected but is 
temporarily the subject of the user's attention -- possibly for a context-menu.

[flexcoders] padding P element with CSS in htmlText of TextArea

2009-12-10 Thread Tim Romano
While I've been able to apply some CSS styles (e.g. fontFamily, 
fontSize, fontWeight, fontStyle, letterSpacing) to the content of p 
elements and to indidivual class selectors in the htmlText of a TextArea 
in an AIR application (FB4 beta2),  attempts to 
set other styles, such as padding and margin, have not worked.  Are padding and 
margin 
not implemented? If not, will they be? 

CSS + HTML are a powerful duo. I hope Adobe has plans to exploit this 
capability fully for the TextArea in AIR applications. For many 
text-presentation purposes CSS support would be entirely adequate, and 
typographic control would offer far more precision and granularity than is 
actually needed while introducing unnecessary complexity. Not that typography 
isn't a very slick feature, but please don't let CSS+HTML fall by the wayside.

Regards
Tim


Re: [flexcoders] Flex 3: AIR Local Database

2009-11-25 Thread Tim Romano
The answer to your question about large scale  is yes, AIR + SQLite can 
handle large datasets but with some caveats.

I
have a SQLite database that is several hundred megabytes. The main
tables contain 4 million rows, 275000 rows, and 3500 rows. Queries that
join these tables, when the query makes use of indexes, execute in under
100 milliseconds. Snappy.

However, some things in the AIR
implementation of SQLite are causing index optimizations with the
LIKE() operator not to work, both in regular statements and in prepared
statements.   I am not sure what these things are because the differences 
between the AIR implementation of SQLite and SQLite proper haven't been 
documented. They could be things like overloading certain core SQLite 
functions, or compiling statements/prepared statements with one of the 
functions that cause the optimizer not to use an index. 

As a result of these mysterious things, if you run a query like SELECT * from 
MEMBERSHIP where
MEMBER_LASTNAME  LIKE 'Johns%'  the query will do a full table scan.
Do a more complex column value starts-with query that involves joins, and the 
table scan can translate
to very poor performance. For example, when I execute my query at the
SQLITE3.EXE command-line, where the index IS used, the query executes in under
100ms but the identical query takes 45-50 seconds in AIR.

Also, to keep the
front-end responsive when working with large datasets, you will have to
use asynchronous data connections not synchronous connections. The
coding is somewhat more complicated but also I found the AIR debugger
to be less than robust when working with asynchronous connections and
data events. However, everything worked OK with Responders, so I'd
recommend the use of responder objects over the event-dispatch
architecture.

I have no experience to offer you with concurrency issues and SQLite.  My AIR + 
local-db application is single-user.

Regards
TR

jwc_wensan wrote:
  

In all the articles I have read and some examples, it only talks about
using SQLite as the database on the users' PC/Mac. Is that the only
database that can be used locally?
 
 Can that database handle a large-scale commercial AIR app with tens of 
 thousands of records?
Also, since the AIR app is installed on the users PC/Mac, is there any reason 
to use mx:Modules?
 
 If the user needs/requires that data remain local, is AIR the best solution?
 
 Does Flex 4 solve any issues?
 
 Thoughts, options, suggestions?
 
 Thanks in advance,
 
 Jack

[flexcoders] where to get official answer to question about AIR's SQLite implementation and LoadableExtensions mechanism support?

2009-11-25 Thread Tim Romano
A simple function I
need does not exist in the SQLite engine core but the SQLite gurus are telling 
me to write my own function in C and load it at runtime as a loadable 
extension.  (I
have good reasons, BTW, for not wanting the function to execute in the
client--it really belongs in the back-end.)

http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions

The LoadableExtensions mechanism is disabled by default, and Adobe in its 
implementation of SQLite may not have enabled the
LoadableExtensions mechanism; or if it is enabled, a developer does not know
whether it is officially enabled or an undocumented
use-at-your-own-risk feature.

Where would one get an official
answer to the LoadableExtension supported/not-supported question? I've
tried the AIR forum at Adobe but my question was not answered there.

Thanks


[flexcoders] basic code behind question

2009-10-27 Thread Tim Romano
It seems a class whose constructor takes arguments cannot be used as the 
code-behind class. Is that so? When I try to use this class in the root tag of 
my mxml component, there's an error: no default constructor in the base class 
TestArgs. 
Thanks

package
{
import mx.containers.TitleWindow;
import mx.controls.LinkButton;
public class TestArgs extends TitleWindow
{

public var aLinkButton:LinkButton;
private var _arg1: String;

//public function TestArgs(){}

public function TestArgs(arg1:String)
{
super();
_arg1 = arg1;
}

}
}


[flexcoders] launching popup TitleWindow from a reused mxml component

2009-10-24 Thread Tim Romano
I posted a question the other day about how to prevent a popup from being 
dragged outside the bounds of the application window. Since I'm fairly new at 
Flex, some obvious things are not immediately obvious to me.

I think my popup window can be dragged outside the main application window 
because this in my method call below:

PopUpManager.addPopUp(popwin, this, true);

actually refers to an isntance of my (reusable) mxml component  which is 
launching the popup, not to the main application window.  If the parent 
DisplayObject referred to by this is not the main application window, is the 
default behavior that the popup can be dragged outside the main application 
window?

Thanks

[flexcoders] PopupWindow dragging and enforcing main app window bounds

2009-10-23 Thread Tim Romano
First, thanks to Tracy for answering my question about the columns array of the 
DataGrid.  

My question relates to dragging popup-windows.


It's possible to drag a popup window outside the main application
window's bounds, and if the user happens to release the
mouse button at the wrong moment, the popup window can no longer be
grabbed.


My popup is defined in ActionScript like this:


public class MyPopupWindow extends TitleWindow   {  ... }

and is instantiated like this:

var popwin = new MyPopupWindow();
var isModal:Boolean=true;
PopUpManager.addPopUp(popwin, this, isModal);

How would I get a reference to the main application window's bounds? 
MyPopupWindow instances could be popped up from deep inside nested containers. 
Do I keep getting parents of parents until there are no more parents to get?


If I pass this rectangle to the MyPopupWindow constructor, can MyPopupWindow
use those values to prevent itself from being dropped outside those confines, 
in the
stopDragging() method that it inherits from Panel, and relocate itself?  What 
properties contain its its current location relative to the main window's 
bounds?


Or do I need to implement this in the class instance that invokes the 
PopUpManager.addPopUp method?


Thanks