mardi 14 juin 2016

I'm trying to add the artist image at the background of an mp3 player in flash cs6, using actionscript3

Currently i am using this code. I am getting the image, but not in the background. Can someone please help me with this and also tell me how i can change the size of the image.

import flash.events.MouseEvent;
import flash.media.Sound;
import flash.net.URLRequest;
import flash.media.SoundChannel;
import flash.media.SoundTransform; 

var binaryData:ByteArray;
var file:URLLoader = new URLLoader(new URLRequest("Stay With Me.mp3"));
var finalData:ByteArray = new ByteArray;
var byteCon:Loader = new Loader;
var offset:int; 
var rLength:int;
var found:Boolean = false;
var end:Boolean = false;
file.dataFormat = URLLoaderDataFormat.BINARY;
file.addEventListener(Event.COMPLETE, handleComplete);

function handleComplete(e:Event):void
{
    binaryData = file.data as ByteArray;
    binaryData.position = 0;

    while(!found){
        var pos:int = binaryData.readUnsignedInt();
        if(pos == 0x41504943){
            offset = binaryData.position + 20;
        }
        if(pos == 0){
            if (!found){
                rLength = binaryData.position - 1 - offset;
                if(rLength > 5000){
                    found = true;
                }
            }    
        }
        binaryData.position = binaryData.position - 3;
    }
    finalData.writeBytes(binaryData, offset, rLength);
    finalData.position = 0;
    byteCon.loadBytes(finalData);
    addChild(byteCon);

}

Aucun commentaire:

Enregistrer un commentaire