still displayed in the transmission of data (FF this situation most obvious), so still with the incident more insurance.
Define a simple method, mount it inside the windows.onload, and do a logo when executed
Copy Code code as follows:
var loadcomplete = false;
function loadcompleted ()
{
Loadcomplete= true;
}
Window.attachevent ("onload", loadcompleted);
Oh, so we just jud
if the page is loaded and completed?
1, through the state of document
2, through the event trigger (Windows.onload)
The first one seems to be more uninsured, sometimes it is all finished, it is still displayed in the transmission of data (FF this situation most obvious), so still with the incident more insurance.
Define a simple method, mount it inside the windows.onload, and do a logo when executed
var loadcomplete = false;function loadcompleted (){
the event after loading the page. ---> Trigger the event. That's right.
How do I know whether the page is loaded?
1. The status of the document
2. Event-triggered (Windows. onload)
First, it seems that it is not safe. Sometimes it is clearly loaded, and it still shows that it is transmitting data (FF is the most obvious), so it is safer to use events.
Define a simple method, mount it to Windows. onload, and make an identifier during execution
VaRLoadcomplete =False;Functi
Sequence:Theme and stylesheettheme can be rewritten. The execution sequence of the corresponding skin and CSS files during page loading is as follows:Stylesheettheme ---- style custom Style ---- themeIf the same attribute exists, it will be overwritten in order during loading. If the style attributes are different, they are inherited.
The page will be activated in the following order: Page. preinit
Page. init
Page. initcomplite
Page. Preload
Page. Load
Page.
;
In the "label" layer, set the frame label to facilitate the jump frame;
In the "as" layer, place the appropriate loading, playback code, and so on, mainly contains four blank keyframes, frame 2nd is used to load the XML file and save the data in one object. frame 10th Load CSS file, the same information stored in an object, the 20th frame is mainly related to the playback code, such as loading advertising files, switching effects.
2, write the code to load the XML file:
Stop ();
Import fc.load
Server Object and will not be displayed in the display track of the page. This is the lifetime of the page, which is run for every request.
Ii. Lite version
Page is activated in the following order: Page. preInit ----> Page. init ----> Page. initComplite ----> Page. preLoad ----> Page. load ----> Page. loadComplete ----> Page. preRender ---->
Page. PreRenderComplete
If a page is inherited from a page, such as BasePage: System. web. UI. page, some ext
The page will be activated in the following order:
Page. preinitPage. initPage. initcomplitePage. PreloadPage. LoadPage. loadcompletePage. prerenderPage. prerendercomplete
If a page is inherited from a page, such as basepage: system. web. UI. page, some extensions are made in the basepage, such as permission check. When other pages inherit from the basepage, the order of activation of the events of the basepage and the final page is:
UI. preinit page. preinit UI. init page. in
);_loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadComplete);_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,loadIO_Error);_loader.load(_request,_lc);}private function loadComplete(e:Event):void{//trace("loadComplete");var li:LoaderInfo = e.currentTarget as LoaderInfo;var bmp:Bitmap = li.content as Bitmap;bmp.height = _imgHeight;bmp.
));
_ Sound. addeventlistener (event. Complete, loadcomplete); // scheduling of sound Loading
_ Sound. addeventlistener (ioerrorevent. io_error, loaderror); // load error Scheduling
}
Public Function loadcomplete (E: Event): void
{
Startmusic ();
}
Public Function startmusic (timenums: Int = 0): void
{// Play music
Channel = _ sound. Play (0, timenums); // specifies the number of playback sounds
"); addchild (loadinglayer); // start reading the image LoadImage ();} function LoadImage () {// read all the images and start initializing the game if (loadindex> = imgdata. length) {removechild (loadinglayer); gameinit (); Return ;}// start to read the image loader = new lloader (); loader. addeventlistener (Levent. complete, loadcomplete); loader. load (imgdata [loadindex]. path, "bitmapdata");} function loadco
operation UI obtained in doInBackground.
If necessary, you have to rewrite the following three methods, but they are not required:
OnProgressUpdate allows you to use progress bars to increase user experience.
OnPreExecute this is the interface used by the end user to call the Excute
OnCancelled
According to the above ideas, we can see that the final data loading and display of this series of operations are in the onPostExecute method, so how to listen to all the UIS has been processed in onPost
For example, we have a main flash called main.swf, and then there is a load.swf, as long as you write the following code in load.swf to download main.swf playback:
The code is as follows
Copy Code
var request : URLRequest = new URLRequest ("main.swf"); var loader:loader = new Loader (); Loader.contentLoaderInfo.addEventListener (progressevent.progress, loadprogress);//This is a loading process event Loader.contentLoaderInfo.addEventListener (Event.complete,
for the download, or watch a beautiful animation at this time It all depends on your design. Now that the load is complete, you can execute the LoadComplete method. Add the action you want to the LoadComplete method, such as giving the user a play button so that the user can choose it, or go directly to a frame to play.
As I said earlier, adding loading directly to the SWF may cause loading not to start a
of friends welcome to discuss together.
First create an interface
Private interface Isloaddatalistener {public
void LoadComplete ();
}
Declare this interface variable
Private Isloaddatalistener Loadlisneter;
Assigning values to interfaces to get interface objects
public void Setloaddatacomplete (Isloaddatalistener datacomplete) {
this.loadlisneter = datacomplete;
}
The interface is then invoked af
, address loading, loading of objects, total bytes loaded (and number of bytes during loading). , loading the width of the object and so much content (too much content, more people can go to see Help).There are 2 different ways to access the Loaderinfo object:1 Accessing the Contentloaderinfo property of the Flash.display.Loader object;2 any Visible object (Display object) has a loaderinfo attribute;Note: an instance of the main class for each SWF document has the Loaderinfo attribute, each load
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.