Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   Серверные технологии и Flash (http://www.flasher.ru/forum/forumdisplay.php?f=62)
-   -   Кодировка (http://www.flasher.ru/forum/showthread.php?t=126242)

Ossikuro 15.06.2009 07:16

Кодировка
 
Здравствуйте, не уверена что в ту ветку пишу. Делаю диплом и флэш презентацию во флэше. Есть динамический текст, который подгружается из документа XML. При просмотре swf латиница и цифры отображаются нормально - русский текст - сплошные квадраты и иероглифы. Пробовала менять кодировку - не помогло.
PHP код:

<?xml version="1.0" encoding="KOI-8"?>
<photos>
    <photo filename="bees.jpg" thumbnail="s_bees.jpg" description="BAR 123456 
Команда основана в 1999" />
</photos>

кусок XML

Код AS1/AS2:

var photo_filename:Array = new Array();
var photo_thumbnail:Array = new Array();
var photo_description:Array = new Array();
var gallery_file:Array = new Array("flashmo_060_gallery01");
var folder:String = "photos/";
var total:Number;
var g:Number = 0;
var i:Number = 0;
var j:Number = 0;
var k:Number = 0;
var p:Number = 0;
var border_size:Number = 2.2;
var scrolling_speed:Number = 0.15; // 0.00 to 1.00
var cv:Number = 0;
var cv_old:Number = 0;
var onDrag:Boolean;
var xml:XML = new XML();
 
sub_button._visible = false;
tn_area._visible = false;
stop();
 
for( i = 0; i < no_of_gallery; i++ )
{
        sub_button.duplicateMovieClip("sub_button" + i, i);
        this["sub_button" + i]._x = sub_button._x;
        this["sub_button" + i]._y = sub_button._y + (sub_button._height+5) * i;
        this["sub_button" + i].label_txt = gallery_name[i];
        this["sub_button" + i].no = i;
}
function changeGallery(no)
{
        for( i = 0; i < no_of_gallery; i++ )
        {
                this["sub_button" + i].button_mc._visible = true;
                this["sub_button" + i].graphic_bg1._visible = true;
                this["sub_button" + i].graphic_bg2._visible = false;
        }
        this["sub_button" + no].button_mc._visible = false;
        this["sub_button" + no].graphic_bg1._visible = false;
        this["sub_button" + no].graphic_bg2._visible = true;
 
        xml.load( gallery_file[no] + ".xml");
        xml.ignoreWhite = true;
}
changeGallery(0);       
xml.onLoad = function()
{
        for( i = 0; i < total; i++ )
                removeMovieClip(tn_group["tn"+i]);
 
        tn_group.tn._visible = false;
        var nodes = this.firstChild.childNodes;
        total = nodes.length;
 
        for( i = 0; i < total; i++)
        {
                photo_filename[i] = nodes[i].attributes.filename;
                photo_thumbnail[i] = nodes[i].attributes.thumbnail;
                photo_description[i] = nodes[i].attributes.description;
        }
        j = k = p = 0;
        g++;
        create_tn();
        scroller();
        play();
}
function create_tn():Void
{
        for( i = 0; i < total; i++)
        {
                var t = tn_group.tn.duplicateMovieClip("tn"+i, i);
                t.pic.loadMovie( folder +  photo_thumbnail[i] );
                t.tn_no = i;
 
                t._x = j * 90;
                t._y = k * 90;
                j++;
                if( i % 2 == 1 ) {        j = 0; k++;        }
 
                t.onEnterFrame = function()
                {
                        var bytes_loaded:Number = this.pic.getBytesLoaded();
                        var bytes_total:Number = this.pic.getBytesTotal();
                        var percent:Number = 0;
 
                        this.bd._width = this.bd._height = 50;
                        this.bd._alpha = 20;
                        this.bd._x = this.bd._y = 15;
 
                        percent = Math.round( bytes_loaded / bytes_total * 100 );
                        if( percent != 100 && percent > 0)
                                this.info.text = percent + "%";
                        else
                                this.info.text =  "0%";
 
                        if( percent == 100 )
                        {
                                this.info.text = "";
                                this.pic._x = (80 - this.pic._width) * 0.5 + border_size;
                                this.pic._y = (80 - this.pic._height)* 0.5 + border_size;
                                this.bd._alpha = 100;
                                this.bd._width = this.pic._width + border_size * 2;
                                this.bd._height = this.pic._height + border_size * 2;
                                this.bd._x = this.pic._x - border_size;
                                this.bd._y = this.pic._y - border_size;
                        }
                }
                t.onRollOver = function()
                {
                        this.pic._alpha = 75;
                }
                t.onRollOut = function()
                {
                        this.pic._alpha = 100;
                }
                t.onRelease = function()
                {
                        p = this.tn_no;
                        play();
                }
        }
}
var theMenu:ContextMenu = new ContextMenu();
theMenu.hideBuiltInItems(); _root.menu = theMenu;
function scroller():Void
{
        scroller_mc._y = scrollable_area_mc._y;
        tn_group._y = tn_area._y;
        sr = tn_area._height/tn_group._height;
        scroller_mc._height = scrollable_area_mc._height * sr;
        sd = scrollable_area_mc._height - scroller_mc._height;
        cd = tn_group._height - tn_area._height;
        cr = cd / sd;
        tn_group.setMask(tn_area);
 
        if( tn_group._height <= tn_area._height )
        {
                scroller_mc._visible = scrollable_area_mc._visible = false;
        }
        else
        {
                scroller_mc._visible = scrollable_area_mc._visible = true;
        }
        scroller_mc.onPress = function()
        {
                this.startDrag(false, this._x, scrollable_area_mc._y, this._x,
                                          scrollable_area_mc._y + scrollable_area_mc._height - this._height + 1);
                onDrag = true;
                this.onEnterFrame = function()
                {
                        new_y = tn_area._y + scrollable_area_mc._y*cr - this._y*cr;
                        cv = (new_y - tn_group._y) * scrolling_speed;
                        tn_group._y += cv;
                        if( onDrag == false && cv_old == cv )
                                delete this.onEnterFrame;
                        cv_old = cv;
                }
        }
        scroller_mc.onRelease = scroller_mc.onReleaseOutside = function()
        {
                this.stopDrag();
                onDrag = false;
        }
}

собсна код флэша

Раньше стоял UTF-8, код так же не отображался. Во время загрузки ролика выскакивает сообщение
Код:

Error opening URL 'file:///C|/Documents%20and%20Settings/Ossikuro/Рабочий%20стол/про%20кнопки%2C%20входную%20группу%2C%20доработка%20лого/photos/undefined'
Error opening URL 'file:///C|/Documents%20and%20Settings/Ossikuro/Рабочий%20стол/про%20кнопки%2C%20входную%20группу%2C%20доработка%20лого/photos/undefined'

Помогите пожалуйста

Juice_Green 15.06.2009 09:49

utf-8 оставьте, а то что error opening URL, так не у вас переменная не определена, смотрите, где вы ее неверно инициализируете.

Ossikuro 16.06.2009 05:35

Не смогла найти. Отослала код и флэшку знакомому - у него открылось все нормально. Почему же у меня интересно криво так :umnik2:

Juice_Green 16.06.2009 09:40

если есть возможность, дайте взглянуть


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

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