New ScotFlash Website now live.

The past couple of years have been the busiest in my 15 years of doing Flash/Web Front end Dev(hence no post’s on here since 2011). The past couple of months have been my quietest.

A couple of months ago one of my clients asked if I could look into a html5 solution that had been developed in Flash. Coming from a background of nothing but Flash for over 10 years I didn’t relish the thought of developing something in html that I had already developed in Flash.  I do have HTML and CSS experience but I thought this would not be enough. Needless to say I took on the challenge.

My first port of call was jQuery. I’ve heard other developers speak highly of it. To say I was pleasantly surprised was an understatement!
Lightweight, Cross browser compatibility, very easy to understand and implement.
It didn’t take me very long to start porting my Flash code over. To my surprise 2 weeks later and I delivered a POC that mirrored what had been developed in Flash.

I’ve had some free time in between projects since then and using jQuery to develop the POC was an eye opener. I decided I would take what I learned from the POC and see if I could mirror my personal Flash site Innovativedesigns (just as a learning experience). If you where to believe the hype Flash is dying! So they say. So I thought I better start looking into HTML5 and it’s surrounding technologies.

My biggest concern was “Cross browser compatibility”. I’ve seen this thrown about so many times over the years that it acted as a deterrent to stay away from html development. I’ve had it easy not having to worry about this since Flash would play fine on just about any browser or media device that had the Flash plugin installed :) .

Starting off I would just develop on one browser(Chrome) and see how far I would get before things would not work, look or act as I intended. I even went as far as to name the dev folder “2014″ as I thought it would be at least 2014 before I would have something that would even closely resemble my Flash site.

Three weeks into development and making some serious ground with every headache that I encountered google and stackoverflow was there to guide me. Six weeks into development and finding myself pretty close to being finished I start testing across different browsers and media devices. The site has shown to perform flawlessly. Even on tablets and iPads.

I still have further functionality I would like to add to the site but I am extremely pleased with what I’ve accomplished in the 6 weeks.

For the record I now love jQuery.

Posted in CSS3, html, jquery, php, What i am upto | Tagged , , , , , | 1 Comment

What I’ve been upto

I cannot believe how quickly the past 6 months have flown by. Has it really been since January since I last made a blog post. It’s to easy to just tweet rather than post something to the blog. Follow me on Twitter

I would like to say it has been a busy 6 months but that would be lying. This year was the slowest start to the year for me since I started freelancing over 10 years ago. So with all that free time I started to take a serious look at development with AIR for android and Ipad. Still got nothing to show at the moment but things are moving along nicely.

dopeawards-logoThings have also been moving along nicely with dopeawards. Some nice new features have been added to help improve the UI. You can check them out here.

I’ve set-up a new twitter account as I feel it’s time to drop the @glasgow_flasher account. You can now follow me @scotflash. I would like to thank all the peeps(tweeps) that have started following my second account. I’ve also taken a moment to get set up with google+. You can find me here.Follow me on google+ Need an invite? Linky

Posted in Android, Flash AS3, What i am upto | Tagged , , , , , , | Leave a comment

Save masked image to server. AS3

This is a follow up to my previous post Crop bitmapdata under mask to create new bitmap. In this example I’ve set-up to allow for the cropped image to be saved out from flash to the server. There is also an additional php script to handle the data being sent from flash to create the exported jpg.
Below is the code that is used to save the cropped image to the server and then load it back into flash.

  1. //Save cropped image to the server.
  2. function saveCroppedImage(e:Event):void {
  3.  //Matrix to holder the area to be cropped
  4.  var maskRect =mcHolder.mcMask.getBounds(mcHolder);
  5.  //Matrix of image to be cropped
  6.  var imgMatrix= mcHolder.mcImg.transform.matrix;
  7.  //Cropped image
  8.  var myCroppedImage:Bitmap = cropImage(maskRect, imgMatrix, mcHolder.mcMask.width, mcHolder.mcMask.height,mcHolder.mcImg );
  9.  //Get new matrix of cropped image
  10.  var m:Matrix = myCroppedImage.transform.matrix;
  11.  var urlLoader:URLLoader = new URLLoader();
  12.  //Set jpg quality of the image to be export 1-100
  13.  var myEncoder:JPGEncoder = new JPGEncoder(80);
  14.  //Create jpg to be exported
  15.  var jpgSource:BitmapData = new BitmapData (mcHolder.mcMask.width, mcHolder.mcMask.height);
  16.  jpgSource.draw(myCroppedImage, m);
  17.  //Create byte array to hold jpg data
  18.  var byteArray:ByteArray = myEncoder.encode(jpgSource);
  19.  var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream");
  20.  //Send image to the server to be saved
  21.  var saveJPG:URLRequest = new URLRequest(_path+"saveImage.php?r="+imgID);
  22.  saveJPG.requestHeaders.push(header);
  23.  saveJPG.method = URLRequestMethod.POST;
  24. = byteArray;
  25.  urlLoader.addEventListener(Event.COMPLETE, loadCroppedImage);
  26.  urlLoader.load(saveJPG);
  27. }

Here is an example:
Drag the image around then click “crop image”. The second image that appears has been loaded from the server and clicking on “view in browser” will display the saved image in a new browser window.

Get Adobe Flash player

Source example:

Credits: vamapaull, Photo Booth – Flash Webcam Image Capture (insight into export an image from Flash)

Posted in Flash AS3, Flash general, php, What i am upto | Tagged , , , , , , , , , , , | 2 Comments