Thursday, March 26, 2009
Tuesday, March 24, 2009
simple set up of video
// hook up a flv in the same folder
flvMyVideo.source = "myVideo.flv";
// skin need to be in same folder
flvMyVideo.skin = "SkinUnderAll.swf";
//set skin color (rmember to replace # with 0 x
flvMyVideo.skinBackgroundColor = 0xFFFFFF;
//set bg alpha
flvMyVideo.skinBackgroundAlpha = 0.5;
flvMyVideo.autoPlay = false;
flvMyVideo.source = "myVideo.flv";
// skin need to be in same folder
flvMyVideo.skin = "SkinUnderAll.swf";
//set skin color (rmember to replace # with 0 x
flvMyVideo.skinBackgroundColor = 0xFFFFFF;
//set bg alpha
flvMyVideo.skinBackgroundAlpha = 0.5;
flvMyVideo.autoPlay = false;
Monday, March 23, 2009
how to set up a sound
// set up a url request and link it to a sound
var musicURL:URLRequest = new URLRequest("xxx.mp3");
var sndMusic:Sound = new Sound(musicURL);
var channel1:SoundChannel;
// event handlers starts with a function, this one is to check that the sound load correct
function errorMsg(evt:IOErrorEvent):void{
trace("the sound could not be loaded");
}
sndMusic.addEventListener(IOErrorEvent.IO_ERROR, errorMsg);
function soundLoaded(evt:Event):void{
trace("music is loaded");
channel1 = sndMusic.play();
}
sndMusic.addEventListener(Event.COMPLETE, soundLoaded);
var musicURL:URLRequest = new URLRequest("xxx.mp3");
var sndMusic:Sound = new Sound(musicURL);
var channel1:SoundChannel;
// event handlers starts with a function, this one is to check that the sound load correct
function errorMsg(evt:IOErrorEvent):void{
trace("the sound could not be loaded");
}
sndMusic.addEventListener(IOErrorEvent.IO_ERROR, errorMsg);
function soundLoaded(evt:Event):void{
trace("music is loaded");
channel1 = sndMusic.play();
}
sndMusic.addEventListener(Event.COMPLETE, soundLoaded);
simple image site based on arrays
ok code is quite stripped down so some pieces missing. But it's easy to understand how to put it together.
var aPhotos:Array = new Array(mPhoto0,mPhoto1,mPhoto2);
var aThumbs:Array = new Array(mThumb0,mThumb1,mThumb2);
function thumbClick(evt:Event):void {
trace(evt.target.name);
clearPhotos();
var count:Number = aThumbs.length;
var index:Index:
for(var i:Number = 0;i if (evt.target.name == aThumbs[i].name){
index = i;
}
}
aPhotos[index].visible = true;
}
function clearPhotos():Void{
mPhoto0.visible = false;
mPhoto1.visible = false;
mPhoto2.visible = false;
}
for (var i:Number = 0;i aThumbs[i].addEventListener(MouseEvent.ROLL_OVER, btnOver);
aThumbs[i].addEventListener(MouseEvent.ROLL_OUT, btnOut);
aThumbs[i].addEventListener(MouseEvent.CLICK, thumbClick);
aThumbs[i].mouseChildren = false;
}
var aPhotos:Array = new Array(mPhoto0,mPhoto1,mPhoto2);
var aThumbs:Array = new Array(mThumb0,mThumb1,mThumb2);
function thumbClick(evt:Event):void {
trace(evt.target.name);
clearPhotos();
var count:Number = aThumbs.length;
var index:Index:
for(var i:Number = 0;i
index = i;
}
}
aPhotos[index].visible = true;
}
function clearPhotos():Void{
mPhoto0.visible = false;
mPhoto1.visible = false;
mPhoto2.visible = false;
}
for (var i:Number = 0;i
aThumbs[i].addEventListener(MouseEvent.ROLL_OUT, btnOut);
aThumbs[i].addEventListener(MouseEvent.CLICK, thumbClick);
aThumbs[i].mouseChildren = false;
}
Sunday, March 22, 2009
AS3 How to use one function for several buttons
function btnOver(evt:Event):void{
trace(evt.target.name);
evt.target.gotoAndPlay("rollOver");
}
mClip1.addEventListener(MouseEvent.ROLL_OVER,btnOver);
mClip2.addEventListener(MouseEvent.ROLL_OVER,btnOver);
mClip3.addEventListener(MouseEvent.ROLL_OVER,btnOver);
trace(evt.target.name);
evt.target.gotoAndPlay("rollOver");
}
mClip1.addEventListener(MouseEvent.ROLL_OVER,btnOver);
mClip2.addEventListener(MouseEvent.ROLL_OVER,btnOver);
mClip3.addEventListener(MouseEvent.ROLL_OVER,btnOver);
Saturday, March 21, 2009
Making a basic button in AS3
It don't get much more basic than this but it's quite a big difference making a button in AS3 then in AS2.
function clickButton(evt:Event):void{
trace("the mClip button is pressed");
}
mClip.addEventListener(MouseEvent.CLICK,clickButton);
function clickButton(evt:Event):void{
trace("the mClip button is pressed");
}
mClip.addEventListener(MouseEvent.CLICK,clickButton);
Friday, March 6, 2009
Desk crap
No postings sinse forever, I know. In the lack of samething good here is a desk doodle from a meeting today.
Subscribe to:
Posts (Atom)