Показать сообщение отдельно
Старый 17.10.2008, 13:37
Alex Lexcuk вне форума Посмотреть профиль Отправить личное сообщение для Alex Lexcuk Посетить домашнюю страницу Alex Lexcuk Найти все сообщения от Alex Lexcuk
  № 2  
Ответить с цитированием
Alex Lexcuk

блогер
Регистрация: Mar 2008
Адрес: Донецк_city
Сообщений: 1,094
Записей в блоге: 5
Так надо его URLLoader классом, там есть
ioErrorHandler
Код:
//куски документ класса
...
 my_url_img = "imag.jpg";
		sprite_creator();		
	}

	function menuItemSelectHandler(event:ContextMenuEvent):void {
		tool.x = mouseX;
		tool.y = mouseY+20;
	}

	//загрузочная функция
	function sprite_creator() {
		container = new Sprite();
		//addChild(container);
		loader = new URLLoader();///////////////////////////////////////////////////
		var pictURL:String = my_url_img;
		configureListeners(loader);
		var pictURLReq:URLRequest = new URLRequest(pictURL);
            try {
                loader.load(pictURLReq);
            } catch (error:Error) {
                trace("Unable to load requested document.");
            }

	}

	private function configureListeners(dispatcher:IEventDispatcher):void {
            dispatcher.addEventListener(Event.COMPLETE, completeHandler);
            dispatcher.addEventListener(Event.OPEN, openHandler);
            dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
            dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
            dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
            dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
        }

	private function completeHandler(event:Event):void {
            var loader:URLLoader = URLLoader(event.target);
            trace("completeHandler: " + loader.data);
            var pictLdr:Loader = new Loader();
		    var pictURL:String = my_url_img;
		    var pictURLReq:URLRequest = new URLRequest(pictURL);
		    pictLdr.load(pictURLReq);
		    pictLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoaded);
		       function imgLoaded(event:Event):void {
			     container.addChild(pictLdr.content);
				 work_mc.addChild(container);
		        }
//            var vars:URLVariables = new URLVariables(loader.data);
//            trace("The answer is " + vars.answer);
//			container.addChild(loader.content);
		
        }

        private function openHandler(event:Event):void {
            trace("openHandler: " + event);
        }

        private function progressHandler(event:ProgressEvent):void {
            trace("progressHandler loaded:" + event.bytesLoaded + " total: " + event.bytesTotal);
        }

        private function securityErrorHandler(event:SecurityErrorEvent):void {
            trace("securityErrorHandler: " + event);
        }

        private function httpStatusHandler(event:HTTPStatusEvent):void {
            trace("httpStatusHandler: " + event);
        }

        private function ioErrorHandler(event:IOErrorEvent):void {
            trace("ioErrorHandler: " + event);
        }

	//конец  загрузочная функция
выдает такое
Код:
httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=0]
ioErrorHandler: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: file:///D|/flash/AC3/Графика%20длинная%20линия/imag.jpg"]