search
top
Currently Browsing: Flex

Flash Platform tooling beta

Flash Platform tooling beta launch is now live. Adobe rolled out a lot of content on the labs and devnet. Get the latest Flash Builder 4 (ex. Flex Builder) and Flash Catalyst to play with them.

  1. Labs content
  2. Devnet articles
  3. Press release http://www.adobe.com/aboutadobe/pressroom/pressreleases/200906/060109NewFlashPlatformTools.html

replace vs. split and join performance in ActionScript 3

In the previous article inside the source code for the regular expression tester you can find the following line:

var htmlString:String = string.split("\n").join("<br />");

I have found this in an ActionScript 3 example at one time and I remembered this as it is a nice construct. However there is another, more common way to write this:

var htmlString:String = string.replace(/\n/g, "<br />");

So I start questioning myself, which one is faster?

After running some tests the results are: split and join ~ 1100ms, replace ~ 800ms. The test was run on a generated string of 16 mil. characters. So, unless you are planning to do this operation on a large data set the difference is not that big and it does not matter which one you will use. For 100k characters both score around 15ms.

Flex Regular Expression Tester – source code

There are a lot of improvements that can be made to this piece of code and when I will get some time I will move forward with the changes. Until then I will post here the source code as it is still small and developers new to the world of regular expressions may learn something from it.

BTW, I have used Flex 4 :)

(updated on 04.15.2009)

   1:  <?xml version="1.0" encoding="utf-8"?>
   2:  <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
   3:      xmlns:s="library://ns.adobe.com/flex/spark" pageTitle="Flex Regular Expressions" 
   4:      xmlns:mx="library://ns.adobe.com/flex/halo" height="400" 
   5:      viewSourceURL="srcview/index.html" creationComplete="init()">
   6:      
   7:      <s:layout>
   8:          <s:BasicLayout/>
   9:      </s:layout>
  10:      
  11:      <fx:Script>
  12:          <![CDATA[
  13:          import mx.skins.spark.ButtonSkin;
  14:          private var error:String;
  15:      
  16:          protected function test_btn_clickHandler(event:MouseEvent):void
  17:          {
  18:              var restr:String = regexpInput.text;
  19:              var input:String = textInput.text;
  20:              var igstr:String = modifInput.text;
  21:              
  22:              this.error = null;
  23:              
  24:              if(restr != null && restr != '' && input != null && input != '') {
  25:                  var myPattern:RegExp = new RegExp(restr, igstr);
  26:   
  27:                  var result:Object = myPattern.exec(input);
  28:                  
  29:                  var a:String = '';
  30:                  var b:String = '<br />';
  31:                  var index:int = 0;
  32:   
  33:                  while (result != null) {
  34:                      // copy string from last match
  35:                      a += '<span>' + encode(input.substring(index, result.index)) + '</span>';
  36:                      index = result.index;
  37:                      
  38:                      // copy the matching parts
  39:                      a += '<span color="#339933">' + encode(result[0]) + '</span>'
  40:                      index += result[0].length;                
  41:   
  42:                      // create the trace string
  43:                      b += '<br /> ' + result.index + '\t'; 
  44:                      for(var i:int = 0; i<result.length; i++) {
  45:                          b += result[i] + ',';
  46:                      }
  47:                      
  48:                      if(igstr.indexOf('g') == -1) {
  49:                          a+= input.substr(index);
  50:                          break;
  51:                      }
  52:                      result = myPattern.exec(input);
  53:                  }
  54:                              
  55:                  a += '';
  56:                  resultText.content = a + b;
  57:              }
  58:          }
  59:                      
  60:          protected function encode(string:String):String {
  61:              var htmlString:String = string.replace(/\n/g, "<br />");
  62:   
  63:              return htmlString;
  64:          }
  65:          ]]>
  66:      </fx:Script>
  67:   
  68:      <s:Panel id="contentPane" width="100%" height="100%" left="0" 
  69:          title="Flex Regular Expressions" >
  70:          
  71:          <s:TextArea left="10" right="10" height="150" top="10" 
  72:              text="She sells seashells by the seashore" id="textInput" />
  73:          <s:TextInput text="(\w*)sh(\w*)" id="regexpInput" left="10" top="168" right="175"/>
  74:          <s:TextInput id="modifInput" text="ig" right="85" top="168" width="78"/>
  75:          <s:Button label="test" id="test_btn" right="10" top="168" 
  76:              click="test_btn_clickHandler(event)"/>
  77:          <s:TextArea id="resultText" left="10" right="10" top="198" bottom="10"/>
  78:      </s:Panel>
  79:      
  80:  </s:Application>

Flex Regular Expressions Tester – a new version

Some time ago I have created a Flex regular expressions tester. When I have moved my site to ICE I have decided to improve a little bit this tester and right now there is a new small Flex application that can be used to play around with some neat symbols :)

http://www.stratulat.com/Regular_Expressions_Flex.html

Search for Flex and AIR knowledge

The Adobe Platform Evangelists team are trying to find who’s doing Flex & AIR in Central and Easter Europe. If you are a company/independent consultant that knows Flex and/or AIR please drop a note here (corlan.org) specifying:
-    Your name
-    Type (agency/independent consultant)
-    WebSite
-    Contact info
-    Address/Location
-    Any other comments

Snackr: get your feeds together.

You want to get your feeds closer?  Check out this new application build using Adobe AIR and Flex 3: Snackr.

Snackr screenshoot

Snackr is a RSS ticker that pulls random items from your feeds and scrolls them across your desktop. Thank you NJ.

Free Adobe® Flex™ Builder 3 Pro for Education.

Ted Patrick writes on his blog that Flex Builder 3 Pro is free for Education.

So if you are a student of a professor just go to FlexRegistration.com claim your copy.

Flex 3 and AIR 1.0 are out

Flex 3

Adobe released Flex 3, the free open source framework for building rich internet applications. It’s time now to build real cross platform web applications that work the same no matter in which browser the application was opened or which operating system the user has.

Flex 3 is open source and is free. The new site opensource.adobe.com is hosting the source code and the community resources for Flex SDK and BlazeDS. And talking about BlazeDS.. for whom is familiar with LCDS, this is the free version of server based Java remoting and web messaging technology. It enables (among other things) server push to Flex and AIR clients.

AIR 1.0

The Adobe® AIR™ runtime lets developers use proven web technologies to build rich Internet applications that deploy to the desktop and run across operating system.What is great about this framework is the ability to develop desktop applications using Flex, Flash and Ajax. So if you are a skillful Ajax developer and you have a powerful web application that you think will benefit from running on desktop, you are definitely interested in AIR.

Adobe Flex User Group for Romania

A new initiative was started and I wish it good luck. A Flex developer from Craiova is trying to create the first Flex User Group in Romania and right now he is on the mission to deliver his message to as many Flex developers he can.

You can found out more here:
http://www.craiovaforum.ro/scripting-client-side/adobe-flex-user-group-pentru-romania-164146.html. (article in Romanian)

FlexCamp Bucharest

Last night we organized the first major event at Adobe Romania: FlexCamp Romania. There were a lot of attendees and all of them were curios about how this event will go as, from my knowledge, there was no such event organized in Bucharest until now.

We had a lot of swag for this event and the whole team switched to an old factory process: the production line.
swag packaging production line

First one to present was Matt Chotin, Product Manager for Flex. The room was full and the people interested in his presentation. He talked about Flex, AIR and also Thermo. Some of the audience knew about Thermo as videos from MAX 2007 where it was first presented were posted on youtube.

Matt Chotin - keynote

He was followed by Andrei Dragomir, our Ajax and Flex specialist that presented an overview of Flex. His session was long and intensive as there are so many things you can say about Flex.

Andrei Dragomir - Flex Overview

However there were also breaks :) . During those brakes, we ate pizza, drink beer and most importantly socialize. All the people got to know others that share the same interest and we were also very busy (and that’s a good thing) answering different questions about Flex, AIR and about Adobe user groups, as many of them were interested in joining or creating one.

breaks

Oh, I forgot to tell you, we broadcast FlexCamp live using Adobe Acrobat Connect and also recorded all the event and everything is available on myadobe.ro site.

HD web camera for good video feed

Dragos Georgita took his turn and presented AIR along with a lot of cool samples.

Dragos Georgita - Adobe AIR

After some small technical difficulties (his computer closed just before his session), Mihai Corlan held the first hands-on session about how you can create a cool Flicker gallery.

Mihai Corlan - Flickr Gallery in Flex

The second hands-on was about web services and Flex and Cristi Ivascu presented the new wizard available in Flex Builder 3 that inspects a WSDL file and generates the ActionScript client that knows how to use that service. One of the main advantages is the creation of all the complex types used by that service so the developer can have access to a strong type framework in using it (code completion and everything).

Cristi Ivascu - Flex Application development and SOA

Mihai Pricope’s hands-on was about data synchronization in Flex and even if it was a late hour he managed to get all the audience excited about the subject through his unique presentation style. He proposed a poll application and all the audience was able to vote and see the results changing in real time on the screen behind him.

Mihai Pricope - Data Synchronization with Flex

In the end the whole Flex team stepped in front of the audience and we were bombarded with a lot of questions and hopefully we managed to answer satisfactory for most of them.

Flex Team under siege

Overall we think this event was a success and we are already planning for another one at the beginning of 2008. That one maybe will be bigger and we’ll try to involve more the Flex community giving them the chance to present their work and ideas.

« Previous Entries

top