HTML5 Click Inside Canvas Workaround

One of the many things I’ve been trying to accomplish with HTML5 is clicking inside or at least make it look like the user is clicking inside the application.

Before I go any further, I would like to give credit to: http://tutorialzine.com/2010/09/html5-canvas-slideshow-jquery/, HTML5 Canvas For Games and Entertainment book, and HTML5 Games Development by Example book. For clarification, I’m not being paid for advertising those books or websites. In all of these resources, they helped in some way to make this example possible. The website and the HTML5 Canvas book showed how to make something with HTML5 with the help of JQuery.

I searched online before using these resources and found out how you could click a object in the HTML5 canvas, but it involved around 40 lines of code. I don’t know about you, but I don’t want to write that much code just to click one object. The resources showed another way of getting objects into or on I should say, the canvas. After many tries, I finally got it to work.

HTML
HTML5 Canvas Click Tutorial Code

CSS
#canvas{
background-color:#CCCCCC;
z-index:100;

}

#button{
position:absolute;
top:100px;
left:50px;
z-index:5000;
}

Javascript

var _gameButton = $(“#button”);
function init(){
$(‘#button’).mouseup(function(){
alert(“Start Game”);

});

}

Click picture to try it for yourself.

HTML5 Canvas Click Tutorial


HTML5 Canvas Simple Game

This experiment is the beginning of a bigger experiment of making a HTML5 game using the HTML5′s canvas tag and Javascript. These days, people want HTML5 stuff, why not make a HTML5 game? That being said, I thought I give it a try and I thought it would be fun to recreate one of the Flash experiments that I did.

I want to give credit to: Matthew Casperson (http://www.brighthub.com/internet/web-development/articles/38744.aspx ). I used this tutorial to get things working and then I went on my own to recreate the experiment I mentioned above.

So far, I have a image that I made show up on the canvas and if you click the blue triangle, the ship moves to the right.

Code Snippets

Javascript Mouse Down Listener
canvas.addEventListener('mousedown', movePlayer, false);

Add Image to Canvas
var player = new Image();
player.src = "images/player.png";

window.onload = init;

function init(){
canvas = document.getElementById('canvas');
context2D = canvas.getContext('2d');
setInterval(draw, 1000 / FPS);

}

function draw(){
context2D.clearRect(0, 0, canvas.width, canvas.height);
context2D.drawImage(_player, x, y);
}

Click the image below to test it.


HTML5 Animation Using Edge

This experiment was to test out Edge. Edge is a software that allows developer and designers to make HTML5 animations easily without having to code. I know, how can that be fun without code? Anyways, the software was released in beta a few months ago by Adobe. You can download it from Adobe’s labs. The software looks a lot like After Effects. The timeline is the same and the way you add: effects, rotations, and color are all the same as After Effects.

Click the picture and you can see it live.

HTML5 Animation using Edge


Developing your own custom Zen Cart theme

Throughout the past few weeks, off and on, I’ve been doing an experimental/side project developing a custom theme for the popular e-commerce script, Zen Cart. The reason I chose Zen Cart over the others is, basing from what I’ve heard from local Web Design and internet interactive marketing agency’s is that they use Zen Cart for their e-commerce sites. I’ve heard There are other good ones out there such as OsCommerce.

Customizing your own theme for Zen Cart is not the easiest task. In order to fully customize everything, you have to go into the template files and some of the base script files in order to customize everything. If you’ve downloaded Zen Cart before, you’ll know that there is quite a bit of files and can get overwhelming. Below are some tips to help ease any frustration developers may have when customizing your own theme.

Tips
Use the Developers Tool Kit in the admin section. Using this tool, will allow you to search through the files for a specific function or keyword that you are looking for.

To remove the “Powered by Zen Cart” in the footer, go to this file:
wamp/www/templateName/includes/languages/english.php

CSS is the key.

What I’ve Done So Far
I should’ve made a screenshot of a before.

Here is what I’ve done so far. I’ve customized: the search bar, search button, moved log in to the right, removed default template text & images, added categories, added one product, changed the the footer, added spacing, changed with width, and made it centered.

rt Custom Theme


Develop Flash Player 11 and Air 3 Applications (Desktop and Android)

If you haven’t heard already, Flash Player 11 and Air 3 were announced and released at Adobe Max earlier this week. Since it’s out to download, why not take advantage of staying updated and start making cool applications with these new API’s.

Download these files
- You need the AIR SDK

http://blogs.adobe.com/flashruntimereleases/2011/10/04/flash-player-11-and-air-3-now-available/

- You need the PlayerGlobal (.swc)

http://www.adobe.com/support/flashplayer/downloads.html#fp11


Follow

Get every new post delivered to your Inbox.