开发者

Flash - how to start playing an SWF film being loaded before it is complete?

开发者 https://www.devze.com 2023-01-11 16:29 出处:网络
I have a large SWF flash file being loaded by a parent SWF and I would like to start playing the film being loaded, let\'s say, when it is 50% completed. According to my expected user\'s bandwidth and

I have a large SWF flash file being loaded by a parent SWF and I would like to start playing the film being loaded, let's say, when it is 50% completed. According to my expected user's bandwidth and the size of my film I will calculate the best moment to do that (the film could be 20%, 30% or 50% loaded). I want to leave users waiting the minimum and I don't need to wait until my flash is 100%.

Ok, that said, here is the problem. I am in ActionScript 3. I have one film loading another and I want to anticipate the loaded film start. I have an onProgressHandler(mProgress:ProgressEvent) function (with listener launched by ProgressEvent.PROGRESS) and I have a regular onLoadComplete(e:Event) function (with listener launched by Event.COMPLETE). I could check for 20% completed during my regular onProgressHandler. But then, when I have identified this point has been reached, how can I anticipate the launching of the film? I mean, my Event.COMPLETE handler passes the e:Event and I can use e.target to get the loaded object into my film. But what happens if I want to start that process before it is complete? I cannot pass this e:Event because the COMPLETE handler hasn't been launched yet...

One important thin开发者_开发百科g to say. The film that is loading is almost empty. It is very light. The heavy film is the one being loaded and I want to attach that film being loaded to a movie clip in my film before it has completed loading. Is that possible?

I hope I have made myself clear. In case I haven't, I will try to explain further.

Any assistance will be very much appreciated. Thank you so much.


the progressEvent has a bytesLoaded property that you can use to decide when to start your movie. By knowing the total bytes, and the bytes loaded, all you have to do is set a time interval to determine the user's actual download speed. Once you have all that information, you'll be able to determine if the user has downloaded enough to start the movie.

Check the adobe site for more on ProgressEvent: http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/events/ProgressEvent.html

escapetheory.com.au

0

精彩评论

暂无评论...
验证码 换一张
取 消