Compiler Error 1046

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;

This Post Has One Comment

Leave a Reply