![]() |
|
||||||||||
|
|||||||
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | Опции просмотра |
|
![]() |
![]() |
|
|||||
|
Доброго всем времени суток.
Помогите люди добрые ! никак немогу сообразить как написать код для определения размеров подгружаемого клипа.. 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 надо поместить в onLoadComplite,, но чего-то неполучаеться... помогите мне написать эти пару строк кода. Спасибо.
__________________
Встретимся на пляже! |
|
|||||
|
Регистрация: Mar 2003
Адрес: Россия, Санкт-Петербург
Сообщений: 565
|
ибо надо пользовать onLoadInit
про это в хелпе написано оочень понятно... |
|
|||||
|
Проверять на размер нужно только после загрузки клипа, а никак не во время, а уж тем более перед.
__________________
"We Are The Champions My Friends!" Queen |
|
|||||
|
Регистрация: 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. |
|
|
« Предыдущая тема | Следующая тема » |
|
|