[flexcoders] Facebook Connect and Flex

2009-01-19 Thread Daniel Tse
Hi,

Has anyone had experience implementing Facebook connect with Flex/Air Apps?
If so, can someone point to an example?

Thanks,
-Daniel


[flexcoders] JPGEncoding of mx:Image

2008-04-11 Thread Daniel Tse
Hi,

I'm trying to capture a loaded image into mx:Image. I'm able to sort of
write the bitmapdata of an image to a file except when I load an image that
is larger than the image holder, the image holder resizes the image so it
fits but when I write it out I don't get what I see instead I get a cropped
section of the image. So instead of seeing test.jpg as a resized version
of the image I've loaded I get the image cropped at 100%

I have a method like the following (with an mx:Image named imgHolder).

//Encoding
import mx.graphics.codec.JPEGEncoder;
import com.adobe.images.JPGEncoder;

//Local File System
import flash.desktop.*;
import flash.filesystem.File;


private function saveLoadedImage():void {
var loJPGEncoder:JPGEncoder = new JPGEncoder();
var bd: BitmapData =
getBitmapData(mx.core.Application.application.imgHolder); //something not
quite right as it crops and doesn't resize.
var encodedJPG:ByteArray = loJPGEncoder.encode(bd);

var file:File = File.desktopDirectory.resolvePath(test.jpg);
//saves it to the desktop as a file labeled test.jpg
var stream:FileStream = new FileStream();
stream.open( file, FileMode.WRITE );
stream.writeBytes( encodedJPG );
trace(saved.);
}

private function getBitmapData( target : UIComponent ) : BitmapData
   {
var bd : BitmapData = new BitmapData( target.width,
target.height );
var m : Matrix = new Matrix();
bd.draw( target, m );
return bd;
   }

Any insight? Thanks!
-Daniel
-- 
-
e: [EMAIL PROTECTED]
w: http://DanielTse.com/
-


Re: [flexcoders] Re: AMFPHP MySQL Results Object

2008-03-25 Thread Daniel Tse
Thanks Aaron,

I'll see what I can look up on the RemoteObject as well.

CaffeineWabbit,

Thanks for the pointers. I saw that Mike Potter's AMFPHP example also
created a php array instead of using the mysql results object but... I
noticed on the AMFPHP browser page it can actually create a table based on
the recordset that is returned. e.g. the table automatically changes based
on my sql result and it doesn't seem like there's any specific binding to
columns. I'm curious as to how they did that.

In short, I'd like to find a convenient way for the client to parse the
results of a remote sql query.

Thanks all!
-Daniel

On Mon, Mar 24, 2008 at 5:53 PM, Aaron Miller 
[EMAIL PROTECTED] wrote:

   Just as a follow up. I verified that using RemoteObject does in fact
 return an ArrayCollection as the result, while NetConnection does not
 (returns an outdated ResultSet object). Hopefully someone at Adobe could
 explain the difference in remoting procedure between the two methods.

 Regards,
 ~Aaron



 On Mon, Mar 24, 2008 at 5:23 PM, Aaron Miller 
 [EMAIL PROTECTED] wrote:

  Hello again. I did some more reading on this and I think the problem is
  with using NetConnection instead of RemoteObject. Apperently, using
  NetConnection does not always send the right headers to tell AMFPHP to use
  AMF3 encoding, thus it tries to return a ResultSet instead of an
  ArrayCollection. You can tell you got a ResultSet if the return object has a
  serverInfo property. From what I've read, using RemoteObject is a surefire
  way to get the right headers (AMF3) and will guarantee an ArrayCollection is
  returned. However, having been accustomed to NetConnection myself, and I am
  trying to figure out a way to do this without RemoteObject. Setting
  NetConnection.objectEncoding to ObjectEncoding.AMF3 did not help for
  some reason. Maybe someone else can chime in on this.
 
  In  the mean time, here is a good tutorial on RemoteObject with AMFPHP:
 
  http://www.sephiroth.it/tutorials/flashPHP/flex_remoteobject/index.php
 
  Best Regards,
  ~Aaron
 
 
  On Mon, Mar 24, 2008 at 3:57 PM, caffeinewabbit 
  [EMAIL PROTECTED] wrote:
 
 Hi Daniel,
  
   In the PHP code you provided, you can't pass back the raw $results
   variable because its not a normal PHP variable - its a resource, which
   holds external data and can only be used by special PHP functions (in
   this case, the mysql library.)
  
   To pass back the results from your query, you'll first need to extract
   the data into a format that can be passed by AMFPHP. Something similar
   to the following:
  
   ?php
  
  
   class SimplePerson
   {
   function getPeople()
   {
   $mysql = mysql_connect(localhost, root, root);
  
   mysql_select_db( people-test );
  
   $sSQL = SELECT * FROM `tblPeople`;
  
   $results = mysql_query($sSQL);
  
   $queryResults = array();
  
   while($queryOb = mysql_fetch_assoc($results))
   $queryResults[] = $queryOb;
  
   return $queryResults;
   }
   }
  
   ?
  
   That'll show up in Flex as an array containing generic objects that
   contain your query results.
  
   For more info on resources, this link should help:
   http://www.php.net/manual/en/language.types.resource.php
  
   Hope this helps!
  
  
   --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com,
   Daniel Tse [EMAIL PROTECTED] wrote:
   
Hi All,
   
I have setup AMFPHP and it returns back the recordset object from a
   MySQL
query. I was wondering how I access that array/recordset from the
   flex side.
   
e.g. I have the following:
   
?php
//In the services directory of AMFPHP
class SimplePerson {
function getPeople() {
$mysql = mysql_connect(localhost, root, root);
   
mysql_select_db( people-test );
   
$sSQL = SELECT * FROM `tblPeople`;
   
$results = mysql_query($sSQL);
   
return $results;
}
}
   
?
   
In Flex..
public function getPeople():void {
myService.connect(REMOTESERVERURL);
   
var responder:Responder = new
   Responder(getPeople_Result,
onFault);
myService.call(SimplePerson.getPeople, responder);
   
}
   
public function
getPeople_Result(aoResults:WHAT_SHOULD_GO_HERE):void
{
//test;
//I'd like to access the result set e.g. iterate
   through the
rows looking at certain columns
}
   
Array doesn't seem to work (the fact that it's a 1-dimensional
   array
doesn't help)
XMLList the object doesn't seem to map like that either
   
Am I missing some kind of object?
   
Thanks,
-Daniel
--
-
e: [EMAIL PROTECTED]
w: http://DanielTse.com/
-
   
  
  
 
 
  --
  Aaron Miller
  Chief Technology Officer
  Open Base Interactive, LLC.
  [EMAIL PROTECTED]
  http://www.openbaseinteractive.com
 



 --
 Aaron Miller
 Chief Technology Officer
 Open Base Interactive, LLC.
 [EMAIL PROTECTED]
 http://www.openbaseinteractive.com
  




-- 
-
e: [EMAIL PROTECTED]
w

[flexcoders] AMFPHP MySQL Results Object

2008-03-24 Thread Daniel Tse
Hi All,

I have setup AMFPHP and it returns back the recordset object from a MySQL
query. I was wondering how I access that array/recordset from the flex side.

e.g. I have the following:

?php
//In the services directory of AMFPHP
class SimplePerson {
function getPeople() {
   $mysql = mysql_connect(localhost, root, root);

 mysql_select_db( people-test );

 $sSQL = SELECT * FROM `tblPeople`;

 $results =  mysql_query($sSQL);

return $results;
}
}

?

In Flex..
   public function getPeople():void {
myService.connect(REMOTESERVERURL);

var responder:Responder = new Responder(getPeople_Result,
onFault);
myService.call(SimplePerson.getPeople, responder);

}

public function
getPeople_Result(aoResults:WHAT_SHOULD_GO_HERE):void
{
//test;
//I'd like to access the result set e.g. iterate through the
rows looking at certain columns
}

Array doesn't seem to work (the fact that it's a 1-dimensional array
doesn't help)
XMLList the object doesn't seem to map like that either

Am I missing some kind of object?

Thanks,
-Daniel
-- 
-
e: [EMAIL PROTECTED]
w: http://DanielTse.com/
-


Re: [flexcoders] AMFPHP MySQL Results Object

2008-03-24 Thread Daniel Tse
Thanks Aaron!

I'm still a bit unsure about referencing the individual items then.

after I have collection... how do I actually access each row/column?

I tried to find out the length or number of rows by going
collection.length... it didn't seem to like that at all.

-Daniel

On Mon, Mar 24, 2008 at 4:20 PM, Aaron Miller 
[EMAIL PROTECTED] wrote:

   I always set the return result as Object in my handler then type it as
 the specific class later in the function. I'm not sure if I do this out of
 habit or necessity.

 # private function handleResult( result:Object ): void {
 #   var collection:ArrayCollection = result as ArrayCollection;
 # }

 Also notice that I used ArrayCollection. If I remember correctly, record
 sets get returned as an ArrayCollection. If I am mistaken, try the above
 with a standard Array.

 Hope this helps,
 ~Aaron


 On Mon, Mar 24, 2008 at 3:07 PM, Daniel Tse [EMAIL PROTECTED] wrote:

Hi All,
 
  I have setup AMFPHP and it returns back the recordset object from a
  MySQL query. I was wondering how I access that array/recordset from the flex
  side.
 
  e.g. I have the following:
 
  ?php
  //In the services directory of AMFPHP
  class SimplePerson {
  function getPeople() {
 $mysql = mysql_connect(localhost, root, root);
 
   mysql_select_db( people-test );
 
   $sSQL = SELECT * FROM `tblPeople`;
 
   $results =  mysql_query($sSQL);
 
  return $results;
  }
  }
 
  ?
 
  In Flex..
 public function getPeople():void {
  myService.connect(REMOTESERVERURL);
 
  var responder:Responder = new
  Responder(getPeople_Result, onFault);
  myService.call(SimplePerson.getPeople, responder);
 
  }
 
  public function
  getPeople_Result(aoResults:WHAT_SHOULD_GO_HERE):void
  {
  //test;
  //I'd like to access the result set e.g. iterate through
  the rows looking at certain columns
  }
 
  Array doesn't seem to work (the fact that it's a 1-dimensional array
  doesn't help)
  XMLList the object doesn't seem to map like that either
 
  Am I missing some kind of object?
 
  Thanks,
  -Daniel
  --
  -
  e: [EMAIL PROTECTED]
  w: http://DanielTse.com/
  -
 



 --
 Aaron Miller
 Chief Technology Officer
 Open Base Interactive, LLC.
 [EMAIL PROTECTED]
 http://www.openbaseinteractive.com
 




-- 
-
e: [EMAIL PROTECTED]
w: http://DanielTse.com/
-


Re: RE: [flexcoders] Photo print service

2008-01-23 Thread Daniel Tse
Hi Mike,

About the memory issues and images how did you get it to release the memory
in Flex?

I noticed that when we try to load images to an mx:Image object in a loop
containing this:

// imgObj already defined as an mxml Image object
for (var i:int = 0; i  5; i++) {

imgObj.source = null; // This doesn't clear the memory... but the docs say
it should...
imgObj.source = ImageFileArray[i].path;

}

The memory taken by each image is not freed can you shed some light as
to why it doesn't release it?

Thanks!
-Daniel



On Jan 22, 2008 1:51 PM, Greg Hess [EMAIL PROTECTED] wrote:

Thanks, much appreciated!



 -Greg



 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Mike Krotscheck
 *Sent:* Tuesday, January 22, 2008 10:27 AM
 *To:* flexcoders@yahoogroups.com
 *Subject:* RE: [flexcoders] Photo print service



 Sortof? When developing HP Print Studio (http://www.hp.com/printstudio) we
 ran into this very same issue, but instead of photos we had multiple high
 resolution template assets that were only loaded when a printjob was
 requested. Given our use cases (most users don't have duplex printers) we
 didn't actually have to do multi-page printing so it's not quite what you're
 looking for, but the implementation might be similar.



 Basically what you want to create is a temporary sandbox object that
 exists on the displaylist (so content is rendered) but doesn't actually show
 anything (height and width = 0). Within that object you compose your print
 pages, paying special attention to keep track of how many images are
 currently loading using event listeners- in particular the load complete
 event. Once everything's signaled that it's ready you print, and in the
 meantime put up a progress bar popup of some kind.



 You might also be able to do delayed page instantiation, that is: create a
 page, wait for it to finish, add it to the print job, destroy it, move to
 the next page. This will give you better memory management overall (I think)
 since you don't have to load your entire photo album into ram before
 printing.



 Also, be careful about your image sizes: Images in memory suck up a LOT of
 ram.



 *Michael Krotscheck*

 Senior Developer



 *RESOURCE INTERACTIVE*

 www.resource.com

 [EMAIL PROTECTED]




  --

 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Greg Hess
 *Sent:* Tuesday, January 22, 2008 9:56 AM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] Photo print service

 Hi All,

 I have a requirement to build a photo print service in Flex. The EU will
 view a gallery of image thumbnails (TileList) and have the option to print
 one photo or the entire contents of the gallery. Photo print options would
 be fit to page, 5x7, 8x10 ect…

 Searching the web, viewing the docs and examples using the FlexPrintJob
 from my understanding I can print images but they must be loaded (drawn) in
 flex prior, is this true?

 For a single photo print job this is fine as I can have the print page
 display the selected image size prior to sending the print job. However, I
 also want to allow the EU to select an entire photo folder and print the
 contents all to say 5x7, is this possible?

 Does anyone know of any examples or sample code?

 Any comments much appreciated.

 Thanks,


 Greg


 We support privacy and confidentiality. Please delete this email if it was
 received in error.

 *What's new ::*
 Capitalize on the social web* *| The Open Brand, a new book by Kelly
 Mooney and Dr. Nita Rollins, available March 2008 |* www.theopenbrand.com*

   




-- 
-
e: [EMAIL PROTECTED]
w: http://DanielTse.com/
-
image001.gif

[flexcoders] Flex Amazon S3 Access Control List / ACL

2008-01-17 Thread Daniel Tse
Hi All,

I've been playing around with the awss3lib (
http://www.code.google.com/awss3lib ) and looking at the documentation for
Amazon's S3 ( http://docs.amazonwebservices.com/AmazonS3/2006-03-01/ )and I
was wondering if anyone managed to get the ACL working with the awss3lib?

If so, can you explain how you did it?

The documentation says that we need to add a header 
x-amz-acl:{*private, *public-read,
etc} to the PUT request but I can't seem to do it properly. I figured that I
need to modify the authorization string but the one that the awss3lib
doesn't seem to have headers. e.g. instead of Content-Type: text/plain
it's just encoding text/plain and yet the request header has the full
thing (Content-Type: text/plain). I tried adding x-amz-acl:public-read to
the request header, and then to the authorization string but it comes back
as an error 2038.

Any help would be appreciated!

Thanks!
-Daniel

-- 
-
e: [EMAIL PROTECTED]
w: http://DanielTse.com/
-


Re: [flexcoders] Re: Amazon S3 awss3lib Flex Library error 2038

2008-01-11 Thread Daniel Tse
It seems that the awss3lib project has been updated since I first posted and
now it's all fixed! (no longer need to comment out the shouldCacheResponse
property and I no longer get the 2038 error when I upload.

Thanks Christian! (if you're reading)

-Daniel

On Jan 9, 2008 12:54 PM, Tom Sobut [EMAIL PROTECTED] wrote:

   You can find the Salsa project on Google Code.

 http://code.google.com/p/s3e/source

 Tom


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Daniel
 Tse [EMAIL PROTECTED] wrote:
 
  Hi All,
 
  Has anyone had any problems using the AWSS3 Library with the latest
 version
  of FlexBuilder 3 (M4 beta 3)? I noticed that when I tried to build the
  project with the library it complained that the property
 shouldCacheResponse
  for a URLRequest object doesn't exist. I commented it out to get it to
 build
  but when we use the s3.saveObject method we get an error 2038. Has
 anyone
  else been successful in using the library to upload/download to their s3
  account?
 
  Here's the link to Christian Cantrell's post describing it:
 
 http://weblogs.macromedia.com/cantrell/archives/2007/05/actionscript_li.cfm
 
  and the google-code link to the AWSS3 :
  http://code.google.com/p/as3awss3lib/
 
  By the way, I can't find the Salsa app on the Gallery page (
  http://labs.adobe.com/technologies/air/samples/ ) did it disappear?
 
  Thanks,
  -Daniel
  --
  -
  e: [EMAIL PROTECTED]
  w: http://DanielTse.com/
  -
 

  




-- 
-
e: [EMAIL PROTECTED]
w: http://DanielTse.com/
-


[flexcoders] Amazon S3 awss3lib Flex Library error 2038

2007-12-19 Thread Daniel Tse
Hi All,

Has anyone had any problems using the AWSS3 Library with the latest version
of FlexBuilder 3 (M4 beta 3)? I noticed that when I tried to build the
project with the library it complained that the property shouldCacheResponse
for a URLRequest object doesn't exist. I commented it out to get it to build
but when we use the s3.saveObject method we get an error 2038. Has anyone
else been successful in using the library to upload/download to their s3
account?

Here's the link to Christian Cantrell's post describing it:
http://weblogs.macromedia.com/cantrell/archives/2007/05/actionscript_li.cfm

and the google-code link to the AWSS3 :
http://code.google.com/p/as3awss3lib/

By the way, I can't find the Salsa app on the Gallery page (
http://labs.adobe.com/technologies/air/samples/ ) did it disappear?

Thanks,
-Daniel
-- 
-
e: [EMAIL PROTECTED]
w: http://DanielTse.com/
-