PDA

View Full Version : How can I resolve compiler error:1046?


jenniferma
11-27-2008, 04:38 PM
I have the following actionscript when I test run it, I keep getting the following compiler error for Line 15 which is protected var ulXML:URLLoader;
1046: Type was not found or was not a compile-time constant: URLLoader.
What have I done wrong here? How should I correct it?

package {
import flash.display.Loader;
import flash.net.URLRequest;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.display.Sprite;
import flash.utils.*;
import flash.events.*;

public class RandomDisplay extends Sprite {

protected var myTimer:Timer;
protected var imageLoader:Loader;
protected var urXML:URLRequest;
protected var ulXML:URLLoader;
protected var imageList:XMLList;

public function RandomDisplay() {

// Create a new Timer object with a delay of 500 ms
myTimer = new Timer(1000);
myTimer.addEventListener("timer", timedFunction);
//readInXML();

// Start the timer
myTimer.start();

}

// Function will be called every 500 milliseconds
protected function timedFunction(eventArgs:TimerEvent) {
trace("Timer fired " + myTimer.currentCount + " times.");
//loadImage();
}
}
}

Mazoonist
11-27-2008, 04:53 PM
You need to include this line in your list of imports:
import flash.net.URLLoader;

rudrapradeepta.k
11-27-2008, 04:53 PM
u missed importing URLLoader;

add import flash.net.URLLoader;

regards,
Rudra,
Rudrapradeepta.k@gmail.com

jenniferma
11-28-2008, 11:22 AM
Oh that's right, thanks!