Reading And Writing Data Files Computer Science Essay

Published:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

This chapter consists of five sections. Following the introduction section, the first section explains about reading and writing data files. The second section explains about Multi-user Communication. The third section explains about authoring tools. The fourth section is on addressing accessibility issues. The final section is about Xtras.

1.1 Reading and Writing Data Files

FileIO is used in Director to read and write text files. FileIO is the best option to save dynamic information in Director movies. Use the command: put mMessagelist (xtra "FileIO") in the Message window. A list of the FileIO commands will be displayed. You can create, delete, open, close, write to, and read from text files, including complete content or specific characters, words, lines, or strings. A dialogue box can be displayed to help the user to choose a specific file. Using FileIO you can play such tricks like allowing only certain file types such as .DXR, .DCR or .DIR files, displayed in the dialogue box.

1.1.1 Using FileIO to Control a Movie

The "do" command permits to carry out Lingo commands stored as strings. For instance, use a text editor such as Notepad or SimpleText to create a text file containing these two lines:

set the stageColor to 255

alert "This is an alert"

Save the file as "alert.txt". Create a Director movie with the following code in a button or startMovie handler:

set fileXtra = new(xtra "FileIO")

openFile(fileXtra, the pathName & "alert.txt",1)

set readInText = readFile(fileXtra)

closeFile(fileXtra)

do (readInText)

Any command or group of commands can be executed through a "do" statement, and any of those commands can be external to the Director movie and read in as necessary with FileIO, or through getNetText if the file is stored on the Internet.

1.1.2 Creating Web Pages with FileIO

To create a basic web page save the following text as a file with an "HTM" or "HTML" extension:

<html>

<head>

<title> </title>

</head>

<body>

</body>

</html>

To use this in Director movie, call it "HTML" and use the following command:

set textFile = new(xtra "fileio")

set mainHTMLFile = the pathName & "test.htm"

createFile(textFile, mainHTMLFile)

openFile(textFile, mainHTMLFile,2)

writeString(textFile, field "HTML")

closeFile(textFile)

gotonetPage the pathName & "test.htm"

1.1.3 Reading Binary Files with FileIO

FileIO was built to read and write ASCII-based text files. FileIO is not best suited to read binary file data because whenever a byte with a value of zero is encountered, it becomes ASCII character 0, which is the null character treated as an end-of-file marker. As binary files tend to have plenty of zeroes in them, sufficient data is not available in the file.

getLength and readChar Functions

FileIO contains a couple of other functions. The first is the getLength function, which helps to check the number of bytes that are stored in a file.

The second FileIO function is readChar. The basic function of readChar is to read the byte or character of a file one after the other. The important thing for us about readChar is that it is not concerned if it encounters a byte whose value is zero. It will just return an empty string to Lingo, and move to the next byte in the file.

Binary Data

Store the data as a string in Lingo using a linear list, and convert all of the string data returned from FileIO's readChar into its integer equivalent using Lingo's charToNum function. Add the value of every byte of the file to the linear list, which allows manipulating that data.

The resulting Lingo handler is:

on readBinaryFile filePath

 -- Call handler using the full file path

  byteList = []

  -- This list will contain all of the byte values retrieved

  fileObj = new(xtra "fileIO")

  fileObj.openFile(filePath, 1)

  -- Open the file with read-only access

  if fileObj.status() = 0 then

    fileLength = fileObj.getLength()

    -- Find the length of the file in bytes

    repeat with index = 1 to fileLength

      byteList.append(charToNum(fileObj.readChar()))

      -- Append the value of each byte of the file to byteList

    end repeat

  end if

  fileObj.closeFile()

  -- Close the file

  fileObj = 0

  -- Clear the FileIO instance from memory

  return byteList

end

The repeat loop, in conjunction with the readChar function, forces FileIO to keep moving through the file, regardless of the value of the byte it encounters.

1.1.4 Reading Large Files

The problem with the readBinaryFile handler is that large files will return an enormous byteList variable, and will exploit lot of memory. With prior information, the portion of the binary file that is required could be retrieved by slightly modifying the handler like:

on readBinaryFile filePath, startByte, endByte

  -- Optional parameters for specifying positions in the file

  byteList = []

  fileObj = new(xtra "fileIO")

  fileObj.openFile(filePath, 1)

  if fileObj.status() = 0 then

    fileLength = fileObj.getLength()

    

    if startByte.voidP then

      -- Read entire file if parameters aren't supplied

      startByte = 1

      endByte = fileLength

    end if

    

    if (fileLength >= startByte) and (fileLength >= endByte) then

      fileObj.setPosition(startByte-1)

      -- Position FileIO to read from the correct point in the file

      repeat with index = startByte to endByte

        byteList.append(charToNum(fileObj.readChar()))

      end repeat

    end if

  end if

  fileObj.closeFile()

  fileObj = 0

  return byteList

end

1.1.5 Writing Binary Files with FileIO

FileIO is used to edit portions of existing files, like MP3 files, or creating new files, like bitmaps, from a Director cast member.

Parameters used in writing files

filePath: The full path of file that is to be altered or created.

byteList: A linear list containing values ranging from 0 to 255. For ASCII text, this would usually be between 32 and 126.

fileStartByte: Used to point out the point, from where to begin writing data in the existing file. In non-existant files, the fileObj.setPosition() function is ignored.

listStartByte: Allows to state a place in the byteList to start from, without storing the entire data.

deleteOriginalFile: Allows to put back an existing file by removing it from the file system.

1.1.6 Data Types

Data inside a file can represent different kind of values: booleans, integers, floating point numbers, and text, among others. Unlike Lingo, which supports only integer and floating point numeric data types, most other languages support much kind of formats of integers and floating point numbers? In order to make use of the data in a file, identify the type of data and the location of data in the file. This helps to convert data into a corresponding data type in Lingo.

String: ASCII text, 8 bits (one byte) per character.

Unsigned integers: (8, 16, 32, 64 bits) Unsigned indicates that these values can only be positive integers, which range is most dependent on the number of bits used. A 16-bit integer, may have a range between 0 and 65,535 (2^16 - 1).

Signed integers: (8, 16, 32, 64 bits) Signed indicates that these values can be positive or negative. As with unsigned integers, the level of numbers they can represent is dependent on the number of bits used, the major difference being that half of the numbers are now negative. So, a 16-bit signed integer will range from -32,768 to 32,767.

Saving Bitmaps with FileIO

As with the data conversion handlers, you can add more complexity to the exportBitmap handler inside the bitmap_export.dir movie to add support for other features of the bitmap format. These include creating images with palettes, using run length encoding for image compression, and saving images of different bit depths.

Other File Formats

Different types of files such as; audio, bitmaps, database files, digital movies and any file that can be copied on to a hard drive can be saved using FileIO.

Self Check 1.1

Create a web page using FileIO which has been discussed in the previous section.

1.2 Adding Multi-user Communication

1.2.1 Shockwave Multi-user Server

The Shockwave Multi-user Server is used to:

Generate a custom movie that permits real-time conversation.

Hold an online meeting with a shared "whiteboard" that each contestant can write on.

Offer a shared presentation, with a presenter and an audience who watch the presentation at the same time.

Run a multiplayer interactive game.

The Shockwave Multi-user Server and Xtra are two separate components that work together to enable multi-user communication. The server is a separate application that runs on a separate computer. The Director Xtra checks messages for errors, prepares them for passage over the network, and then sends them to the server. The server then determines whom the message was intended for and sends it to the appropriate recipient. The recipient's Xtra gets the message from the network so that it can be used by the movie.

The Shockwave Multi-user server also provides functions that make it easier to create rich and complex multi-user experiences:

The information such as user names or profiles can be stored and retrieved in databases.

Groups can be created to organize users in logical ways. Attributes can be assigned to these groups.

Messages can be sent directly to the server in order to get information about the server and the other movies connected to it.

1.2.2 Setting Up the Multi-user Server

Connecting to the server

To connect to the Shockwave Multi-user Server, Lingo scripts are required that execute each step of setting up the Multi-user Xtra and establishing the Xtra's communication with the server.

To set up a server connection for sending messages, follow these steps:

A working server running on a computer on your network is required with its network address.

Create an instance of the Multiuser Xtra.

For example, these statements place the Xtra instance into the global variable gMultiuserInstance:

global gMultiuserInstance

gMultiuserInstance = new(xtra "Multiuser")

A single Xtra instance always corresponds to a single server connection. Use multiple Xtra instances to have multiple connections at a time. Set the variable containing your Xtra instance to zero while disconnecting from the server.

Set up one or more callbacks for handling incoming messages using setNetMessageHandler.

Initially when the movie is connected to the server, the server responds with a message confirming the connection. In order to handle this and subsequent messages, create callbacks. These are Lingo handlers that are run when messages turn up at a movie from the server or from peer-to-peer users. The entrance of a message is treated as a Lingo event in the similar way that a mouse click is treated as a mouseUp event. Once the callback is declared in Lingo it will be triggered each time a message arrives from the network. A callback handler should be written to perform tasks based on the contents of the incoming message that triggers it.

The message handler would look like:

on defaultMessageHandler

global gMultiuserInstance

newMessage = gMultiuserInstance.getNetMessage

member("messageOutput").text = newMessage

if newMessage.errorCode <> 0 then

alert "Incoming message contained an error."

end if

end

Individual handlers can be run based on a exacting message subject, a sender, or both by adding elective parameters to SetNetMessageHandler() . These entity handlers are run instead of the default message handler when the specified type of message arrives. This statement declares a handler that runs when a message containing the subject Chat Text arrives from sender Guest Speaker:

errCode = gMultiuserInstance.setNetMessageHandler(#guestMessageHandler, script "Connection Script", "Chat Text", "Guest Speaker")

The server uses the name that is provided for the movie to relate other instances of the same movie with each other. By default, every messages sent by the movie Tech Chat will be sent only to other users of the similar movie on the network. When the server accepts the connection, it will respond with a message whose subject is ConnectToNetServer, which will trigger the defaultMessageHandler that is declared earlier. The entire Lingo script for connecting to the server looks like this:

on makeAServerConnection

-- declare a global variable to hold the Xtra instance

global gMultiuserInstance

-- create the Xtra instance

gMultiuserInstance = new(xtra "Multiuser")

-- declare message handler callback(s) to handle incoming messages,

-- including the server's initial connection response

errCode = gMultiuserInstance.setNetMessageHandler(#defaultMessageHandler, script

"Connection Script")

if errCode <> 0 then

alert "Problem with setNetMessageHandler"

end if

-- connect to the server

errCode = gMultiuserInstance.connectToNetServer("Bob", "MySecret",

"chatserver.mycompany.com", 1626, "Tech Chat")

if errCode <> 0 then

alert "Problem with connectToNetServer"

end if

end

-- message handler for incoming messages

on defaultMessageHandler

global gMultiuserInstance

newMessage = gMultiuserInstance.getNetMessage

member("messageOutput").text = newMessage

if newMessage.errorCode <> 0 then

alert "Incoming message contained an error."

end if

end

1.2.3 Using Peer-To-Peer Connections

By using the peer-to-peer functions of the Multi-user Xtra, we can design the movies to communicate directly with one another. For this, set up one instance of a movie as a virtual server, or peer host, and connect up to 16 other movies to it. This helps to set up private chats, create games for limited numbers of users, or make presentations to small groups, without using a server. The disadvantage of this is the access to the server's group, database, or administrative functions is restrained.

One of the movies in a peer-to-peer connection must be the host. Set up a movie that is a peer host by using waitForNetConnection. Once the movie is in peer-host mode, other movies can connect to it in the same way they connect to the server using connectToNetServer.

Movies that connect to a peer host must know the Internet address of the computer on which the host movie is running. Messages can be sent in peer-to-peer mode in the same way as when connected to the server. Messages can be sent directly to other peer users or to the peer host. Messages sent to other peers are routed to the recipient by the Xtra in the host movie, but their contents are not made available to the host movie. Only messages sent to the host user or to System are actually received by the host as messages that can be accessed in Lingo. In peer-host mode, the Xtra does not provide any of the server features such as group management or database access.

Peer hosts can control connectors by keeping track of the list of connected users and breaking connections if necessary. The list of the current peer connections on a peer host is obtained by using getPeerConnectionList. The connection of a specific user in the list can be severed by using breakConnection. An extra CPU burden and network throughput is required on the machine as all peer messages are routed through the peer host.

Self Check 1.2

Set up the server connection and try to send any message.

1.3 Building Authoring Tools

Authoring tools offer the surroundings for integrating the content and functions that include:

Aptitude to create, edit and import data

Assemble data into a playback sequence

Provide method or language for responding to user input

1.3.1 Types of Authoring Tools

Based on metaphor the authoring tools are categorized into:

Card or page based tools

Connecting pages or cards in a sequential order through authoring system

Elements are structured as pages of a book or a pile of cards

Allows user to skip to any page

Can play sound elements or launch animation or video

Characteristics of media objects such as text fields, buttons, graphics, etc are defined by properties

Objects may contain a programming script that is activated by an event.

Events cause messages to pass from one object to another in the project

Authoring systems connect objects to pages or cards

Icon based or event driven tools

Multimedia rudiments and interaction cues are organized as objects in a framework

Authoring tools display flow diagrams of behavior along paths

Non-technical multimedia authors can build complicated applications by placing icons on a flow line

Author-ware has a complete set of tools for editing multimedia elements

Time based or presentation tools

Elements are organized as per the timeline

Elements are organized in a sequence from beginning to end

Multimedia elements are treated as objects that receive messages to perform events at specified times

Score is a sequencer for displaying, animating and playing the Cast members

Animations are made by placing a graphic or sprite on the stage and changing its location over several frames

Lingo is a full featured object oriented language to enable interactivity and program control

1.3.2 Evaluating tools

Tools should be selected based on the requirement, which eventually suits the job. Tools should be evaluated based on the following features:

Editing Features

Creating multimedia elements like images, text, sound, video

Specialized editor is required which Authoring tools may provide

Organizing Features

The Organizational and Design Process involves storyboarding and flowcharting

Some authoring tools, such as Author-ware provide a visual flowcharting system

Programming Features

Visual programming- Best for slide shows and presentations

Scripting- Provides a very high level language for navigation and control and handles user input

Advanced programming languages- provide good debugging facilities, robust text editing, online syntax references, etc.

Document development tools- Used to import pre-formatted text, indexing facilities, complex search mechanisms, and hypertext linking. Computational tasks, responding to user input, creating character icon and motion animations, and controlling external devices can be performed using scripts.

Interactivity Features

Permit the user to control the content and flow of information.

Performance Tuning Features

Synchronization of animation and sound effects

precise timing of events and adapting to slower or faster computer systems

Playback Features

Authoring systems allows to build the project in segments and tests it

Allows the user to easily move between building and testing the project

Delivery Features

Authoring software allows creating a run-time version of the project.

The run-time version allows users to play it without the availability of complete software, but does not authorize to change the content or structure of the project

Cross-Platform Support

Decides whether the target spectators shall use Windows or Mac

Look for authoring tools which offer either a compatible system for the PC or MAC or a runtime version for the system

Internet Playability

Mainly the authoring systems offer a means to convert output so that it can be delivered within HTML or DHTML

1.3.3 Creating MIAW Xtras

In our previous chapter we already learned about creating and controlling MIAWs. Let us now learn about creating MIAW Xtras. Once the movie is created in Director, place it in the XTRAS folder, where the Director application is placed. Whenever the movie is run in Director, it appears in the Xtras menu.

The Movie Xtras dialog box allows setting the xtras that are to be included in a projector. Xtras that are in lingo code are to be manually added as they are not detected by director. In order to run the movie with specified size and speed, manage the Xtras appropriately.

Self Check 1.3

Explain presentation tools which has been discussed in the previous section.

1.4 Addressing Accessibility Issues

Director includes features that make existing and new movies accessible to users who have hearing, visual, or mobility impairment.

1.4.1 Using the Accessibility Behavior library

Accessibility includes the behaviors for enabling keyboard navigation, text-to-speech, and captioning.

For keyboard navigation, use the Accessibility Target, Accessibility Item or Accessibility Text Edit Item, Accessibility Keyboard Controller, and Accessibility Group Order behaviors.

For text-to-speech, use the Keyboard Navigation behaviors, and then add either the Accessibility Speak or Accessibility Speak Member Text behavior. You can also use the Accessibility Speak Enable/Disable behavior to let users turn the text-to-speech feature on and off.

For captioning, use the Keyboard Navigation behaviors and Accessibility Speak behaviors, and then add the Accessibility Captioning and Accessibility Sync Caption behaviors.

Deploying accessible movies

To deploy an accessible movie effectively, you must become familiar with the Speech Xtra extension's system requirements and download procedure.

Adding the Speech Xtra

Incorporate the Speech Xtra in the movie's Xtra extensions list, in order to use the text-to-speech feature. In general, Xtra extensions that are not included in a movie's default Xtra extensions list are added only when a cast member requires. The default Xtra extensions list can be viewed by opening a new movie and selecting Modify > Movie > Xtras.

The Speech Xtra is a script-only Xtra. It adds methods and properties to Lingo or JavaScript syntax, but not to any new cast member types. As the Speech Xtra is not associated with any kind of cast member, this can be added to the movie's Xtra extensions list manually.

Add the Speech Xtra to the movie's Xtra extensions list

Open the movie

Select Modify > Movie > Xtras

Click Add In the dialog box

In the alphabetical list of Xtra extensions, scroll to Speech, and select the Speech Xtra.

Click OK twice to close the dialog boxes.

Save your movie.

Testing the Speech Xtra

To verify that your computer is configured correctly to let the Speech Xtra work, type the following script in the Message window:

put voiceInitialize()

If the result is 1, the Speech Xtra is working. If the result is 0, text-to-speech software is not installed on your computer.

Self Check 1.5

Add a speech extra to movie's Xtra extensions list.

1.5 Using Xtras

1.5.1 XML

XML is similar to HTML that uses markup tags to define content. Though, HTML has predefined tags that are used to plan any data. Any application that reads HTML have to understand the meaning of tags such as TITLE, P, and BODY. HTML tags also explain how information appears on the screen. XML consists of a set of rules that define custom tags and the data type, and has no visual component. An XML document is merely a container for the data. Based on the data the XML document contains, the Director developer decides about what the Director movie should do with the information.

One key advantage of XML is that it is not an order-dependent. With XML, the individual data components can be referred by name. If you insert a new chunk of data before the one in use, the name is still valid. Existing code continues to work, and the newly inserted data is ignored.

Using XML Parser Objects

The XML Parser Xtra lets Director developers access the nodes of an XML document. A node can be a tag, character data, or a processing order. Information can be extracted from the XML document by looking at its nodes with Lingo or JavaScript syntax. This allows users to incorporate XML documents into their movies and selectively extract data from the documents.

An XML document is well formed if it has a logical nesting structure and no absent angle brackets. Some XML documents can be connected with a Document Type Declaration (DTD) file that describes precise rules for the XML tags the document uses. The XML Parser Xtra checks that the XML follows the broad rules of creating and using XML tags to ensure that the document is well formed. The Xtra is called non-validating as it does not check the DTD file to ensure that the tags follow the specific rules described by the DTD. The creator of the original XML document must follow the rules described in the DTD. The Director movie should also include script that checks for errors in the use of the XML document's tags.

Using XML Document Nodes

The XML document can enclose dissimilar types of nodes. Each node can enclose different kinds of data, depending on the node type. Check the node type before accessing its data to know what type of data to expect. Nodes are read-only; it can be retrieved, but cannot be set.

Using the XML document as a starting point, the subsequent examples demonstrate how to use these script terms to access the data within various node levels of the XML structure.

The XML looks like the following example:

<?xml version="1.0"?>

<e1>

<tagName attr1="val1" attr2="val2"/>

<e2> element 2</e2>

<e3>element 3</e3>

Here is some text

</e1>

To return the name of the first XML tag:

put gParserObject.child[1].name

-- "e1"

The gParserObject variable contains the parsed XML. When used in the preceding script, it refers to the root node of the XML document. The script term child[1] refers to the first level of nested tag, which is the e1 tag.

To find out the type of node of the first tag:

put gParserObject.child[1].type

-- #element

To refer to the nodes that are nested more than one level deep, use more than one level of child reference. The script that returns the name of the first tag that is nested within the e1 tag:

put gParserObject.child[1].child[1].name

-- "tagName"

To return the name of the second tag that is nested within the e1 tag:

put gParserObject.child[1].child[2].name

-- "e2"

To refer to the text data that occurs within a particular tag, use the text property. The text is a child node of the tag that contains it, so you need an additional level of child reference. This script returns the following string, which appears inside the e2 tag from the previous XML example:

put gParserObject.child[1].child[2].child[1].text

-- "element 2"

1.5.2 Accessing Attributes

The attributeName and attributeValue properties are used to access the attributes of tags that have values. In the previous XML example, the first tag nested inside the e1 tag is called tagName and has two attributes called attr1 and attr2.

The attributeName property is used to return the name of the first attribute of the tag called tagName, which is the first child of the e1 tag:

put gParserObject.child[1].child[1].attributeName[1]

-- "attr1"

The attributeValue property is used with an integer to return the value of the first attribute of the tagName tag:

put gParserObject.child[1].child[1].attributeValue[1]

"val1"

The attributeValue property is used with a string to return the value of the attr1 attribute:

put gParserObject.child[1].child[1].attributeValue["attr1"]

-- "val1"

The count method is used with the attributeName property to return the number of attributes in the first child of the e1 tag:

put gParserObject.child[1].child[1].attributeName.count

-- 2

Parser Objects and XML Nodes

The parser object in the gParserObject variable, stores the root of the parsed tree of the XML document. An XML node is a node within the tree. The root node is like an XML node because almost all the operations on XML nodes can be applied to the root node.

In the previous XML example, the root of the tree is an XML element node named "ROOT OF XML DOCUMENT" that has no attributes and one child (the e1 tag). You can get the same information about the root node as for any of the child nodes.

To return the root node's type, name, and number of children:

put gParser.type, gParser.name, gParser.count(#child)

-- #element "ROOT OF XML DOCUMENT" 1

The main difference between the root node and its child nodes is that several script methods apply to the entire XML document and operate on the root node only. These methods include doneParsing(), getError(), ignoreWhiteSpace(), makeList(), parseString(), and parseURL().

XML and Character Sets

When you use XML, remember that dissimilar computer systems use diverse binary encoding to represent text characters.

The XML Parser Xtra adheres severely to the XML specification, which states that XML documents are, by default, encoded using the UTF-8 character set. If the document is not encoded in UTF-8, it must include a declaration of its character set in the first line of the document.

The XML Parser Xtra supports the following character sets:

ISO-8859-1- Also called Latin 1. This is the most common western encoding used on the web. It matches the default character set that is used on Windows in western countries. The first 127 characters (binary codes 1-127) are same in most of the countries.

UTF-8- An 8-bit encoding of the Unicode character set. This is the XML default character set.

US-ASCII- Supports only 7-bit characters.

EUC-JP- The EUC character set, used widely in Japan.

SHIFT_JIS- Also used widely in Japan. Shift-JIS is the character set used by default in Japanese versions of Windows and the Mac OS.

UTF-16- A 16-bit encoding of the Unicode character set.

1.5.3 Using the MUI Xtra

The MUI Xtra provides fully functional dialog boxes set up the way that is specified. These dialog boxes do not require the memory or disk footprint of a MIAW that simulates a dialog box. They also draw the appropriate Windows controls, follow preferences for dialog box appearance set by the user in Windows 95, and draw with gray-scale controls on the Macintosh.

Dialog boxes created from the MUI Xtra also provide:

Horizontal scrolling within editable text fields

Clipboard operations for editable text

Activation of a default item when the user presses Enter or Return

Activation of a cancelled item when the user presses Esc-period or

Command-period.

The MUI Xtra supports these dialog box types:

General purpose dialog boxes that you can set up with any arrangement of buttons, editable fields, labels, sliders, and pop-ups

Alerts several possible button and icon combinations

Standard open file dialog boxes

Standard save file dialog boxes

A dialog box for entering a URL

1.5.4 Creating dialog boxes

To create dialog boxes from the MUI Xtra:

Plan and design the dialog box: Determine the aim of the dialog box, the type of interface components, and the source of the data. Design a preliminary dialog box to get a clear idea.

Type of dialog box: The MUI Xtra provides predefined dialog boxes for entering alerts, opening and saving files, and for entering URLs. These are relatively easy to create. If none of these types are appropriate, you can define your own general purpose dialog box.

Use the new statement to create an instance of the MUI Xtra.

Set up the dialog box.

Types of Dialog Boxes

Standard dialog box

It is used for alerts, opening and saving files, and opening URLs. When the user clicks a button, the dialog box responds accordingly and sends the appropriate message back to Director. This is created with the function that creates the specific dialog box.

General Purpose Dialog Box

Used to define each attribute and component in the dialog box, and then explicitly initialize and run the dialog box.

Specifying Overall Dialog Box Properties

To specify the dialog box's overall properties, create a property list that sets values for each of the window's properties.

The GetWindowPropList function returns a predefined list of attributes. Usually it is easy to obtain a predefined list from the GetItemPropList function and then modify values as needed.

Before opening the dialog box, use the Initialize command to specify which list Director uses as the source of definitions for the overall dialog box. The following are the overall dialog box properties and their possible values:

Table1: Dialog box Properties and Possible values

Property

Possible Values

#type

#alert, #normal, #palette

#name

String that contains the window name. Use "" for no name.

#callback

Handler that processes the result of the callback.

#mode

#data, #dialogUnit, or #pixel. These set the way that Director lays out the dialog box.

#Xposition

Number of pixels that upper left corner of the dialog box appears from the left of the screen. Specify -1 to have the dialog box appear in the center.

#Yposition

Number of pixels at the top of the dialog box appears from the top of the screen. Specify -1 to have the dialog box appear in the center.

#width

Width of the window in pixels. Specify 0 to have the dialog box set its width automatically.

#height

Height of the window in pixels. Specify 0 to have the dialog box set its height automatically.

#modal

TRUE or FALSE. Sets whether the dialog box is modal.

#toolTips

TRUE or FALSE. Sets whether to use tooltips initially.

#closeBox

TRUE or FALSE. Specifies whether the dialog box has a close box.

#canZoom

TRUE or FALSE. Specifies whether the dialog box can zoom.

Specifying dialog box content

To identify the content of a broad purpose dialog box, create a linear list of definitions for each component of the dialog box. Each meaning is a property list that defines one component. Components appear in the order that they are listed.

Several components define the structure of the dialog box, such as the beginning and end of the window and the start and end of horizontal and vertical sets of components. When constructing the dialog box, use the overall framework of components:

Window beginning

This comprise nested sets of additional horizontal and vertical groups, horizontal and vertical dividers, labels, and interface features such as buttons, check boxes, editable fields, and other interface elements.

Self Check 1.5

Create a dialogue box using MUI extra discuss in the previous section.

Summary

This chapter explained about reading and writing data files, binary files and large files using FileIO.

This also explained about adding multi-user communication such as Shockwave Multi-user Server, setting Up the Multi-user Server for sending messages, Peer-To-Peer Connections etc.

This also explained about Building authoring tools which includes types of authoring tools, evaluating tools and creating MIAW Xtras

This also explained about addressing accessibility issues and using Xtras.

Key Words

FileIO- used in Director to read and write text files

HTM- Hypertext Markup

HTML- Hypertext Markup Language

Unsigned integers- Positive integers, whose range is dependent on the number of bits used.

Signed integers- Integers, whose values can be positive or negative

MIAW- Movie In A Window

XML- Extensible Markup Language

Parser- Software program for analyzing language

ACTIVITY

True/False Questions

FileIO was built to read and write ASCII-based text files

The basic function of readChar is to check the number of bytes that are stored in a file.

"DeleteOriginalFile" command allows replacing an existing file by removing it from the file system.

Page based tools cannot play sound elements or launch animation or video.

In time based tools, animations are made by placing a graphic or sprite on the stage and changing its location over several frames.

Non-technical multimedia authors can build sophisticated applications by placing icons on a flow line.

The Speech Xtra can be added to the movie's Xtra extensions list manually, as is not associated with any kind of cast member.

In XML the newly inserted data is not ignored.

Information can be extracted from the XML document by looking at its nodes with Lingo or JavaScript syntax.

Nodes are read-only; it can be set but cannot be retrieved.

Multiple Choice Questions

____________ will just return an empty string to Lingo, and move to the next byte in the file.

getLength function

readChar function

binary data

FileIO

__________ is a linear list containing values ranging from 0 to 255

byteList

listStartByte

fileStartByte

filePath

These are Lingo handlers that are run when messages arrive at a movie from the server or from peer-to-peer users.

Message handler

multi-user instance

callbacks

FileIO

Authoring systems connect objects to pages or cards in ___________

card based tools

icon based tools

time based tools

event based tools

________ consists of a set of rules that define custom tags and the data type, and has no visual component.

HTML

Data Files

FileIO

XML

Based on the data that is in _______ the Director developer decides about what the Director movie should do with the information.

FileIO

Data Files

XML

HTML

Number of pixels at the top of the dialog box appears from the top of the screen.

#Xposition

#Yposition

#mode

#modal

The creator of the original XML document must follow the rules described in _________.

DTD

FileIO

Xtra

HTML

Objects may contain a programming script that is activated by an event.

Event driven tools

Presentation tools

Icon based tools

Page based tools

Lingo is a full featured object oriented language to enable interactivity and program control

Time based tools

Icon based tools

Event based tools

Card based tools

Answers:

Activity A:

True

False

True

False

True

True

True

False

True

False

Activity B:

b

a

c

a

d

c

b

a

d

a

Writing Services

Essay Writing
Service

Find out how the very best essay writing service can help you accomplish more and achieve higher marks today.

Assignment Writing Service

From complicated assignments to tricky tasks, our experts can tackle virtually any question thrown at them.

Dissertation Writing Service

A dissertation (also known as a thesis or research project) is probably the most important piece of work for any student! From full dissertations to individual chapters, we’re on hand to support you.

Coursework Writing Service

Our expert qualified writers can help you get your coursework right first time, every time.

Dissertation Proposal Service

The first step to completing a dissertation is to create a proposal that talks about what you wish to do. Our experts can design suitable methodologies - perfect to help you get started with a dissertation.

Report Writing
Service

Reports for any audience. Perfectly structured, professionally written, and tailored to suit your exact requirements.

Essay Skeleton Answer Service

If you’re just looking for some help to get started on an essay, our outline service provides you with a perfect essay plan.

Marking & Proofreading Service

Not sure if your work is hitting the mark? Struggling to get feedback from your lecturer? Our premium marking service was created just for you - get the feedback you deserve now.

Exam Revision
Service

Exams can be one of the most stressful experiences you’ll ever have! Revision is key, and we’re here to help. With custom created revision notes and exam answers, you’ll never feel underprepared again.