Page 1 of 1

Flash loader problem

Posted: Mon Oct 19, 2009 1:12 pm
by vsesh02
Hello,

I've found a problem.
preloader doesn't work for flash / as3, when streamTostream used. All old movies (as2) work well.
The problem is new movies don't get the correct size of a file that should be loaded (ProgressEvent.bytesTotal = 0. Seems they get it from the headers instead of as2 that gets it directly from a stream).

// translated by admin

---

Добрый день! Вот заметил такую ошибку.
Не работает прелоудер у flash на AS3, когда используется streamTostream. Все старые ролики (as2) работают нормально. Проблема в том, что новые флешки не получают размер загружаемого файла (ProgressEvent.bytesTotal = 0. Видимо, они берут из headers, а as2 из самого потока).

пример

Code: Select all

            WebRequest request = WebRequest.Create(URL);

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            Stream FromStream = response.GetResponseStream();


            FromStreamToStreamWriter writer =
               new FromStreamToStreamWriter(
                  FromStream,
                  Stream
               );

Posted: Mon Oct 19, 2009 4:40 pm
by Softanics
Thank you for your question.

Just set the length:

Code: Select all

 Stream FromStream = response.GetResponseStream();

Stream.SetLength(FromStream.Length); // <-- here!


            FromStreamToStreamWriter writer =
               new FromStreamToStreamWriter(
                  FromStream,
                  Stream
               );


Thank you.

Posted: Tue Oct 20, 2009 4:27 am
by vsesh02
Stream который отправляется во flash доступен только для чтения

Невозможно присвоить значение свойству или индексатору "System.IO.Stream.Length" -- доступ только для чтения.

а все разобрался Stream.SetLength()