Friday, February 29, 2008

Internet Explorer 7 bug

You can not do this in Internet Explorer. For it to work, you must remove the div tags!

<div><script>document.body.appendChild(document.createElement('script'))</script></div>

May you be able to in IE8

Thursday, February 21, 2008

get the text

this code will alert the selected text

if (window.getSelection) {
var str = window.getSelection();
}
else if (document.getSelection) {
var str = document.getSelection();
} else if (document.selection && document.selection.createRange) {
var range = document.selection.createRange();
var str = range.text;
} else {
var str = "Sorry, this is not possible with your browser.";
}
alert(str);

part of this code is from
this site

I added some code to make it work for safari

Monday, February 18, 2008

Add Feedback to you website

FeedBack


This is a test to see if it works on a blog

Saturday, February 16, 2008

Adding Scripts to others' web pages: a few thoughts

There could be problems doing things like document.body.appendChild when there DOM hasn't loaded yet.
Therefore you need to do things to watchout for that

< body onload = "customfunction()" >

or put script tags right before body

or window.onload =

or window.attachevent("onload",customfunction)
window.addeventlistener("load",customfunction,false) //or true I dont know

What about large images etc. that you dont want to wait for

another thing to research is the defer attribute of the script tag

another thing to research is the DOMContentLoaded

http://developer.mozilla.org/en/docs/Gecko-Specific_DOM_Events
"Fired on a Window object when a document's DOM content is finished loaded, but unlike "load", does not wait till all images are loaded. Used for example by GreaseMonkey to sneak in to alter pages before they are displayed. "

what about document.write

http://www.hedgerwow.com/360/dhtml/ie-dom-ondocumentready.html

unobtrusive javaScript

Friday, February 15, 2008

Feedback Flex Exapmle

Click the background to minimize or maximize

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/

Java Applet Example

Flash / Actionscript example

Use arrow keys to move the orange ball

Sunday, February 10, 2008

Automaton


This is kinda cool
http://www.fi.edu/learn/automaton/index.html

Snowflake Bentley

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(){}
}

Star Wars Movie

Video Entertainment


Thursday, February 7, 2008

Making videos

I have a really cool camera from Canon. It is a camera for pictures but it also records videos. It is a Canon PowerShot SD750 7.1 Megapixels

I love it. I bought a 4 Gig SD card for it and the SD card fits right into my laptop to upload my videos.

Making small movies is great on it because you don't have to mess with the MINI DV tapes, and the quality of video is pretty good!

Apple's iMovie is great for doing video.

It has drawbacks but Windows Movie Maker is allright for simple stuff.

Tuesday, February 5, 2008

Publishing Factor

You think your done, until your printer doesn't work and your other computer doesn't have openoffice.

You think your done until you can't find your firewire cord.