1046: Type was not found or was not a compile-time constant: URLRequest;

The Situation

I was writing a class that required a link to an external website. So I created a new URLRequest instance and published the swf.

WTF!?

The error was cause because I forgot to import the class package containing URLRequest.

The Fix

By adding the import statement I was able to get back to work.I f you’re using Flex, Flash Builder or Flash CS5 the class packages should get imported automatically for you when you create a new instance but that doesn’t always happen so just be aware of this error

import flash.net.URLRequest;

Comments

One response to “Compiler Error 1046”

  1. […] error is commonly seen with Error 1046 when you forget to import a class […]

Leave a Reply

Your email address will not be published. Required fields are marked *