Showing posts with label Flash. Show all posts
Showing posts with label Flash. Show all posts

Monday, February 11, 2008

Percentage of Flash / Java users

http://www.adobe.com/products/player_census/flashplayer/

Flash Ball example slow in some cases

The ball example that I did is slow in IE7 on my windows vista.
When I open the swf in the browser on IE and on Safari it is also slow.
In Firefox,opera,safari it is fast when embedded in a page.
When I open the swf in the browser on firefox 2, it starts fast and then goes slow.
In opera when It is embedded in a page it is fast, and when I open it in a browser it is also fast!

Actionscript and flex language reference online

What's the difference between this http://livedocs.adobe.com/flex/201/langref/index.html and this http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/

Flash / Actionscript example

Use arrow keys to move the orange ball

Sunday, February 10, 2008

Actionscript 3.0 Timer and key events

package
{

import flash.display.Sprite;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.text.TextField;
import flash.utils.Timer;
import flash.events.TimerEvent;

public class BM2 extends Sprite
{

public var txtbox:TextField;

public var kDown:JS;
public var kUp:JS;
public var xx:int;
public var yy:int;
public var rep:Timer;
public var ymov:int;
public var xmov:int;
public function BM2()
{
kDown = new JS();
kUp = new JS();
txtbox = new TextField();
txtbox.text = "Hello World";


addChild(txtbox);


stage.addEventListener(KeyboardEvent.KEY_DOWN,keydownhandler);
stage.addEventListener(KeyboardEvent.KEY_UP,keyuphandler);
kDown[37] = function():void{xmov = -1;};
kDown[38] = function():void{ymov = -1;};
kDown[39] = function():void{xmov = 1;};
kDown[40] = function():void{ymov = 1;};
kUp[37] = function():void{xmov = 0;};
kUp[38] = function():void{ymov = 0;};
kUp[39] = function():void{xmov = 0;};
kUp[40] = function():void{ymov = 0;};

rep = new Timer(1,0);
rep.addEventListener(TimerEvent.TIMER, draw);
rep.start();


}
public function test(event:TimerEvent):void{txtbox.text = event.toString();}
public function draw(event:TimerEvent):void
{
xx = xx + 1 * xmov;
yy = yy + 1 * ymov;
graphics.clear();
graphics.lineStyle(1);
graphics.beginFill(0xFF8000);
graphics.drawCircle(xx, yy, 10);

}

public function keydownhandler(evento:KeyboardEvent):void
{
txtbox.text = evento.keyCode.toString() + " " + kDown[evento.keyCode];
if (evento.keyCode >= 37 && evento.keyCode <= 40) kDown[evento.keyCode]();

}
public function keyuphandler(evento:KeyboardEvent):void
{
txtbox.text = evento.keyCode.toString() + " " + kUp[evento.keyCode];
if (evento.keyCode >= 37 && evento.keyCode <= 40) kUp[evento.keyCode]();

}



}


} //end package


import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Point;
import flash.geom.Rectangle;




//this is how i am rescuing the coolness of javascripts objects!!
dynamic class JS
{
public function JS(){}
}

Sunday, January 27, 2008

flash games vs. Java Games

Flash games look cooler.
Which is faster?

Sunday, January 20, 2008

Sockets?

Can I, over the internet, and/or by using ethernet cables directly, connect two computers to play an online game? (or so something that would need the responsiveness like an online game would)
can I do that with flash using sockets... or with java. How would I set up a server that did that?!

Saturday, January 19, 2008

Friday, January 18, 2008

Flex

helpful link

another

Comet and Sockets

I was on ajaxian.com and I thought this was interesting

Why Comet? Why not JavaScript Sockets? You know, sockets, like what “real” applications use… True bidirectional communications.

I’m using Sockets all the time for my web applications using Flash. It works great.

There are more here

Thursday, January 3, 2008

Flash Flex Actionscript SWF mxmlc compiler

I thought it was cool that you can compile .as files into SWF format without purchasing swf software. Thats cool!
I downloaded the Flex 2 SDK (you can download it here http://www.adobe.com/products/flex/downloads/)
I opened the readme and tried to understand it a little. Unfortunately it wasn't simple enough for me to understand, so I kind of gave up for a while.
However, using Google I found this site Beginners Guide to Getting Started with AS3 (Without Learning Flex).
Wow! that person explained it so well. He gives exapmles of .as files and how to compile them.
The simplest way that he says it is to drag your .as file over the mxmlc.exe file.
If there are errors in your actionscript code, you wont be able to see them

Quoting from his site, here is a simple example of an Actionscript file (.as)

package {
import flash.display.Sprite;
import flash.text.TextField;

public class HelloWorld extends Sprite {

public function HelloWorld() {
var display_txt:TextField = new TextField();
display_txt.text = "Hello World!";
addChild(display_txt);
}
}
}