1046: Type was not found or was not a compile-time constant: URLRequest.
Hello everyone!
I'm having a bit of difficulty with ActionScript 3 and was wondering if anyone could help me.
I'm new to Flash CS5 and AS3 but i've attempted to create a (initially simple) track sampling app which allows the user to click an image to start/stop an mp3, I had the initial script sorted where the button would toggle that starting and stopping of the mp3. I've been trying soooooo hard for weeks but as soon as i've tried to package (to allow future script additions for effects) it it has thrown up the following error:
C:\Users\Alice\Desktop\Prototype\com\app\Application.as, Line 57
1046: Type was not found or was not a compile-time constant: URLRequest.
Here is the code for the package Application.as
package com.app{
import flash.display.SimpleButton;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.events.Event;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.display.Sprite;
import flash.net.URLLoader;
public class Application extends MovieClip {
public var flag:Boolean;
public function Application()
{
bozeat.addEventListener (MouseEvent.CLICK, bozeat_button_Handler);
flag = false;
}
public function bozeat_button_Handler (e:MouseEvent):void {
bozeat_snd.load(new URLRequest("drums.mp3"));
if (flag == false){
bzChannel = bozeat_snd.play(0,int.MAX_VALUE);
flag = true;
trace("true");
} else if(flag == true) {
bzChannel.stop();
flag = false;
trace("false");
}
}
This is the #1046 error keeps it keeps pointing me to:
bozeat_snd.load(new URLRequest("drums.mp3"));
And here is the code for the .fla file
import com.app.Application;
var app:Application = new Application();
I have named the document class to
com.app.Application
My mp3 is
drums.mp3 with an instance name of bozeat_sound
I hope someone understands what i am talking about lol. Sorry for the hassle thanks for any help in advance ![]()
Alice19Eighty8
