Tag Archives: runtime

Mobile AIR – When is it coming out?

I have been playing with a lot of mobile widget-platforms. Some of these are Yahoo! Mobile Widget (Yahoo! Go) and S60 WRT.

Both of these are good, but I like S60 WRT when it comes to building widgets for S60 (Symbian) platform. If I have to build widgets for different mobile devices (running on different platforms), Yahoo! Mobile Widget (Blueprint) is good option.

I have to learn new things, which is good, but I was wondering – why can’t I use my existing skills (ActionScript + JS/HTML/CSS) to build things for mobile devices without learning new workflow and technology?

When are we going to see Adobe Integrated Runtime for mobile devices – Mobile AIR? Life would be lot easier, I could transform a lot of my ideas easily into applications?

Hope it happens soon, really soon.

Technorati tags: , , , , , ,

How to get URL query-string variables within Flex application

On flexcoders, someone asked, how to get the URL parameters in a Flex 2.0 application? By URL parameter, I mean the query-string variables, as shown below:

http://yourserver/yourapp.swf?name=Joe&age=22 or http://yourserver/yourapp.mxml?name=Joe&age=22

Note: To get the variables in flex via mxml file, you need server-side compilation of mxml files.

You can get the values of the params using from

mx.core.Application.application.parameters

object, which contains the name-value pairs (hash-map).

For example,

mx.core.Application.application.parameters.name

would return “Joe”, considering above example URL. You can find more information about this in livedocs: http://livedocs.macromedia.com/flex/20beta1/docs/00001300.html

Then someone asked, what if your swf is embedded in custom html wrapper, how to get the query-string params inside swf?

Most of us use ExternalInterface class in Macromedia Flash Player 8(onwards) to invoke some JavaScript functions and extract the value in ActionScript.

I wrote a quick-and-dirty class in ActionScript 3, which would get the values of params from URL query-string for you. You don’t need any extra JavaScript code in HTML. The same logic can be used for any an ActionScript 2.0 running Macromedia Flash Player 8.
QueryString class has following properties:-

  • parameters – an Object which contains the name-value pairs from query-string
  • queryString– String, this contains the entire query-string (url-encoded) name-value pairs.
  • url– String, this returns the complete URL of the wrapper page with query-string.

See demo
Download source files