Comunidad de diseño web y desarrollo en internet online

error: 1037 packages cannot be nested

Citar            
MensajeEscrito el 29 Nov 2008 08:22 pm
Intento seguir el ejemplo de flash para hacer un espectro de sonido y me da el siguiente error: 1037 packages cannot be nested. No se a que se refiere, alguna sugerencia..¿?¿?¿¿?¿
gracias

El codigo es este:

package {
import flash.display.Sprite;
import flash.display.Graphics;
import flash.events.Event;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundMixer;
import flash.net.URLRequest;
import flash.utils.ByteArray;
import flash.text.TextField;

public class SoundMixer_computeSpectrumExample extends Sprite {

public function SoundMixer_computeSpectrumExample() {
var snd:Sound = new Sound();
var req:URLRequest = new URLRequest("Song1.mp3");
snd.load(req);

var channel:SoundChannel;
channel = snd.play();
addEventListener(Event.ENTER_FRAME, onEnterFrame);
channel.addEventListener(Event.SOUND_COMPLETE, onPlaybackComplete);
}

private function onEnterFrame(event:Event):void {
var bytes:ByteArray = new ByteArray();
const PLOT_HEIGHT:int = 200;
const CHANNEL_LENGTH:int = 256;

SoundMixer.computeSpectrum(bytes, false, 0);

var g:Graphics = this.graphics;

g.clear();

g.lineStyle(0, 0x6600CC);
g.beginFill(0x6600CC);
g.moveTo(0, PLOT_HEIGHT);

var n:Number = 0;

for (var i:int = 0; i < CHANNEL_LENGTH; i++) {
n = (bytes.readFloat() * PLOT_HEIGHT);
g.lineTo(i * 2, PLOT_HEIGHT - n);
}

g.lineTo(CHANNEL_LENGTH * 2, PLOT_HEIGHT);
g.endFill();

g.lineStyle(0, 0xCC0066);
g.beginFill(0xCC0066, 0.5);
g.moveTo(CHANNEL_LENGTH * 2, PLOT_HEIGHT);

for (i = CHANNEL_LENGTH; i > 0; i--) {
n = (bytes.readFloat() * PLOT_HEIGHT);
g.lineTo(i * 2, PLOT_HEIGHT - n);
}

g.lineTo(0, PLOT_HEIGHT);
g.endFill();
}

private function onPlaybackComplete(event:Event):void {
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
}
}
}

Por otoremoto

3 de clabLevel



 

firefox
Citar            
MensajeEscrito el 01 Ene 2009 10:18 pm
Nested significa anidado, ya vi este error cuando agarraba un ejemplo del help e ignorantemente lo soltaba dentro de un fla y tentaba ejecutarlo.
Ese código tenés que salvarlo con el mismo nombre de la clase principal con la extensión .as y después llamarlo desde el fla.

Claudio

Por Ishkandar

Claber

303 de clabLevel



Genero:Masculino  

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.