Форум Flasher.ru
Ближайшие курсы в Школе RealTime
Список интенсивных курсов: [см.]  
  
Специальные предложения: [см.]  
  
 
Блоги Правила Справка Пользователи Календарь Сообщения за день
 

Вернуться   Форум Flasher.ru > Flash > ActionScript 1.0/2.0

Версия для печати  Отправить по электронной почте    « Предыдущая тема | Следующая тема »  
Опции темы Опции просмотра
 
Создать новую тему Ответ
Старый 21.06.2007, 14:11
Alexsas вне форума Посмотреть профиль Отправить личное сообщение для Alexsas Посетить домашнюю страницу Alexsas Найти все сообщения от Alexsas
  № 1  
Ответить с цитированием
Alexsas

Регистрация: May 2007
Сообщений: 106
Отправить сообщение для Alexsas с помощью ICQ Отправить сообщение для Alexsas с помощью Skype™
По умолчанию проблемма с определением размера подгружаемого клипа.

Доброго всем времени суток.
Помогите люди добрые !
никак немогу сообразить как написать код для определения размеров подгружаемого клипа..

Код:
var container:MovieClip = clip.createEmptyMovieClip("image_mc", 1);
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
mcLoader.loadClip((_root.filesRootDir+_root.namePic),container);
function onLoadProgress(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
	pBar2.setProgress(bytesLoaded,bytesTotal);
}

trace (clip.image_mc._width)
trace выдает 0.

я понимаю, что trace надо поместить в onLoadComplite,, но чего-то неполучаеться... помогите мне написать эти пару строк кода.

Спасибо.

Старый 21.06.2007, 14:22
Мыкыта вне форума Посмотреть профиль Отправить личное сообщение для Мыкыта Найти все сообщения от Мыкыта
  № 2  
Ответить с цитированием
Мыкыта

Регистрация: Mar 2003
Адрес: Россия, Санкт-Петербург
Сообщений: 565
ибо надо пользовать onLoadInit
про это в хелпе написано оочень понятно...

Старый 22.06.2007, 10:07
CorC вне форума Посмотреть профиль Отправить личное сообщение для CorC Найти все сообщения от CorC
  № 3  
Ответить с цитированием
CorC
 
Аватар для CorC

Регистрация: Jul 2006
Адрес: Земля>Россия>Вологда
Сообщений: 3,056
Отправить сообщение для CorC с помощью ICQ Отправить сообщение для CorC с помощью MSN Отправить сообщение для CorC с помощью Skype™
Проверять на размер нужно только после загрузки клипа, а никак не во время, а уж тем более перед.
__________________
"We Are The Champions My Friends!" Queen

Старый 22.06.2007, 16:50
Мыкыта вне форума Посмотреть профиль Отправить личное сообщение для Мыкыта Найти все сообщения от Мыкыта
  № 4  
Ответить с цитированием
Мыкыта

Регистрация: Mar 2003
Адрес: Россия, Санкт-Петербург
Сообщений: 565
Код:
onLoadComplete = function([target_mc:MovieClip], [httpStatus:Number]) {}

Invoked when a file that was loaded with MovieClipLoader.loadClip() is completely downloaded. Call this listener on a listener object that you add using MovieClipLoader.addListener(). The onLoadComplete event listener is passed by Flash Player to your code, but you do not have to implement all of the parameters in the listener function. The value for target_mc identifies the movie clip for which this call is being made. This identification is useful when multiple files are being loaded with the same set of listeners.

In Flash Player 8, this listener can return an HTTP status code. If Flash Player cannot get the status code from the server, or if Flash Player cannot communicate with the server, the default value of 0 is passed to your ActionScript code. A value of 0 can be generated in any player (for example, if a malformed URL is requested), and a value of 0 is always generated by the Flash Player plug-in when run in the following browsers, which cannot pass HTTP status codes from the server to Flash Player: Netscape, Mozilla, Safari, Opera, and Internet Explorer for the Macintosh.

It's important to understand the difference between MovieClipLoader.onLoadComplete and MovieClipLoader.onLoadInit. The onLoadComplete event is called after the SWF, JPEG, GIF, or PNG file loads, but before the application is initialized. At this point, it is impossible to access the loaded movie clip's methods and properties, and therefore you cannot call a function, move to a specific frame, and so on. In most situations, it's better to use the onLoadInit event instead, which is called after the content is loaded and fully initialized.

Availability: ActionScript 1.0; Flash Player 7 - Support for unanimated GIF files, PNG files, and progressive JPEG files is available as of Flash Player 8.

Parameters

target_mc:MovieClip [optional] - A movie clip loaded by the MovieClipLoader.loadClip() method.

httpStatus:Number [optional] - (Flash Player 8 only) The HTTP status code returned by the server. For example, a status code of 404 indicates that the server has not found anything matching the requested URI. For more information about HTTP status codes, see sections 10.4 and 10.5 of the HTTP specification at ftp://ftp.isi.edu/in-notes/rfc2616.txt.

Example

The following example creates a movie clip, a new MovieClipLoader instance, and an anonymous event listener which listens for the onLoadComplete event but waits for an onLoadInit event to interact with the loaded element properties.

var loadListener:Object = new Object();

loadListener.onLoadComplete = function(target_mc:MovieClip, httpStatus:Number):Void {
    trace(">> loadListener.onLoadComplete()");
    trace(">> =============================");
    trace(">> target_mc._width: " + target_mc._width); // 0
    trace(">> httpStatus: " + httpStatus);
}

loadListener.onLoadInit = function(target_mc:MovieClip):Void {
    trace(">> loadListener.onLoadInit()");
    trace(">> =============================");
    trace(">> target_mc._width: " + target_mc._width); // 315
}

var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(loadListener);

var mc:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
mcLoader.loadClip("http://www.w3.org/Icons/w3c_main.png", mc);

Создать новую тему Ответ Часовой пояс GMT +4, время: 23:18.
Быстрый переход
  « Предыдущая тема | Следующая тема »  

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.


 


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


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