Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 3.0 (http://www.flasher.ru/forum/forumdisplay.php?f=83)
-   -   Вылетает ошибка SecurityError: Error #2000 (http://www.flasher.ru/forum/showthread.php?t=156179)

Universe 17.05.2011 20:38

Вылетает ошибка SecurityError: Error #2000
 
Привет! При загрузке картинок с сайта Facebook, вылетает ошибка
Код:

SecurityError: Error #2000: Отсутствует активный контекст безопасности.
изза чего это может быть и как это устранить?:)
Вот код которым я гружу картинки

Код AS3:

package com.main
{
        import flash.display.*;
        import flash.events.*;
        import flash.utils.*;
        import flash.net.*;
        import flash.text.*;
        import flash.system.*;
 
        public class FriendPhoto extends MovieClip
        {
                private var userPath:String = "";
                private var imgLoader:Loader;
                private var context:LoaderContext;
 
                public function FriendPhoto(userPath:String)
                {
                        trace("FRIEND ADDED");
                        this.userPath = userPath;
                        if (stage) init();
                        else addEventListener(Event.ADDED_TO_STAGE, init);
                }
 
                private function init(e:Event = null):void
                {
                        trace("UserPhoto Created " + userPath);
                        result_txt.text = userPath;
                        loadFriendPicture();
                }
 
                function loadFriendPicture():void
                {
                        var loader:Loader = new Loader();
                        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onPictureLoaded, false, 0, true);       
 
                        var request:URLRequest = new URLRequest("facebookProxy.php");
                        var variables:URLVariables = new URLVariables();
                        variables.path = userPath;
                        request.data = variables;
 
                        loader.load(request);
                }
 
                function onPictureLoaded(e:Event):void
                {
                        var loader:Loader=e.target.loader;
                        loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onPictureLoaded);
                        //loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onMyPictureLoadError);               
                        var bitmap = Bitmap(loader.content);
 
                        var bitmapRatio:Number = bitmap.width/bitmap.height;
                        var maskRatio:Number = mask_mc.width/mask_mc.height;
 
                        if (stageRatio >= imageRatio)
                        {
                        // match image width and adjust height to fit
                        bitmap.width = maskRatio.width;
                        bitmap.height = maskRatio.width/bitmapRatio;
                        } else
                        {
                                // match image height and adjust width to fit
                                bitmap.height = mask_mc.height;
                                bitmap.width = mask_mc.height*bitmapRatio;
                        }
                        bitmap.smoothing=true;
 
                        //Note: picturePlaceholder is just a blank movie clip on the Stage
                        bitmap.mask = mask_mc;
                        bitmap.x = mask_mc.x;
                        bitmap.y = mask_mc.y;
 
                        addChild(bitmap);
                        //result_txt.text = userPath + "LOADED";
                        trace("Some actions with the image!");
                        preloader.visible = false;
                }       
        }
}

Вот содержимое файла facebookProxy.php
Код:

<?php
    $path=$_GET['path'];
    if (stristr($path, "fbcdn.")==FALSE && stristr($path, "facebook.")==FALSE)
    {
        echo "ERROR";
        exit;
    }
    header("Content-Description: Facebook Proxied File");
    header("Content-Type: image");
    header("Content-Disposition: attachment; filename=".$path);
    @readfile($path);
?>


dimarik 17.05.2011 21:45

Уточните, это RTE или в консоль сыпется?

i.o. 17.05.2011 21:55

Цитата:

SecurityError
Наверное RTE

Bgg 17.05.2011 21:57

А если разкомментировать отлов ошибки ввода-вывода?
Код AS3:

//loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onMyPictureLoadError);


dimarik 17.05.2011 22:02

@Bgg, аха. Из интернетов.
Цитата:

I had the same Security Error and i fix it adding a IOErrorEvent.IO_ERROR to the Loaders. Hope this help anyone.
Цитата:

I solved my problem by adding a listener to the IOErrorEvent.IO_ERROR event. No more SecurityError #2000 for me
Я такую штуку ловил... на живца. Только при пошаговой отладке проявлялась.

Universe 17.05.2011 23:46

т.е. просто добавить лисенер на IO_ERROR и создать пустую функцию для него?

Bgg 17.05.2011 23:47

Можно не пустую, вдруг когда поймаете чего там.

Universe 18.05.2011 17:53

))))
кстати происходит какойто странный глюк, функция onPictureLoaded выполняется чего то не один, а два раза! Не могу понять почему

gloomyBrain 18.05.2011 18:21

Цитата:

Отсутствует активный контекст безопасности.
Это тупо IOError в плеерах 10.2 и выше

Universe 18.05.2011 18:58

а почему он тупо срабатывает?))


Часовой пояс GMT +4, время: 06:10.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.