Month: October 2005

  • Flex 2.0 alpha licensing?

    I`m too lazy to look it up – and if i would do so i would not get a word 😉
    Does anyone know if we are allowed to post sample swf generated by Flex 2.0?
    It`s such a pitty that it`s half a year to go since the web will see the future!
    By the way any good arguments i can tell my company (very design orientated) to switch to flex development?

  • Sound spectrum code

    Here is some code for playing with the sound spectrum/peak in flash player 8.5.
    package {

    import flash.display.MovieClip;
    import flash.util.trace;
    import flash.media.Sound;
    import flash.media.SoundChannel;
    import flash.net.URLRequest;
    import flash.events.*;
    import flash.util.ByteArray;
    import flash.util.SetIntervalTimer;
    import flash.display.Sprite;
    import mx.controls.Button;

    public class AsOnly extends MovieClip {

    private var mySound:Sound;
    private var myChannel:SoundChannel;
    private var mySprite:Sprite;
    private var mySprite2:Sprite;
    private var equalizer:Sprite;
    private var spectrum:ByteArray;
    private var myButton:Button;

    public function AsOnly() {
    var request:URLRequest=new URLRequest("mySound.mp3");
    spectrum=new ByteArray();
    mySound=new Sound();
    mySound.addEventListener(EventType.COMPLETE,completeListener);
    mySound.addEventListener(IOErrorEventType.IO_ERROR,ioErrorListener);

    var id:uint=flash.util.setInterval(progressListener,100);
    mySound.load(request);
    myChannel=mySound.play();

    mySprite=new Sprite();
    mySprite.graphics.beginFill(0x666666);
    mySprite.graphics.drawRect(0,0,200,20);
    mySprite.graphics.endFill();
    addChild(mySprite);

    mySprite2=new Sprite();
    mySprite2.graphics.beginFill(0x666666);
    mySprite2.graphics.drawRect(0,30,200,20);
    mySprite2.graphics.endFill();
    addChild(mySprite2);

    equalizer=new Sprite();
    addChild(equalizer);

    myButton=new Button();
    myButton.label="hallo";
    myButton.x=100;
    myButton.y=50;
    addChild(myButton);

    }

    private function completeListener(event:Event){
    trace("event: "+event.type);
    }

    private function ioErrorListener(event:Event){
    trace("error: "+event.type);
    }

    private function progressListener(){
    //trace("left Peak: "+myChannel.leftPeak+" rightPeak: "+myChannel.rightPeak);
    mySprite.scaleX=myChannel.leftPeak;
    mySprite2.scaleX=myChannel.rightPeak;
    flash.media.Sound.computeSpectrum(spectrum,false,2);
    equalizer.graphics.clear();
    equalizer.graphics.beginFill(0x666666);
    equalizer.graphics.moveTo(0,200);
    for(var i:uint=0;i
    So far i really love flex 2.0 / fp 8.5. If flash 8 was the greatest release ever for MM what is this?
    Microsoft may have something coming with Sparkle but Flex is allready here!