Working with Flex, part 2


I have spent just a couple of days in Flex and here are my feelings.
 
  • It builds nice applications
  • It uses a plug in that is industry standard
  • The IDE is a bit clunky (Eclipse with Flex bits), although it does the job
  • Debugging is extremely clunky – you have to jump some hoops to set breakpoints (yuck!)

I find myself spending more time starting the application to see what is going on than actually debugging. It feels more like using Response.Write() to debug (traditional ASP) than actual debugging. While I sometimes curse Visual Studio, I have learned how much time it saves me. To be fair, I am only a 3 day veteran of Flex building. Wink

But, that is not the point of this blog entry.

Retooling the pull from QueryString

When last we left, our heroes … Oh, wait, 1960s batman flashback.

In my last Flex post, I talked about pulling from the query string. In case you did not read it, here is the summary. To pull from QueryString, you can pull items from JavaScript using the external call library (not sure if that is the real name, but that is its purpose). You set up the JavaScript:

<script language="JavaScript" type="text/javascript">
      function GetQueryString()
      {
           
var s = window.location.search.substring(1);
           
return s;
      } 
</script>

And then you call it.

import flash.external.ExternalInterface;

params = ExternalInterface.call("GetQueryString");

I then have everything to the right of the question mark. This morning, I was IMing with Bruce Carroll at AWS (Austin) and conversing about a project I am working on that hooks up to a piece they completed for us a while back. In the process of IM, we started talking about Flex. He told me he pulled the entire URL using:

params = ExternalInterface.call("window.location.href.toString");

The wheels start turning. If you can get the entire href, why not just the query string. All of these failed:

params = ExternalInterface.call("window.location.href.substring(1)");
params = ExternalInterface.call("window.location.href.substring(1).toString");
params = ExternalInterface.call("window.location.search.substring(1)");

But, this one did not:

params = ExternalInterface.call("window.location.search.substring(1).toString");

Now, I can get rid of all of the JavaScript, plus any of the calls to JavaScript and simply pull from the querystring. Sweet.

Peace and Grace,
Greg

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: