Archive

Archive for the ‘Web Programming’ Category

TweenLite – GreenSock V12

There is a new and updated version of the class plugin TweenLite from GreenSock. But it doesn’t stop there. The new TweenLite version 12 is now available for JAVASCRIPT. This is amazing. Now we can program straight from Jquery or Javascript. Flash is dragging behind more and more it seems. I can’t wait to start playing around with this new plugin.

Here is the link to the site so that you can play around with it yourself.

http://www.greensock.com/v12/

 

Categories: Web Programming

Writing simple code in AS3

I have been learning AS3 at my work and it is starting to grow on me. I started to enjoy it once I learned OOP (Object Oriented Processing). The simple idea to give each object its own mind and it can interact with any other object is fantastic.

We use Eclipse FDT for all of our class writing. It is a useful and powerful actionscript class-writing software. You can download a free version here (there are limitations with the free version, but its not so bad). http://fdt.powerflasher.com/

So in this post I will be showing simple as3 codes that I have been learning.  A extremely good idea for anyone is to have a digital notebook. It helps the learning process go so much faster and you also have many more options at your disposal.

Here are a few most important things in my notebook:

//Date and Time in AS3,

//You can make a expiration date or change the style of a site with the date of the week. It is always up to you.


addEventListener(Event.ENTER_FRAME, eFrame);

//We add these arrays because the online clock only gives us the number of the day or month.   //Example: 0 = Sunday. The code would spit out 0 and we replace it with the array string.

var days:Array = [“Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”];

var months:Array = [“January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December”];

function eFrame(evt:Event):void{
var current:Date = new Date();

var sec:int = current.getSeconds();
var min:int = current.getMinutes();
var hours:int = current.getHours();

//This code makes sure the numbers always look normal. Example: 12:20 not 12:2

if(sec < 10){
var s:String = “0” + sec;
}else{
s = “” + sec;
}

if(min < 10){
var m:String = “0” + min;
}else{
m = “” + min;
}

if(hours < 10){
var h:String = “0” + hours;
}else{
h = “” + hours;
}

txt2.text = “The current time is ” + h + “:” + m + “:” + s;

txt.text = “Today is ” + days[current.getUTCDay()] + ” the ” + current.getDate() + “th of ” +
months[current.month];

}

//Creating a Timer in AS3

var timer:Timer;

//1000 is the number count in milliseconds
timer = new Timer(1000, 0);
timer.addEventListener(TimerEvent.TIMER, onTime);
timer.start();

private function onTime(e:TimerEvent) : void {
trace(“Timer is at ” + timer.currentCount);
}

//Dispatching Events in AS3

//These are very important when working with multiple classes. It is this simple.

//send directly to the MovieClip that you want to catch the event. I used (parent as MovieClip).
(parent as MovieClip).dispatchEvent(new Event("fadeOthers"));

//the catcher is a simple one
addEventListener(“fadeOthers”, newFunction);

private var newFunction(e:Event):void{
trace(“caught”);
}

That is all for today. I will be continuing on to part 2 tomorrow. Thanks for reading. 

Scott.

Web-Design content coming soon!

It has been a while sense I posted anything on my blog.

It seems the more I look for better ways of learning the more I realize I should have stuck with things that I already learned in my studies.

So here I am again and I will be expressing my progress in Web Programming. I am working with ActionScript 3 right now and that is what I will be talking about.

Therefore, please stay tune for the upcoming code and techniques that i have been learning at my job at Maxomedia.

I leave you with a quote from Socrates:

The unexamined life is not worth living.

Socratesin Plato, Dialogues, Apology
Greek philosopher in Athens (469 BC – 399 BC)