Hello,
I’m new to AS3 and I’m having a problem with an extended class that uses a URLRequest.
I have a basic class called ‘imageLoader’ that I use for loading in external images
package com.images
{
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class imageLoader
{
// ------- Constructor -------
public function imageLoader(path:String)
{
_loaded = false;
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
_loader.load(new URLRequest(path));
}
// ------- Properties -------
public var _loaded:Boolean;
public var _loader:Loader;
// ------- Methods -------
public function imageLoaded(myEvent:Event):void
{
_loaded = true;
}
public function hasImageLoaded():Boolean
{
return _loaded;
}
public function destroy():void
{
_loader.unload();
}
}
}
This class is working fine, however I wanted to create a new class extending this one that would eventually store more variables and functions.
package com.icon
{
import flash.display.*;
import flash.events.*;
import flash.net.*;
import com.images.imageLoader;
public class iconImage extends imageLoader
{
// ------- Constructor -------
public function iconImage(path:String)
{
_loaded = false;
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
_loader.load(new URLRequest(path));
}
}
}
Now in my actual flash file when I try to use the new extended class with something like the following;
var drawIcon:iconImage = new iconImage("test.png");
I get the following error;
Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
But using the original class works fine without an error;
var drawIcon:imageLoader = new imageLoader("test.png");
Does anyone have any ideas?