[flexcoders] Re: antiAliasType null exception with Text instances!

2009-02-27 Thread robbarreca
--- In flexcoders@yahoogroups.com, Darron J. Schall dar...@... wrote:
 
 I've already file a bug against this, but hopefully one of those 2 
 solutions should work for you.

What is the JIRA issue number you filed this under at bugs.adobe.com?

-R



[flexcoders] Using URLLoader, can't determine redirected-to URL in Event.COMPLETE

2008-11-12 Thread robbarreca
[Since my last post
(http://tech.groups.yahoo.com/group/flexcoders/message/130012) got
hijacked, started a small re-post. Sorry if this morally offends anyone.]

Is there any way to find the destination of a redirect in
ActionScript? For example, using Loader, you can access loaderInfo.url
and it will give you the final destination that your original request
got redirected to.

But with URLLoader, I don't see any way to get the final URL in
Event.COMPLETE. Am I missing something?

Thanks in advance,

Rob



[flexcoders] Determining the destination of a URL redirect with URLLoader or something else?

2008-11-10 Thread robbarreca
Is there a way to determine what the final redirection of a URLLoader
resource is? For example, with Loader I can load
http://www.youtube.com/v/6JBAxkZun3s, which gets redirected to
http://www.youtube.com/swf/l.swf?swf=http%3A//s.ytimg.com/yt/swf/cps-vfl62967.swfvideo_id=6JBAxkZun3srel=1showsearch=1eurl=iurl=http%3A//i3.ytimg.com/vi/6JBAxkZun3s/hqdefault.jpgsk=UEhR45OlNzNS4sbCkLAX9_mTQARuHThZCuse_get_video_info=1load_modules=1
and then in Event.COMPLETE handler I can access event.target.url to
get the destination URL of that redirect.

But I don't want to load the YouTube AS2 SWF into my app, just get the
redirected URL. So I was imagining I could do the same with URLLoader
but there is no url property.

I tried Sockets but that would require a policy file on YouTube's site. 

This seems like a simple thing to do, but why is it so darn hard? Or
is there some flag in Loader to make it not actually load the SWF into
memory? (I think it's conflicting with other components and causing
some nice FF crashing.)

Thanks,

-R



[flexcoders] Re: Attaching custom data to events (while avoiding race condition)

2008-06-10 Thread robbarreca
Thanks you guys. The AsyncToken is what I was looking for *except* I
need this for non-HTTPService loaders so unfortunately it doesn't work
for me. I may have to try to roll my own similar solution.

Furthermore, I can't chain the calls. 

I've considered extending the event classes, but then I'd have to
extend the loader classes and override the load method too so I can
pass this custom data along. That seems far too crufty for me.

Thanks again for the help anyways,

-R

--- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote:

 As you have shown it, you cannot rely on the value of the flag.
 
  
 
 Instead, use AsyncToken to keep calls sync'd with results.
 
  
 
 Hmm, I think AsyncToken is available on UrlLoader.  If not, use
 HTTPService.
 
  
 
 function load(flag:uint) {
 var asToken:AsyncToken = loader.loadSomeStuff();
 
 asToken.flag = flag;
 }
 
  
 
 function handleComplete(event:Event) {
   var asToken:AsyncToken = event.token;
 
   var sFlag:String = asToken.flag;
 
   switch (sFlag)  {
 
 case1:
 
   //do 1 stuff
 
   break;
 
  
 
}
 }
 
  
 
 Tracy
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of robbarreca
 Sent: Monday, June 09, 2008 5:48 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: Attaching custom data to events (while
 avoiding race condition)
 
  
 
 So when I say thread maybe I'm using the wrong terminology. I'm not
 actually talking about two different users/browsers. I'm talking about
 the same browser running two calls of load().
 
 Let me expand:
 
 function onInitialize() {
 loader.addEventListener(handleComplete);
 load(1); // Say this takes 20 seconds to complete load
 load(2); // But this one only takes 5 seconds to complete
 }
 
 private var storedFlag:uint = 0;
 
 function load(flag:uint) {
 storedFlag = flag;
 loader.loadSomeStuff();
 }
 
 function handleComplete(event:Event) {
 // What is storedFlag here?
 }
 
 The execution goes like this:
 
 load(1);
 
 load(2);
 
 handleComplete(event1); // Triggered from the load(1) which is the
 race since this storedFlag == 2, but this is handling the completion
 of the first load. I really want to get that flag data from the event
 object so there is no race condition.
 
 handleComplete(event2);
 
 This is a simplified example, but I really do have a use case for
 this. Did I do a better job of explaining this time?
 
 -R
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
 , Daniel Gold danielggold@ wrote:
 
  It makes sense when dealing with concurrent programming, but Flash
 is single
  threaded and you won't have a case where multiple threads are task
 switching
  and simultaneously executing functions. Every function call and event
  handler in flex is basically in-lined and will execute to
 completion.
  
  On Mon, Jun 9, 2008 at 5:11 PM, robbarreca rob@
  wrote:
  
   Sorry, I must have not explained well. The race condition I'm
 talking
   about exists here:
  
   thread 1: calls load() and say someFlag gets set to 1;
   thread 2: calls load() and someFlag is set to 2;
   thread 1: the first load is complete and handleComplete() is called,
   but someFlag is set to 2 when the value I want is 1.
  
   I want to attach a copy of the value of someFlag to the event so in
   handleComplete() I could call event.target.someFlagCopy and always
 get
   the value that was set in *that* thread's load() call.
  
   Does that make any sense?
  
   -R
  
  
   --- In flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com  flexcoders%40yahoogroups.com,
 Daniel
   Gold danielggold@ wrote:
   
does determineFlag() do some asynch service call? If so you need
 to
   wait and
raise an event or update a var in a model and listen for changes
   that way.
Otherwise your determineFlag() method will run to completion
 before the
loader.loadSomeStuff() line is executed, Flash is single threaded
   for user
code execution so you shouldn't have a race condition there
   
On Mon, Jun 9, 2008 at 3:55 PM, robbarreca rob@
wrote:
   
 Say I have two functions load() and handleComplete(event:Event).
   Right
 now to get custom data to handleComplete I do something like
 this

 private var someFlag:uint = 0;

 function load() {
 loader.addEventListener(handleComplete);
 someFlag = determineFlag();
 loader.loadSomeStuff();
 }

 function handleComplete(event:Event) {
 trace(someFlag);
 }

 But if I call this super fast, someFlag is gonna be wrong.
 I've seen a
 method where you can add an anonymous function somehow, but
 I'm pretty
 sure that even faced the same race condition problem. What is
 the
 *proper* way to go about this?



   
  
   
  
 





[flexcoders] Re: Flex Builder 3 debug builds broken, breakpoints all wrong

2008-06-10 Thread robbarreca
I agree and have seen this a few times. 

One odd occurrence is with a Flex Module in my Flex Application. It
would serve up a stale build of the module unless I added a
trace(foo); in the code, and then it would force a recompile. But
when I would SVN revert back to the version without the trace
statement, Flex would serve up the stale module SWF.

I had disabled browser caching with web developer toolbar,
cleaned/deleted bin-debug, etc.

What is the JIRA ticket(s) on bugs.adobe.com for these known issues
you guys are mentioning?

-R 

--- In flexcoders@yahoogroups.com, Troy Gilbert [EMAIL PROTECTED]
wrote:

  Did you check whether or not:
   Menu:
   Project ---
   build Automatically is checked?
 
 Like I said, I've been developing with Flex for the last 18 months...
 I'm very aware of build automatically, clean and all of their
 implications. It's definitely a bug in the caches...
 
 Troy.





[flexcoders] Attaching custom data to events (while avoiding race condition)

2008-06-09 Thread robbarreca
Say I have two functions load() and handleComplete(event:Event). Right
now to get custom data to handleComplete I do something like this

private var someFlag:uint = 0;

function load() {
  loader.addEventListener(handleComplete);  
  someFlag = determineFlag();
  loader.loadSomeStuff();
}

function handleComplete(event:Event) {
  trace(someFlag);
}

But if I call this super fast, someFlag is gonna be wrong. I've seen a
method where you can add an anonymous function somehow, but I'm pretty
sure that even faced the same race condition problem. What is the
*proper* way to go about this?



[flexcoders] Re: Attaching custom data to events (while avoiding race condition)

2008-06-09 Thread robbarreca
Sorry, I must have not explained well. The race condition I'm talking
about exists here:

thread 1: calls load() and say someFlag gets set to 1;
thread 2: calls load() and someFlag is set to 2;
thread 1: the first load is complete and handleComplete() is called,
but someFlag is set to 2 when the value I want is 1.

I want to attach a copy of the value of someFlag to the event so in
handleComplete() I could call event.target.someFlagCopy and always get
the value that was set in *that* thread's load() call.

Does that make any sense?

-R

--- In flexcoders@yahoogroups.com, Daniel Gold [EMAIL PROTECTED] wrote:

 does determineFlag() do some asynch service call? If so you need to
wait and
 raise an event or update a var in a model and listen for changes
that way.
 Otherwise your determineFlag() method will run to completion before the
 loader.loadSomeStuff() line is executed, Flash is single threaded
for user
 code execution so you shouldn't have a race condition there
 
 On Mon, Jun 9, 2008 at 3:55 PM, robbarreca [EMAIL PROTECTED]
 wrote:
 
Say I have two functions load() and handleComplete(event:Event).
Right
  now to get custom data to handleComplete I do something like this
 
  private var someFlag:uint = 0;
 
  function load() {
  loader.addEventListener(handleComplete);
  someFlag = determineFlag();
  loader.loadSomeStuff();
  }
 
  function handleComplete(event:Event) {
  trace(someFlag);
  }
 
  But if I call this super fast, someFlag is gonna be wrong. I've seen a
  method where you can add an anonymous function somehow, but I'm pretty
  sure that even faced the same race condition problem. What is the
  *proper* way to go about this?
 
   
 





[flexcoders] Re: Attaching custom data to events (while avoiding race condition)

2008-06-09 Thread robbarreca
So when I say thread maybe I'm using the wrong terminology. I'm not
actually talking about two different users/browsers. I'm talking about
the same browser running two calls of load().

Let me expand:

function onInitialize() {
  loader.addEventListener(handleComplete);
  load(1); // Say this takes 20 seconds to complete load
  load(2); // But this one only takes 5 seconds to complete
}

private var storedFlag:uint = 0;

function load(flag:uint) {
  storedFlag = flag;
  loader.loadSomeStuff();
}

function handleComplete(event:Event) {
  // What is storedFlag here?
}

The execution goes like this:

load(1);

load(2);

handleComplete(event1); // Triggered from the load(1) which is the
race since this storedFlag == 2, but this is handling the completion
of the first load. I really want to get that flag data from the event
object so there is no race condition.

handleComplete(event2);

This is a simplified example, but I really do have a use case for
this. Did I do a better job of explaining this time?

-R

--- In flexcoders@yahoogroups.com, Daniel Gold [EMAIL PROTECTED] wrote:

 It makes sense when dealing with concurrent programming, but Flash
is single
 threaded and you won't have a case where multiple threads are task
switching
 and simultaneously executing functions. Every function call and event
 handler in flex is basically in-lined and will execute to completion.
 
 On Mon, Jun 9, 2008 at 5:11 PM, robbarreca [EMAIL PROTECTED]
 wrote:
 
Sorry, I must have not explained well. The race condition I'm
talking
  about exists here:
 
  thread 1: calls load() and say someFlag gets set to 1;
  thread 2: calls load() and someFlag is set to 2;
  thread 1: the first load is complete and handleComplete() is called,
  but someFlag is set to 2 when the value I want is 1.
 
  I want to attach a copy of the value of someFlag to the event so in
  handleComplete() I could call event.target.someFlagCopy and always get
  the value that was set in *that* thread's load() call.
 
  Does that make any sense?
 
  -R
 
 
  --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com,
Daniel
  Gold danielggold@ wrote:
  
   does determineFlag() do some asynch service call? If so you need to
  wait and
   raise an event or update a var in a model and listen for changes
  that way.
   Otherwise your determineFlag() method will run to completion
before the
   loader.loadSomeStuff() line is executed, Flash is single threaded
  for user
   code execution so you shouldn't have a race condition there
  
   On Mon, Jun 9, 2008 at 3:55 PM, robbarreca rob@
   wrote:
  
Say I have two functions load() and handleComplete(event:Event).
  Right
now to get custom data to handleComplete I do something like this
   
private var someFlag:uint = 0;
   
function load() {
loader.addEventListener(handleComplete);
someFlag = determineFlag();
loader.loadSomeStuff();
}
   
function handleComplete(event:Event) {
trace(someFlag);
}
   
But if I call this super fast, someFlag is gonna be wrong.
I've seen a
method where you can add an anonymous function somehow, but
I'm pretty
sure that even faced the same race condition problem. What is the
*proper* way to go about this?
   
   
   
  
 
   
 





[flexcoders] Re: Attaching custom data to events (while avoiding race condition)

2008-06-09 Thread robbarreca
I'd love to know if my explanation made any sense when someone gets a
free moment. If it sounds like I'm smoking crack, please let me know
and I'll check myself into rehab.

Thanks!

-R

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

 So when I say thread maybe I'm using the wrong terminology. I'm not
 actually talking about two different users/browsers. I'm talking about
 the same browser running two calls of load().
 
 Let me expand:
 
 function onInitialize() {
   loader.addEventListener(handleComplete);
   load(1); // Say this takes 20 seconds to complete load
   load(2); // But this one only takes 5 seconds to complete
 }
 
 private var storedFlag:uint = 0;
 
 function load(flag:uint) {
   storedFlag = flag;
   loader.loadSomeStuff();
 }
 
 function handleComplete(event:Event) {
   // What is storedFlag here?
 }
 
 The execution goes like this:
 
 load(1);
 
 load(2);
 
 handleComplete(event1); // Triggered from the load(1) which is the
 race since this storedFlag == 2, but this is handling the completion
 of the first load. I really want to get that flag data from the event
 object so there is no race condition.
 
 handleComplete(event2);
 
 This is a simplified example, but I really do have a use case for
 this. Did I do a better job of explaining this time?
 
 -R
 
 --- In flexcoders@yahoogroups.com, Daniel Gold danielggold@ wrote:
 
  It makes sense when dealing with concurrent programming, but Flash
 is single
  threaded and you won't have a case where multiple threads are task
 switching
  and simultaneously executing functions. Every function call and event
  handler in flex is basically in-lined and will execute to
completion.
  
  On Mon, Jun 9, 2008 at 5:11 PM, robbarreca rob@
  wrote:
  
 Sorry, I must have not explained well. The race condition I'm
 talking
   about exists here:
  
   thread 1: calls load() and say someFlag gets set to 1;
   thread 2: calls load() and someFlag is set to 2;
   thread 1: the first load is complete and handleComplete() is called,
   but someFlag is set to 2 when the value I want is 1.
  
   I want to attach a copy of the value of someFlag to the event so in
   handleComplete() I could call event.target.someFlagCopy and
always get
   the value that was set in *that* thread's load() call.
  
   Does that make any sense?
  
   -R
  
  
   --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com,
 Daniel
   Gold danielggold@ wrote:
   
does determineFlag() do some asynch service call? If so you
need to
   wait and
raise an event or update a var in a model and listen for changes
   that way.
Otherwise your determineFlag() method will run to completion
 before the
loader.loadSomeStuff() line is executed, Flash is single threaded
   for user
code execution so you shouldn't have a race condition there
   
On Mon, Jun 9, 2008 at 3:55 PM, robbarreca rob@
wrote:
   
 Say I have two functions load() and handleComplete(event:Event).
   Right
 now to get custom data to handleComplete I do something like
this

 private var someFlag:uint = 0;

 function load() {
 loader.addEventListener(handleComplete);
 someFlag = determineFlag();
 loader.loadSomeStuff();
 }

 function handleComplete(event:Event) {
 trace(someFlag);
 }

 But if I call this super fast, someFlag is gonna be wrong.
 I've seen a
 method where you can add an anonymous function somehow, but
 I'm pretty
 sure that even faced the same race condition problem. What
is the
 *proper* way to go about this?



   
  

  
 





[flexcoders] Re: Loading ResourceModule and CSS with one HTTP call

2008-05-28 Thread robbarreca
Thanks Alex. I had pondered this custom Module solution as we're using
Modules for another part of our application, but it does sound a bit
hairy. I'll probably stick with programmatically setting the few
styles we need for now.

Cheers,

Rob

--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 The Resource and Styles subsystems use Modules to load at runtime, and
 Modules sort of imply a single main class.
 
  
 
 In the end, the single main class registers various resources and styles
 with the appropriate manager, so if you create your own main class and
 copy enough code, you can pack all of the styles and resources into a
 single module and have it register the right things with the right
 managers.  You probably can't use the compiler to generate the single
 SWF so you may have to use the generated code and create a custom SWF.
 
  
 
 It won't tax your brain, but will be tedious.  I'd say it would have a
 difficulty rating of 7 out of 10.
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of Rob Barreca
 Sent: Tuesday, May 27, 2008 8:29 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Loading ResourceModule and CSS with one HTTP call
 
  
 
 When loading a ResourceModule for the Japanese language, we also want to
 
 apply a set of styles to change the default font to something Japanese. 
 I have a solution now that loads a ja_JP_Styles.swf through StyleManager
 
 as well as loading a ja_JP_ResourceModule.swf with ResourceManager but 
 would like to combine the calls.
 
 1. I know I could forget about loading external style SWFs and put 
 something like
 
 StyleManager.getStyleDeclaration(global).setStyle(fontFamily, 
 resourceManager.getString(FooBar, globalFont));
 
 after setting localeChain, but I'm thinking we'll want to change other 
 styles and would like to keep a generic solution like I have now, but 
 cut down on the extra HTTP request. Maybe this is my only option?
 
 2. I thought one could somehow Embed(style.css) in my Foo.properties 
 ResourceBundle but it doesn't seem like that is the right path.
 
 3. Also, I read in the proposed spec 
 (http://opensource.adobe.com/wiki/display/flexsdk/Runtime+Localization+S
 pecification#RuntimeLocalizationSpecification-Problem:AstylevalueinaCSSs
 electorcan
 http://opensource.adobe.com/wiki/display/flexsdk/Runtime+Localization+S
 pecification#RuntimeLocalizationSpecification-Problem:AstylevalueinaCSSs
 electorcan 'tcomefromaresource.) 
 that one might be able to do something like the following, but it barfs 
 so this feature probably didn't make it in.
 
 global {
 fontFamily: Resource(bundle=FooBar, key=globalFont);
 }
 
 What is the best way to do this, am I stuck with option #1 if I want to 
 just do one HTTP call when switching locales?
 
 Thanks,
 
 -R





[flexcoders] How do I trigger updateDisplayList() on *every* component in my Application?

2008-05-27 Thread robbarreca
I have an application with a bunch of nested containers and
components. We are internationalizing this app (with ResourceModules)
and when someone switches languages we need invalidateDisplayList()
called on every child component of the app.

Iterating through the Application's rawChildren doesn't return any
components that are nested in a Canvas for example. Do I really have
to do some recusive deal to traverse the whole tree to make the whole
app redraw? There has to be an easier way to do this that I'm overlooking.

Example: rawChildren only returns the Canvas, do I need to check if
it's a container and recurse?

App
  Canvas
Box title={resourceManger.getString('boxTitle')}/
  /Canvas
/App

Thanks in advance!

-Rob



[flexcoders] Re: [SOLVED] Trigger an invalidateDisplayList() when properties are changed

2008-05-27 Thread robbarreca
--- In flexcoders@yahoogroups.com, Richard Rodseth [EMAIL PROTECTED] wrote:
 You'll see that you just need to change the locale chain of the
 resource manager. You already have a binding expression which invokes
 the resource manager.

Thanks for the reply Richard. The problem I'm facing is that not *all*
of the bindings are getting honored when I change localeChain. I
realize the recursive display invalidation is not the way to go.

Your email made me realize now that the it's my custom component
MyPanel (which extends Box and adds a bold label on top) that isn't
updating until updateDisplayList() is called. This was a deficiency in
how this component was written as Flex Text and Label controls update
fine. I wasn't accounting for these custom properties to be
programatically set since they were just hardcoded before i18n.

I changed

public var title:String;

to

protected var _title:String;

public function get title():String
{
  return _title;
}

public function set title(value:String):void
{
  _title = value;
  invalidateDisplayList();
}

and all is well. Thanks a lot!




[flexcoders] HTTPService call using a private SSL cert PEM

2007-12-27 Thread robbarreca
I have a REST web services call that uses a private SSL cert to
authenticate communication. It works in PHP and command line cUrl, but
I don't know how to pass the PEM file in the Flex 3 / Actionscript 3.0
HTTPService call. Is it possible? 

Below I give my PHP and cUrl snippets that work now, and followed by
the beginning of my Flex service call. How do I pass the PEM to that
Flex call so Flex can securely talk to the REST web service over this
private SSL cert?

-
PHP
-

This worked in PHP where $cert contained the path to the PEM file.

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_SSLCERT, $cert);

-
cUrl (command line)
-

This worked in command line cUrl, where client.pem contains a private
PEM file for privatesslcerthost.com.

curl ... --cert-type PEM --cert client.pem 

---
Flex code 
---

This needs to pass the PEM in the HTTPService call. How do I do it?

service = new HTTPService();
service.contentType = text/xml;
service.resultFormat = e4x;
service.useProxy = false;
service.method = POST;
service.addEventListener(ResultEvent.RESULT, onRestCallResult);
service.addEventListener(FaultEvent.FAULT, onRestCallFault);
service.url = https://privatesslcerthost.com/; + path;
service.send(params);