Archive for the ‘Flash Experiments’ Category

How many days until Christmas? Here’s a timer…

Monday, October 17th, 2011

Get Adobe Flash player

I created this little puppy a while back, maybe 2004. Just found it on my hard drive and thought I’d add a post with it in. It dynamically updates the stats based on daily averages I set up at the beginning. It also takes the year from the current system clock, so should just tick over into the next year on New Year. The bit in-between will go a bit strange, but I’m not that fussed about fixing it. Feel free to do it yourself.

The source is here, but it’s a bit old skool. It’ll give you a few ideas though if you’re brave enough to open it.

Shhhh, Adobe sidesteps up to HTML5

Sunday, August 7th, 2011

The bunfight seems to have calmed down from the dizzy heights of the iPhone OS vs Flash storm earlier this year. Adobe or at least Flash was on the ropes and taking a battering.

Adobe had a few interesting innovations that were almost ignored in the melee. Their response to the Flash v’s HTML5 tirade seemed to be that Flash is a great platform to develop on, then you can spit out Flash, iPhone Apps, HTML5 etc. The HTML5 exporter seemed to get lost in translation.

Nice to see Adobe putting it back onto the agenda with their new inspiration site The Expressive Web. It was put together with US uber agency Big Spaceship and is a great inspiration and learning resource for the latest HTML and CSS techniques like transition, audio and the like. Sure, the zealots will get all sniffy, like the Adobe moniker has tainted the purity of the code, but we’re more grown up than that, aren’t we?

Do Penguins use Flash AS2?

Tuesday, September 14th, 2010

Looks like those penguins down at Club Penguin are being put to good use. Just noticed this little Easter egg… Go to the homepage of Club Penguin, click Play Now and zoom into the lower part of the screen (expand your browser window). Looks like they are using AS2 though… god help us when they figure out HTML5! Still, I assume they are working on Linux :)

iPhone app development tips for Flash types

Wednesday, December 2nd, 2009

Just watched Lee Brimlow’s quick demo of Flash CS5 saving out an iPhone app. Watch it!

Now, first things first, we’ve made a few iPhone apps at Digital Outlook already in native Objective C and although I’m nowhere near being even remotely classed as a developer, I have been on a basic iPhone dev course and have spent a good length of time debugging and mildly fiddling with the existing apps we have. I’ve made a few simple apps myself so I’ve got a fair understanding of how it works I guess.

I’ve also go a VERY acute understanding of the process and costs involved in creating a native iPhone app from scratch from within an agency. At the beginning, they said “take a Flash app, budget the coding part, double it and add another half”. Cool. Nowhere near. Without going into detail, it seems iPhone App development isn’t quite as simple as it’s made out to be. Yes, your developer may know Objective C, applying it to the iPhone development environment is another thing. Us Flash guys could only stare on as seemingly simple issues took days and weeks to resolve.

So the fact that the Flash SC5 release will compile to iPhone is immense news for me, us and probably every digital agency and Flash freelancer on the planet. Sure there are things it can’t do. Sure you get a bundled app that you can’t ‘add to’ in the native development environment. Sure you can’t use the camera and a few other api’s. And it may be a bit slower than a native app, but take it from me, I’ll take all of those on the chin for the ability to get a creative idea onto the iPhone and into the hands of the world’s mobile consumers.

I can’t wait for CS5 to drop but in the mean time, here are some of my observations from native iPhone development from my Flash perspective.

  • Objective C may look like AS3 but it works in a whole different way. From declaring variables to having a .h header file to your .m main class files. Don’t even think of using a ‘Trace’ or C ‘Print’ command. Underestimate the differences at your peril… but don’t be scared either. If I can do it, so can you! (No, seriously, I’m not that clever).
  • Debugging already written code is really easy when you know your way way around. Moving graphics, font sizes, swapping sounds, changing text etc. are all pretty straightforward with a simple search to narrow down the location to work on.
  • The assets are held externally to the project, so changing graphics, movies, audio etc. is simple too, just swap out the file and recompile.
  • The graphics are just plain old JPEGs and PNG files, so your designers are more than up to the job. It’s just like a Flash project as far as that goes.
  • If you have time / money, put a rough Flash demo together first. Changing your mind and feature creep during production can be slow and costly.
  • The iPhone development suite is really slick (unlike Android I may add!). The on-screen emulator is great and allows you do test it (with a few exceptions) without needing an iPhone or a developer account.
  • If your app uses accelerometers, cameras etc. the emulator will fall short as it’s can’t ‘emulate’ an accelerometer. You can get around it by installing an app on your phone to transmit the accelerometer data to your mac, then add a little code to your iPhone build to receive the data and substitute the values in the emulator. Here’s an example of screen-capturing the emulator using this technique. See the Accelerometer Simulator by Otto Chrons for more.
  • The icon is VERY important. Make sure you spend time on it. And by the way, the glassy shine and round corners are automatically added to your icon on the phone itself. You can switch the shine off though, but not the corners.
  • If you don’t have them in-house, freelance iPhone developers will charge you anywhere from £250-£500 a day.
  • If you shop around and do your research, you soon find out that the cheap way to get an iPhone app done is to go ‘off-shore’. South America, China and India are all much cheaper than your average LA, London or New York dev agency. However, they do come with the usual health warnings about production values, creative sign-off and time-zone / communication problems.
  • If you have the money and it’s your first app, get someone local to hold your hand and learn from. If not, make sure you have scoped the project within an inch of its life. After the project, budget for an extra half-day for your iPhone dev to explain what he/she did to your Flash dev team. Shame to pay all that money and lose all the knowledge.
  • Memory management is now your problem. You have to allocate memory and release it as you go. This is one of the big areas that Apple check when you submit your app to the App Store. You don’t have to allocate actual memory size as in assembly language, but you do have to ‘manage’ closely.
  • Do register with Apple and get a developer account. You can get the dev environment for free and start compiling but you can’t transfer anything onto your iPhone without a developer license and associated provisioning files.
  • While I mention it, the process to authorise your computer and set up your first app is a bit of a faff. Still not 100% sure I understand it but the instructions on the Apple site are clear enough to get you started.
  • The app submission process is pretty simple and the time taken to get a response is anywhere from 2-4 weeks. I know the guys at Apple and even they can’t affect this process, so don’t ask! However, in general, if your app is basic and doesn’t have any advanced functionality such as external database calls or live data, you go into a ‘less risky’ pool, and are generally through in less time. If you are rejected, you go to the back of the queue.
  • Make sure you look at what everyone else is doing too. Download everything remotely related to compare. Look at the top 3 in each category too, there’s a reason they are there, whether it’s the content, the execution or the user-interaction. It’s all vital knowledge.
  • The ‘Games’ category is the most varied and the most competitive. Before you assume your first app should be a game, consider that it will be up against the EA’s and the Need for Speed’s of this world. If you’re not in the top 20 pretty quickly, you pretty much free-fall until you become all but invisible to the regular browsers.
  • To charge or not to charge? 59p says “Aaaah, hell, why not”. £2.99 says “This better be good or I’ll tell everyone it’s a rip off and rate it 1 star”. Initially, you need to go for ratings, so consider an introductory low rate then change it if you see an appetite and good ratings. It’s easy to change the price on the fly.
  • And finally, if you can wait until April 2010, consider using Flash CS5! :)

Stitched up by my own webcam!

Friday, March 27th, 2009

Another strange webcam experiment! Click the image to launch it.

I take the raw cam feed, find what changes between frames and add a threshold filter to colour the bits that change to a solid red. I then simply loop through the pixels to see if any are red then use the pixel position to draw lines to and from, sampling the original image to get the correct line colour. Completely no use to anyone… but looks nice enough.

How to become a rocket scientist in 3 minutes…

Tuesday, March 3rd, 2009

Did some fun training the other day with Katie Ledger and part of it was presenting something in 3-5 minutes. So I though I’d go large and explain how to become a rocket scientist in 3 minutes. It’s essentially a super-top-line overview of how to build the simplest type of pulse jet engine… the ‘pop pop‘ boat engine. Thought I’d start with something that shows the principle before introducing the fantastically simple valveless pulse jet. I should also explain this was at Digital Outlook, a digital marketing agency, so was a little off-piste to say the least.

Anyhow, here’s the video. Bit embarrassing but hey, it’s worth it if you may learn something! :)

If you’re weird, you can get the PowerPoint presentation here.

A simple Flash 3D engine from my past…

Tuesday, February 10th, 2009

Just trawling through a few old Flash folders on my mac and found this little fella’ sitting there all unloved. Came up with the 3D engine in 1998 using Director and made a quick hack to get it into Flash. It’s not particularly neat, hence why there’s no source posted, but suffice to say the heart of he 3D bit is that old ‘fake-doodle-dandy’ equation…

var x = (worldLens*pointX)/(pointZ+worldScale)+xOffset;
var y = (worldLens*pointY)/(pointZ+worldScale)+yOffset;

Like so…

Launch it to fill the browser

If you really want the code, let me know, but I’m secretly ashamed of it… :)

Webcam background removal in Flash

Thursday, November 27th, 2008

If you’re a fan of the EyeToy or you’ve just got You’re In the Movies on Xbox 360, you’ll know what this is all about. How to remove yourself from a web cam image and superimpose you on another background.

The mighty Jop had a bit of a testbed working and I thought I’d get the old brain working again and have a tinker. It’s not pretty code but it’s available below if you’re interested in a few pointers. It’s also not that good, but if it inspires you to do it better (I.e. properly) then it’s done its job.

If the web cam doesn’t initailise. Try this link:

In a nutshell:

1: Grab camera feed

2: Take a snap of the background

3: Use a ‘difference’ filter on them both to fighure out which pixels have changed the most

4: Use a ‘threshold’ filter to remove all the pixels that haven’t changed much

5: ColourTransform the resulting pixels to black

6: Apply a slight blur to help make it less jagged

7: Cache the resulting image as a bitmap (so it can be used as a mask) and put it over a copy of the live feed

8: Cache the live feed as a bitmap and apply the mask

9: And repeat using an interval or similar

Here’s the main function:

function takeSnapshot() {
//grab the cam and render it into a snapshot bitmapData obj
snapshot.draw(output_vid);
}

function checkVid() {
//grab live cam
liveData.draw(output_vid);
// grab snapshot
maskData.draw(snapshot);
// apply difference to 2 images
maskData.draw(liveData, new Matrix(), new ColorTransform(), ‘difference’);
// remove all unchanged pixels. Make them transparent
maskData.threshold(maskData, new Rectangle(0, 0, output_vid.width, output_vid.height), new Point(0, 0), “<=”, (threshVal/100)*0x00ffffff, 0×00000000, 0x00ffffff, true);
// colour what’s left black
maskData.draw(maskData, new Matrix(), new ColorTransform(0, 0, 0, 1, 0, 0, 0, 0))
// Blur to improve quality
maskData.applyFilter(maskData, maskData.rectangle, new Point(0, 0), blurFiltr);
resultData.draw(liveData);
// cache the resulting mask and apply it to the live feed
mask_mc.cacheAsBitmap = result_mc.cacheAsBitmap = true;
result_mc.setMask(mask_mc);

}

Source is here. Have fun!

How to remove the front panel from a Samsung RS series fridge

Monday, September 29th, 2008

Here’s the latest in the series of my “I fixed it and here’s how I did it” articles. This time it’s a Samsung RS21JGRS fridge freezer. The ice dispenser ‘flap’ came loose and stopped the ice coming out. Quick search on t’internet didn’t yeald much so in the spirit of sharing, here’s how it’s done. This is also the way to get to the water nozzle, change the face plate etc. and is relevant for most RS21 models I guess.

Have a look at the Samsung UK site here to see the sorts of Samsung fridge freezers it applies to…

Incidentally, this was the closest to an answer I found on  ukwhitegoods.co.uk:

You should also know I’m not a freezer engineer, this will mess with your warranty, I’m not liable for any damage or harm you cause etc. Use this as a guide, what you do with it is up to you. The photos below show the electricity being on… you should probably switch yours off! It only takes 10 mins or so to do the whole procedure, so nothing will defrost in that time. Remember, safety first kids!

Step 1: The freezer door of your fridge/freezer should look something like this… with water dispenser on left and ice on the right.

Step 2: First up, push the tip of the water tube backwards to release it from the plastic housing. It kinds pops out but don’t push it too far back, it’s just to release it.

Step 3: Use a blunt, fat screwdriver blade and insert it in any of the two slots under the main faceplate. It’s important the screwdriver (or other tool) isn’t too sharp or scratchy as it may mark the main fridge surface if it slips. Very gently but firmly, lever the panel outwards (pull screwdriver handle towards you). It should make a loud pop as the tabs let go. Try not to twist the screwdriver as this may cause small dents in the plastic. It’s a bit disconcerting at first but it does work.

Step 4: Work your war around. There are four on each side. See the image on step 6, the notches are there the ‘pops’ should happen.

Step 5: Wiggle the panel out. There is an electronic connector at the back with a clip holding it on. Lever up the clip and push the connector apart. This will separate the panel completely. Put it somewhere safe.

Step 6: Should look something like this…

Step 7: Undo the two (maybe three) screws holding the plastic panel in place and hinge it out as shown. You can unclip the wires if you like, but you really don’t have to with this technique.

Step 8: To get the panel out of the way, I taped it to the handle…

Step 9: The ice flap has a long hinge pivot on the left and a short on on the right. If you need to remove the flap, push the right side towards the left (or prise it with the big screwdriver you used earlier) to free the right-had pivot.

Step 10: Once free, pull it towards you a little and to the right to release the longer left pivot. Watch out for the little spring thing. Put your finger under it to stop it going ping. Be careful to pull the flap directly towards you once free, as the funny white lever on the left hand side needs to slip out of the hole without snagging.

Step 11: Flap removed…

Step 12: And finally: When you reassemble, you have to be careful to do three things at once while refitting the flat. First, put the funny lever on the left in the hole. Second, make sure the spring lever is pulled back and has some tension on it… and is to the left of the slight fin on the roof of the housing. Lastly, make sure the left pivot (the longer sire) goes in first. Once you have all three checked off, just push in the right side to engage the right pivot. Job done! Now assuming you’ve switched off the electricity, you may notice the strange lever on the left won’t go in the hone. This is the delay mechanism you hear after it dispenses ice. It will only release when there’s power and the microswitch on the panel has been activated (i.e. when it’s all back together again). If it stays out as pictured, just push it upwards to release the ratchet thing and the flap should pop back flush to seal the hole.

Parts: If you need to replace the flap, it looks like this…

My very first piece of flash…

Thursday, April 24th, 2008

Just as a bit of silliness, I thought I’d post my first flash movie. I’d worked in Director since 1992 and got thrown in at the deep end one day (some time in 2000 I think). Even has roller goodness. Er, awesome. Gotta love Flash 4 Actions