2011 wrap up

no one probably gives two shits what i think was the best things to come out of this year, but hey it’s a good record for myself. so if you are reading this, give yourself a pat on the back for me. also note that not everything in this list was released in 2011, it’s just when i first experienced it. and remember, this is a list of my favourite things.

Console/PC Game of the year
Winner: Deus-Ex: Human Revolution (PC)
being a huge fan of the original and given invisible war was a let down, i was hugely sceptical of this one. the very nice augmented edition enticed me to pre-order – something i hadn’t done all year. and so entering was expectations set to zero, i was pleasantly surprised by the brilliant world square enix had created. they obviously took a lot of notes out of the original’s book and it showed. now if i can just get a new computer so i can run it at max settings…

Mobile Game of the year
Winner: Phone Story (Android)
this game is not so much a game but a cheeky and depressing lesson. it hits the nail right on the head and screams the message out with hilarity that makes you feel bad for laughing. hopefully this game starts a trend in this genre learning through games that stays far away from games in the 90s like ‘mario is missing’

Movie of the year
Winner: In The Footsteps of Marco Polo (2008)
Ok i don’t watch many movies. probably saw under 20 this year. and half of them on flights. and the ones i do watch are normally documentaries. so it comes with no surprise that a documentary wins. this one is about 2 insane americans who decide to follow the route of marco polo from venice to china and back again – avoiding air travel. they somehow get through Afghanistan and Iran with the help of local warlords. great watch if you like travel.

Album of the year
Winner: Endgame by Rise Against
No surprise here from a punk rocker. Brilliant flow. message stronger and clearer than ever and the vinyl edition sounds great. if you like punk or just rock music with a message, give this one a listen.

Book of the year
Winner: The Shock Doctrine by Naomi Klein (2007)
It’s a beast of a read and pretty heavy to digest, but once you get through this book, it will change the way you view economics and politics. thought provoking, scary and surreal, klein begins the book with a massive slap to the face and remains relentless throughout. not one you’ll want to put down. an eye opener.

Gig of the year
Winner: One day as a lion (Prince of Wales)
Out for the big day out, Zach de la Rocha and Jon Theodore played at St Kilda’s prince in a one off gig with all proceeds going to Queensland flood victims. Considering they only have one EP out i didn’t really know what to expect. Zach was his usual ball of intense anger screaming out lyrics from the self titled EP. Closing with the band/title track One Day as a Lion, the bass was an experience unto itself – I think most of the audiences hearts were moved if not emotionally, definitely physically!

Travel Desitination of the year
Winner: Mimosa Rocks NP
I randomly ended up here with Laurel on new years eve and subsequently the 1st day of the year and this is a great spot. I won’t say exactly where it is but you’re smart right? you’ll figure it out. And this spot beat out the New Zealand Ski fields, the Canadian Rockies and Central Australia – all great places. who says you need to go overseas to find great places?

Idiot of the year
Winner: The Australian public
Why? for giving Tony Abbott a better approval rating than Julia Gillard. Ok Julia, isn’t doing a fantastic job at selling herself and the Labor party, but come on. Tony Abbott is an absolute moron. I would rather vote for Family First than this buffoon – actually nah i wouldn’t go that far, i’d just off myself instead. so if you are like me and consider Abbott a loser consider yourself excused from this award.

Posted in wrap up | Leave a comment

AIR 3.0/FP 11.0 Mobile game test: Pure AS3 vs Flixel vs Starling

since the new air runtime is out for mobiles i thought i’d give it’s new performance benefits a speed test. i’ve created a simple demo which continuously generates a bitmap sprite and drops it down the screen at a random speed. on top of that each sprite rotates to add some extra strain on the cpu/gpu. once the sprite leaves the screen, it is destroyed. sprites are capped at 100 on screen at a time. i’ve also used my swfconsole tool to track the fps.

my test device is an HTC Desire running 2.2.2. i don’t have an iphone and don’t really want to sign up to there development program so if someone has an iphone and wants to test this, send me an email and i’ll put the results up. i run the test on the phone for a minute and take the average fps score.

the demo was built using FlashDevelop and following this very quick and ace tutorial. i decided to test out the performance of pure as3 with no additional libraries, the flixel framework and the starling framework. and here are the results: *drumroll*

Pure AS3
i deliberately didn’t use any blitting techniques in my demo as this is pretty much what flixel will do for me so this is simply a bunch of Sprite classes with embedded bitmaps falling down the screen.

CPU: 20 fps
GPU: 18 fps
File size:  60kb (not including air runtime)

Flixel
i had some pretty high hopes for flixel as i’ve used it before a few times and its fast. in this case it was too, however it’s only good for pixel based games as it was actually slower than pure as3 at full resolution (zoom 1). at a zoom level of 2, i got the following results:

CPU: 25 fps
GPU: 16 fps
File size:  112kb (not including air runtime)

Starling
this is the new GPU enabled library and unfortunately it doesn’t work yet :( most likely due to AIR for mobile not supporting stage3D yet. apparently it will be available sometime early next year according to Adobe. the demo kind of worked, but the viewport was totally screwed. i’ll post an update once stage3D is available for mobile. alternatively, if anyone has been able to get it to work, please let me know!

 

winner: 
well there isn’t really any clear cut winner. choose pure as3 if the res matters, otherwise go for flixel for pixel based games. as for starling, we’ll just have to wait and see…

Posted in AIR 3.0, as3, flash, FlashDevelop, flashplayer11, flixel, games, mobile, starling framework | 1 Comment

tutorial: twitter hashtag display with jquery

so i had an idea for a friend’s party to have a live twitter feed – kind of like Q&A if you know that program on abc. the idea was to have a constant stream of tweets so people could see what’s going on at the party. yeah pretty nerdy party i know, but it also gave me an excuse to try out the twitter API and a bit of jquery.

discovering how to do this on the internet actually took quite a bit of searching as both twitter and jquery have a bazillion articles on them so i decided to make this tutorial.

before you start, check out how it works here

step 1. create the html
this bit is the easiest part. the html can be anything. it’s the jquery that does all the work. just make sure you have an html file with a linked css file.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Twitter Party</title>
<link rel="stylesheet" href="styles.css"/>
<script type="text/javascript" src="jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="twitterparty.js"></script>
</head>
<body>
<div id="tweets">

</div>
</body>
</html>

the important parts are lines 6 – 8 and a having a div with id of “tweets” (although you can change this if you don’t like it).

step 2. calling the twitter API
so first thing you need to do is grab some tweets from twitter. for this we’ll use jquery since we’ll be using it for some visual effects as well. you first need to make sure jquery is ready to use so you can use the following code:

(function() {
})();

this is a shortcut for the jquery document.ready function. if you’re not sure what i’m talking about, search for it and you’ll find stupid amounts of resources on it. with jquery ready to go, we need to call the twitter api with the following call:

$.getJSON( "http://search.twitter.com/search.json?q=%23hashtag&result_type=recent&rpp=5&callback=?", {}, function (data)
{
$.each(data.results, handleTweets);
});

we’ve just used the jquery function getJSON which returns a set of data in the JSON format. you need to provide it with a url, a data set (in this case empty) and a callback function for when the function is complete. for the url, check the twitter api https://dev.twitter.com/docs/api/1/get/search. you’ll need to replace ‘hashtag’ with your own hashtag (don’t include the #. that’s what %23 is). here’s a breakdown of the url parameters:

  • result_type: here we are forcing twitter to return the most recent tweets
  • rpp: the number of tweets to get in one call. you might want to increase this if it’s a very popular topic.
  • callback: this forces a JSONP return which allows us to make a request from a different server than the twitter server.

as for the callback function, we use the jquery $.each function to send the data to a function to handle and display our tweets.

step 3. show me the tweets
so now you need a handler for the tweets. this isn’t too tricky so check out the code:

function handleTweets( key, data )
{
// use jquery to add html to the page
$( '#tweets' ).prepend( "<article><table><tr><td><span class='user'>@" + data.from_user + "</span> " + data.text + "</td></tr></table></article>" );

// hide the tweet so it can be animated in
$( article ).hide( 0 );

$( article ).slideDown( 500 );
}

this code grabs the data for twitter and creates a new article tag (html5) to put the message in. it also includes the user name wrapped in a span for some custom styling. so if you want to check what data you can get from twitter feeds, check the api link above. it’ll show you a break down of the result set and the corresponding name value pairs.

for this example we only use the ‘text’ and ‘form_user’ values to populate our article tag. note that i have used a table for vertical centering of the text in this demo. once the html has been created, it’s then a matter of animating it nicely. first you need to hide it using jquery, then use your favourite animation to bring it it. i simply used a slideDown which was effective enough for me. for more info check out http://api.jquery.com/category/effects/

step 4. handling multiple tweets
this is where it gets tricky. you’ll need to modify your existing code and add in a number of timers. do not use the jquery delay function. this only works on a single element. since we will be creating many elements, this will not work, instead you’ll need to use the javascript setTimeout to delay animations. anyways, check the complete code here:

* twitter party
* @author rohanlatimer.com.au
*/

var HASHTAG = 'ows'; // don't include the #
var UPDATE_INTERVAL = 2000; // how often to update the hash tag in milliseconds
var MAX_TWEETS = 10; // max number of tweets at a time. make this larger if the topic is popular
var ANIM_SPEED = 500; // speed of animation

var tweets = new Array();
var count = 0;
var tweets_per_call = 0;
var firstID = -1;

(function() {

// call the twitter api on a set interval
setInterval( function()
{
$.getJSON( "http://search.twitter.com/search.json?q=%23" + HASHTAG + "&result_type=recent&rpp=5&callback=?", {}, function (data)
{
tweets_per_call = data.results.length;
firstID = -1;
// for each response, create a visual tweet
$.each(data.results, handleTweets);
});
}, UPDATE_INTERVAL );
})();

// handle the data from twitter
function handleTweets( key, data )
{
tweetFound = false;

// see if tweet already exists, if so don't handle it and exit
for( var i = 0; i < tweets.length; i++ )
{
if( tweets[ i ].tweet == data.text )
{
tweets_per_call--;
return;
}
}

// increase tweet counter
count++;

// if its the first tweet in a request, set it to the current counter
if( firstID == -1 )
{
firstID = count;
}

// add tweet to array
tweets.push( { id : count, tweet : data.text } );

// add tweet to page
addTweet( count, data );

// remove the oldest tweet if there are more than
if( tweets.length > MAX_TWEETS )
{
$( '#' + tweets[0].id ).hide( ANIM_SPEED, removeTweet( tweets[0].id ) );
tweets.shift();
}
}

// add tweet to html
function addTweet( id, data )
{
var delayTime = ANIM_SPEED;

// set delay time for each tweet
delayTime = ( id - firstID ) * ANIM_SPEED;

// use jquery to add html to the page
$( '#tweets' ).prepend( "<article id='" + id + "'><table><tr><td><span class='user'>@" + data.from_user + "</span> " + data.text + "</td></tr></table></article>" );

// hide the tweet so it can be animated in
$( '#' + id ).hide( 0 );

// delay the display of the tweet until the ones in front of it have finished
setTimeout(function()
{
$( '#' + id ).slideDown( ANIM_SPEED );
}, delayTime);

}

// remove a tweet
function removeTweet( id )
{
$( '#' + id ).remove();
}

i also added some variables in here to make modifying it a bit easier.

step 5. style it up
now you just need to make it pretty. first you want to style the container. you’ll want to change the height and width of this if you want to make a little widget for your site. also set the overflow to hidden.

then you just need to style the article element to change the background and text colour. you can also edit the user name using the .user class.

note i’ve also added table styling if you need it. you could always use fixed margins instead of tables if you prefer.

the code:

*
{
border: 0px;
padding: 0px;
margin: 0px;
}

html, body, #tweets
{
overflow: hidden;
font-family: Verdana, Arial, sans-serif;
font-size: 17px;
}

#tweets
{
position: absolute;
width: 900px;
left: 50%;
margin-left: -450px;
top: 20px;
color: #FFF;
}

/* each tweet box */
article
{
width: 900px;
height: 80px;
background-color: #222;
border-radius: 0px;
margin-bottom: 40px;
}

table
{
height: 100%;
width: 100%;
}

td
{
vertical-align: middle;
padding: 0px 20px 0px 20px;
}

/* twitter user name */
.user
{
font-weight: bold;
font-size: 20px;
color: #7e9137;
}

and that’s it.
download source here

Posted in css, html 5, jquery, social networks, tutorials | Leave a comment

review deus ex: human revolution

Deus Ex: Human Revolution

yep it’s another deus ex: human revolution review. so to begin with if you are a fan of the series, read on. if you like rpgs, read on. if you are after an action FPS like COD leave now – this game is not for you.

i still rate the original deus ex as my favourite game of all time. it had a brilliant story, interesting gameplay and a world that just sucked you in. so when i first heard of DE:HR i was very sceptical. at first it seemed doomed for failure with all the modern ‘gaming for dummies’ additions like regenerative health, a cover system and important object highlighting. so how did they get so much so right?

to be honest i only pre-ordered the game because i wanted the soundtrack and the artbook supplied with the augmented edition. and these are two areas the game excels. the art style is meticulously created with attention to detail thoughout the game. the game is set in 2027 so the team had to come up with a style that was futuristic but still felt not too far away from today. now i’ve never been to detroit, hengsha (shanghai) or montreal but they managed to create a fairly believable 2027 – alhough i think a bit optomistic with regard to augmentation technology. nonetheless it’s an extremely immersive world, and the sound work plays a large role. the soundtrack, although more than half the number of tracks than the original has a very nice sci-fi theme to it. the epic intro music grabs your hand and forces you to hit the play button and this is where the game begins.

you play an ex swat soldier turned private security contractor for a large biotech corporation. at first you get lead through an on-rails sequence through the labs of sarif industries, where you meet and greet several fellow employees and witness the testing of the ‘typhoon’ system – an augmentation that fires ball bearings in a 360 degree sphere around the user – which you will later be able to install in yourself (which i never did ). the lab is attacked, you are shot in the head and left for dead. you undergo surgery and 6 months later you wake up half human, half machine.

right from the getup, you learn very quickly that your actions will affect the story. you are urgently called up to the penthouse to receive details about your first mission involving a hostage situation. i took too long because i like to poke around and explore everything before i move on. when i got the mission breifing i learnt the hostages had already been killed and the mission objectives changed. there’s a lot more of these situations throughout the game.

there are also plenty of nods to the original such as being given a choice between a lethal and non-leathal weapon for the first mission. the first code you receive is also identical to the first code in deus ex: 0451. DE:HR also contains plenty of newspaper articles, ebooks and emails to read giving some great backstory to the game and adding to the immersion. there’s also quite a few storyline links with the original (including a nice one at the end of the credits).

gameplay is similar to the original, although slightly ‘augmented’. you can go in and gun everyone down, hack your way into networks and make turrets and robots your friends, act all ninja like and crawl through vents and be the pacifist and use non-lethal take downs. in-fact there is so much emphasis on playing nicely that there is even an achievement for playing through the game without killing anyone (unless you have to). this was mostly the approach i took, although sometimes i just couldn’t help but knock off the old villian like a particularily nasty drug dealer i encountered. and this is exactly where the game shines. it makes you think about the consequences of your actions and tries to get you to play in a certain style, only to then lure you into trying a different approach.

ok so to cover a few of the complaints of heard.

  1. regenerative health: yeah it’s not really necessary. the team’s excuse is that having health packs would break the flow of the game and i agree but they could have made it an augmentation like in the original which healed you over time and used up energy. this would have added a bit more strategy to some of the battles.
  2. boss battles: yep these are pretty jarring. they were by far the most challenging parts of the game for me because i basically only had non-lethal weapons and a zooped up pistol just in case. it would have been nice if they weren’t forced on the player and if it was possible to actually beat the bosses with melee attacks.
  3. third person cover system: i actually didn’t mind this too much. although i didn’t use it much either. i preferred to hide in the air vents and pick off enemies one by one. i don’t think it really adds or takes much from the gameplay.
  4. ‘augmented reality highlights’: the game has a feature that places a yellow highlight around objects you can interact with. this was originally going to a permenant feature but the internet cried and it was turned into an option. it was off by default as i chose the hardest difficulty setting to play. i did turn it on for about 10 mins and then turned it off again as i wanted to explore the world myself. but next playthrough i might just put it on. very glad the developers listened to the community and made this optional.
  5. mirrors!: indeed there are no mirrors in the game. there’s some funny stuff on the net on this! 2027 and mirrors are no more…

now for some of my own gripes.

  1. the environments are a little bit too repetative. it seems like you are either in a street or an office for 90% of the game. a bit more variation would have been welcome.
  2. vent placements are a little too common and predictable. some more thought on alternative routes would have been nice, although the wall punching augment is welcomed.
  3. more intersting augmentations. there are a bunch of augmentations that are just useless. there is no point upgrading your radar when the stock one provides sufficient information. these could have been replaced by a lock pick or a hearing enhancer for example.
  4. some melee weapons. the only way to melee attack is to press a key when close to an enemy which initiates a random scripted sequence which seems to freeze everyone around you until you knock out your target. and this costs one energy unit which means you can’t melee attack if you run out of energy. i’d think a man made half out of metal could do some pretty serious damage without using any energy.

issues aside, after completing the game i just want to jump back in and start again. this time i’ll probably play the terminator role and kill everything i see but i’ll have to wait for a new computer first. i played the game on a Dell studio one all-in-one computer which ran it on the lowest settings with a tiny bit of lag, which made the shooting a little tricky, but i still found the game extremely enjoyable.

eidos have done a remarkable effort in providing fan service for the orginal and i’d hope a good experience for new comers although i’m not a very good judge of that! if you are a fan of the original and are still holding out, don’t. go grab it.

rating for deus-ex fan: 96%
rating for non deus-ex fan: 85%

Posted in games, reviews | Leave a comment

jquery and ie9 grrrr

after an hour or so of debugging, i’ve discovered the problem was nothing to do with jquery at all…

ok so i have this site i’m building with jquery and i wanted to update a dropdown box by rewriting some html using funnily enough .html(). i was passing the data through in XML format and in ie 9 and 8 it was failing at the .each() method. just nothing. so i discovered after some searching that the problem was actually how ie parses the XML and this has actually changed with versions of ie. so here’s the solution in one nice little function:


function parseXML( xmlStr )
{
if (window.DOMParser)
{
return ( new window.DOMParser() ).parseFromString(xmlStr, "text/xml");
}
else if (typeof window.ActiveXObject != "undefined" && new window.ActiveXObject("Microsoft.XMLDOM"))
{
var xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.loadXML(xmlStr);
return xmlDoc;
}
else
{
return xmlStr;
}
}

Posted in ie bug, jquery, xml | Leave a comment

Google+ First Impressions

soi manged to grab an invite to Google+ today and thought i’d share my thoughts. now keep in mind, i’m not very friendly with social media. in fact, i’m more likely to call it anti-social media.i’ve only just joined twitter, facebook i dumped looooong ago – just…don’t…get…me…started…on…a…facebook…rant. (however i have developed for it recently so know it quite intimately)

Google+ was pretty easy to get started with. the interface is super clean. the concept of circles is really quite good. you can share things with just a particular group of people instead of everyone you know, and then all their friends etc.

privacy is an obvious concern for Google and this has been handled from the start. it’s everywhere throughout the experience and you can tell they’ve spent considerable time making this area work. this alone will see many shift from Facebook.

speaking of shifting from Facebook, you can move all your contacts via Yahoo however i did read somewhere that Google were working on a way to migrate all your facebook data over to Google+… although that could have just been rumourz on the internets.

you can ‘+1′ things which i guess at this stage is the Google+ version of Facebook likes. I’ve noticed that if you are running the chrome browser, these ‘+1′s will appear in the Google search page next to every search result which is kinda cool.

for Android users, you get a bonus app on the Market, which besides being a mobile version of Google+, it also allows you to instantly upload all photos and videos taken on your phone to a private album you can then share with people and circles. pretty neat. speaking of photos and videos, these are all handles via Picasa so if you already use it, bang – all your media is already available for sharing. no word if an iOS version is on its way. I’d suspect they will release an iOS version when the service gets out of testing.

there’s no app support yet but i’m sure this is on the cards. likewise no advertising at this stage but they would be silly to have ads just when it’s launched.

my favorite feature at this stage is probably the ability to share content with people, even if they aren’t on Google+ or even have a Google account.you can add email addresses into your circles and then share something and it will ask if you’d like to email the people who aren’t on +. what this means is unlike on Facebook where people would organise events and invites could only be sent to Facebook friends, on Google+ you can send it out to all your friends, regardless of what network they use.

so it’s looking pretty good so far. tight control on your privacy, but very easy to access and alter as you need. the interface is waaaaaaay better than Facebook’s cluttered dorm room style. Android app is a bonus. looking forward to what comes next. hoping it doesn’t just get flooded with corporate rubbish and shit games like Facebook has – but that’s probably a year away at least. It can at least be cool for 12 months.

Posted in first impressions, social networks | 1 Comment

the world as a system

Given all the bad news these days with climate change and wars, I decided to present my view of the world from the perspective of a programmer. Programmers brains are generally wired for problem solving and i thought why can’t you apply that to world problems? Well in this short blog post I look at 4 major problems in the world simply as problems that need solutions – and it’s quite surprising how simple it seems.

1. Environmental destruction
Problem: Instead of just looking at climate change as a problem, i’ve decided on the more broad category of environmental destruction. Pollution, urbanisation, deforestation, and commercial agriculture all harm the natural environment. This is the environment that has been around for thousands of years and allowed animal life and humans to evolve to the stage we are now. Without this environment, we are finished. Simple as that.

Solution: Reduce pollution and respect the land. Just think about it. It’s not hard. Do the benefits outweigh the costs to human life? Remember there is only one planet we can live on. If we trash it, we’re finished. I mean if you use up all the memory in a computer program, somewhere along the line, it fails right? Well that will kinda happen to the world as well.

2. Poverty
Problem:
People are starving. They have little or no access to adequate health care. No running water. You’ve heard it all before. Why is this? Well it’s not because they don’t have resources. Africa, China, India, South America, Russia. They all have plenty of resources. The problem is all the resources are all being sold to the wealthy so people like you and me can live nice while the rest of the world’s population suffers.

Solution: Stop consuming crap. Reduce your consumption to necessities only and maybe limit to one luxury item a month or a quarter. If you are going to buy stuff, buy it local even if it costs more. It’s much better in the long run for all concerned.

3. War
Problem:
War is interesting because most people are opposed to it. However, governments still wage it until people have had enough. Well the cause of most wars is not ideological or religious indifference. It’s control of resources.

Solution: Again stop consuming crap. If you use less stuff, then there is more resources for the people we are taking it from.

4. Population
Problem:
We are just about to have our 7th billion person born and we are projected to reach 8 billion people by 2025. We keep growing but the planet doesn’t. It cannot continue.

Solution: Well guess what? If you solve poverty first, then this will cease being a problem. The birth rate in developed countries is a sustainable birth rate meaning that the better educated and more content a population is, the less likely they are to have large families. Eliminate poverty, then you eliminate the population problem.

 

So there you have it. Is this post going to change the world? No, no it won’t. Simple solutions will not be made to fix huge problems. So what’s the difference between a computer system and the world as a system? A computer system is built for optimal efficiency of resources whilst giving the performance required. The current world economy is built to maximise performance (profit) at the expense of efficiency because efficient use of resources would not be as profitable. Have a think about it.

Posted in general, politics, programmer | Leave a comment

those bloody mac zip files…

so this is probably really old news, but my sanity was restored this morning. have you ever received a zip file from someone that has been made on a mac? and has that zip file contained folders and folders and sub-folders and sub-sub folders? maybe you’ve downloaded some source code from a mac developer like i did. well until today i just got angry because on windows xp/vista/7, if you tried to uncompress the zip with the built in windows compression utility, it would fail at the first sub folder thanks to OSX garbage files (yes mac boys, i am aware they probably play some purpose other than pissing off windows users).

simple solution? use an archive program like 7-zip to extract the files and presto, no more crappy mac files! i dunno if winzip or winrar fix this also, let me know if they do work.

Posted in mac anger, zip | Leave a comment

flash vs html5 – my take

so steve jobs has put all his eggs in the html 5 basket and the apple fanboys have raised their hands in unison, hailing the end of flash forever. well i’ve never been one to sit on the fence, so i’ll just say, what a load of rubbish.

before you join in with the apple army, consider this: when was the last time you developed a website and had to take into account how it looked in ie 6? oh that’s right, the last site you worked on. yep, every site i’ve worked on since 2001 when ie 6 was released has had to be tested in ie 6. so how is this relevant to html 5? last time i checked, ie 6 doesn’t support html 5, oh and neither does ie 7, or ie 8 which together (as of feb 2011) have a market share of 56.05%.

so what does html 5 actually mean? well it means more work. if a client wants an html 5 site, and i’m still not sure what html 5 can do that flash cannot, then there will have to be not one backup site, but two. maybe i’m crazy but i foresee flash backup sites being created for html 5 sites, and then html 4 sites being created as another backup. well in reality, a client is going to see a flash site with html backup as cheaper and thus not be bothered with html 5 at all.

so for me it comes down to basic maths, once html 5 works on more devices, taking into account browsers, then html 5 has defeated flash, if that’s the word you like to hear. considering it’s taken 10 years to get the ie 6 share down to even 12.02%, i think it’s a loooooong way off. anyway, isn’t there room for both technologies?

Posted in flash, html 5 | 4 Comments

flash, wmode and the dreaded ie scrolling bug

finally solved!

so if you have a flash movie embedded somewhere like facebook, you want html menus to appear over the flash movie. most people have found the wmode : transparent fix. however, if your flash movie happens to use the arrow keys, this creates a nasty surprise in ie. the flash movie loses focus and so when using the arrow keys, the whole page scrolls making your flash game/movie unusable.

after a lot of web searching i almost resorted to changing the controls, then i came up with this fix. it’s a dirty, dirty hack, but it works and here it is:

1. create a hidden textfield in the document class of your flash with the correct properties like so:

private var _hiddenText:TextField;

// in constructor
_hiddenText = new TextField();
_hiddenText.type = TextFieldType.INPUT;
_hiddenText.width = 1;
_hiddenText.height = 1;
_hiddenText.alpha = 0.0;
_hiddenText.mouseEnabled = false;
addChild( _hiddenText );

2. create an event that responds to a loss of focus:

private function _textFocus( e:FocusEvent ):void
{
// check if anything has focus
if ( stage.focus )
{
// if you have other input fields, don’d update focus
if ( stage.focus.name != “_txtName” && stage.focus.name != “_txtDescription” )
{
// set focus dynamically
stage.focus = _hiddenText;
}
}
else
{
// set focus dynamically
stage.focus = _hiddenText;
}
}

3. set the focus dynamically and add the event listener:

// under addChild( _hiddenText );
_hiddenText.addEventListener( FocusEvent.FOCUS_OUT, _textFocus );
stage.focus = _hiddenText;

that’s it! remember for every input field you have, you should give it a name, and add it to the event listener, or users wont be able to type into them. hope that helps someone out there!

Posted in as3, ie bug | Leave a comment