07 November 2007

Google AdWords and Math.random

A colleague just came across a problem with a Flash banner when uploading it to Google AdWords.

The banner contained an effect where many movie clips were randomly generated and positioned. Yet when uploaded to Google AdWords, an error occurred stating that random numbers could not be used.

The problem is with Math.random, Google AdWords doesn't allow it. We called the AdWords help desk and they confirmed that Math.random cannot be used, but were unable to give a reason why.

Is this a security hole in Flash? LiveDocs say Math.random is "calculated in an undisclosed manner", so does it use the client hardware to generate that number? I'm now intrigued, if anyone can shed some light on this please comment.

07 August 2007

Two Flavours of AS3?

Actionscript 3 was first introduced with Flex 2 in the summer of 2006. At this time Macromedia (the inventors of Flex and Flash) were being acquired by Adobe. Previous to the acquisition all Macromedia class packages were prefixed with "mx" e.g. "mx.controls.Button".

Flex 2 kept the Macromedia "mx" naming convention and it seems Flex 3 (due for release later in 2007) will do the same. However Flash CS3, has been "Adobefied" and class packages relating to Flash CS3 are prefixed with "fl" e.g. "fl.controls.Button" - makes sense though.

These class libraries share a lot in common, though it appears that the Flex libraries are more extensive than Flash CS3. It'll be interesting to find the boundaries between Flash and Flex Actionsctipt as we use it more.

Flex is component based and is used to build rich user interfaces quickly and easily - it's kind of a "Flash for Web Developers". Flash is more graphical and suited to visual presentations and games. Under the hood, they are essentially the same, Flex and Flash are programmed in AS3 and except for the MXML interpreter in Flex, the AS3 compiler (I currently believe - I may be wrong) is the same.

This raises some important questions:
  • Can the Flex 2 compiler be used to compile AS3 for Flash?
  • Will we have 2 flavours of AS3?
  • Why buy 2 products that build swf's?

Ultimately I think the answer is that Adobe can have two $500 applications for sale rather than one. It is quite confusing (well it confuses me)! Should we now be called "Actionscript Developers" not "Flash" or "Flex" developers?

This may be a good thing. For example, Java developers have many different routes to choose from and a Java developer who knows his/her beans (so to speak) get high-end salaries / contracting rates. It could also root Actionscript 3 as a "proper" programming language for RIA's (Rich Internet Applications).

Another possibility is that Adobe merge the Flash timeline, library and drawing tools into the Flex Builder. Although that's probably never going to happen!

Compare the AS3 References

30 July 2007

Edit and Compile AS3/Flex for FREE!

Having exhausted my supply of free trials of Flash CS3 and Flex Builder, I managed to work out how to attach the latest Flex 3 compiler to FlashDevelop. Editing AS3 in Flash Develop is as good as the Flex Builder's text editor in Eclipse. It does all the imports and the predictive typing drills into classes perfectly (including your own). MXML is not that good but can still be compiled by the Flex 3 compiler. In Flash develop you can choose between an AS3 project and an Flex (MXML) project, either of them can be compiled.

Setting it up

These instructions are for the Flex 3 beta version (Moxie), the links to the Flex download will probably change once Flex 3 is fully released.

For this you will need to download:

  1. Install the latest version of FlashDevelop
  2. Unzip the SDK to C:\Program Files\FlashDevelop\Flex3SDK
  3. Launch FlashDevelop
  4. Go to Tools -> Program Settings -> Plugins -> AS3Context -> Settings.
  5. Set "Flex2SDK Location" to "C:\Program Files\FlashDevelop\Flex3SDK"


To test do the following:
  1. Go to Project -> New Project
  2. Select "ActionScript 3 - Default Project"
  3. Set the Name as "Test" and select your Location and click OK
  4. Project -> Test Movie
  5. You should see a new blank screen named Test.swf


As it' a .NET application it works only on a Windows PC. However, there are reports on the FlashDevelop messageboard that it also works fine on Intel based Macs.

16 July 2007

A Decent, FREE, AS3 Editor!

I used to use SEPY a lot, but it just didn't cut the mustard for AS3. Having used the Flex 2 Builder I wanted something that'd do all the imports and have good predictive typing to help me through my first AS3 projects until I get used to the class structures.

After a lot of searching around, I found this:
http://www.flashdevelop.org/

09 July 2007

MySpace technical woes.

I, as many, have a page on MySpace (www.myspace.com/lapsusmentismusic). There's always been little niggles with MySpace, occasional "an error has occurred" messages, which I put down to shoddy Fusebox programming.

These days it seems the errors are occuring so frequently that the MySpace application is frustrating and almost impossible to use, without getting one of these errors. A large part of their problem lies in the success of MySpace and the huge amounts of traffic it generates. The architecture to support massive traffic volumes just wasn't there.

I found this interesting article that explains their technical woes and is a lesson to us all: http://www.doughughes.net/index.cfm?event=viewEntry&entryId=116