07.12.2012 Views

Adobe Director Basics

Adobe Director Basics

Adobe Director Basics

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ADOBE DIRECTOR BASICS<br />

Asynchronous programming<br />

To check that the preload process works correctly, create a file named importTest.txt and place it alongside the<br />

importTest.dir movie. You can include whatever text you want in the file. If the file exists, then the movie will be able<br />

to preload it.<br />

To test this in a browser, you will need to upload both the movie and the text file to the same folder on your server,<br />

and then use your browser to connect to the movie.<br />

Testing asynchronous code in a browser<br />

Tracking download progress<br />

Each time you call one of the methods preloadNetThing(), downLoadNetThing(), getNetText(), and postNetText(), it<br />

returns a unique positive integer. The return value increases by 1 on each call. You can use this net ID integer to<br />

identify that particular net operation.<br />

You can use the net ID with getStreamStatus() or with tellStreamStatus() and streamStatus() to obtain information<br />

about how a net operation is progressing.<br />

To see an example of using getStreamStatus() to display a progress bar, download and launch the movie Progress.dir.<br />

The Progress.dir movie shows a textured progress bar as it downloads a 2MB image file from a server<br />

The following handler checks the progress of a net operation identified by aNetID. The handler also sets the width<br />

sprite("Progress") to a value between 0 and 100 to show how much of the file has been downloaded.<br />

Last updated 8/26/2011<br />

438

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!