Solved

AS3 coding a loader for a swf so that the first scene will play while the others are still loading

Posted on 2013-05-23
1
292 Views
Last Modified: 2013-06-07
Hi,
I have a loader for a 41MB swf that, at the moment makes the swf load in its entirety before it begins playing. I would like to change the code to allow the first scene to play as the others are continuing to download. Is this possible to do in the ActionScript?
My current code is:
var req:URLRequest = new URLRequest ("VirtualNurseDemo5D.swf");
var loader:Loader = new Loader ();

function fileLoaded(event:Event):void
{
	addChild(loader);
}

function preload(event:ProgressEvent):void
{
	var percent:Number = Math.round(event.bytesLoaded / event.bytesTotal * 100);
	loadertxt.text = String(percent) + "%";
	trace (percent);
}
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, fileLoaded);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, preload);
loader.load(req);

Open in new window




Thanks!
0
Comment
Question by:msjlogicjunction
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 8

Accepted Solution

by:
section25 earned 300 total points
ID: 39192342
Unfortunately, a "swf" is not like a "flv". Since it is not a video, it needs to finish downloading so that all of the compenets are in place before flash can start using it.

Just imagine if the first frame of the loading swf calls a function that is in the last frame of the loading swf, what would happen when the function is called and it is not loaded yet? Big problem. So in order to prevent that, flash waits for the whole thing to finish loading before it allows it to be used. A video is different becuase it does not present the same problems. The first frames never depend on any other frames later in the movie.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question