Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Spearing authored and Spearing committed Oct 5, 2016
0 parents commit 3a1c31a
Show file tree
Hide file tree
Showing 176 changed files with 2,816 additions and 0 deletions.
Binary file added 9781590591680.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Chapter10.sit
Binary file not shown.
27 changes: 27 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,27 @@
Freeware License, some rights reserved

Copyright (c) 2003 Steve Webster and Scott Mebberson

Permission is hereby granted, free of charge, to anyone obtaining a copy
of this software and associated documentation files (the "Software"),
to work with the Software within the limits of freeware distribution and fair use.
This includes the rights to use, copy, and modify the Software for personal use.
Users are also allowed and encouraged to submit corrections and modifications
to the Software for the benefit of other users.

It is not allowed to reuse, modify, or redistribute the Software for
commercial use in any way, or for a user�s educational materials such as books
or blog articles without prior permission from the copyright holder.

The above copyright notice and this permission notice need to be included
in all copies or substantial portions of the software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS OR APRESS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


15 changes: 15 additions & 0 deletions README.md
@@ -0,0 +1,15 @@
#Apress Source Code

This repository accompanies [*Foundation Flash MX Applications*](http://www.apress.com/9781590591680) by Steve Webster and Scott Mebberson (Apress, 2003).

![Cover image](9781590591680.jpg)

Download the files as a zip using the green button, or clone the repository to your machine using Git.

##Releases

Release v1.0 corresponds to the code in the published book, without corrections or updates.

##Contributions

See the file Contributing.md for more information on how you can contribute to this repository.
Binary file added chapter03.sit
Binary file not shown.
35 changes: 35 additions & 0 deletions chapter03/Chapter 03/flashblog files/fake_message_data.xml
@@ -0,0 +1,35 @@
<?xml version="1.0"?>

<FlashBlog>

<message id="1">
<author>
<firstName>Scott</firstName>
<lastName>Mebberson</lastName>
</author>
<time>2002, 12, 12, 10, 53</time>
<subject>Flash and XML go hand in hand!</subject>
<body>This a test message that we'll use to create an XML parsing engine.</body>
</message>

<message id="2">
<author>
<firstName>Scott</firstName>
<lastName>Mebberson</lastName>
</author>
<time>2002, 12, 12, 10, 55</time>
<subject>www.friendsofed.com</subject>
<body>Visit the friends of ED site for information on their range of books.</body>
</message>

<message id="3">
<author>
<firstName>Anthony</firstName>
<lastName>Stevens</lastName>
</author>
<time>2002, 10, 9, 16 , 01</time>
<subject>www.pixelogic.org</subject>
<body>Pixelog is Scott's personal site.</body>
</message>

</FlashBlog>
Binary file not shown.
Binary file added chapter03/Chapter 03/flashblog files/markup.fla
Binary file not shown.
28 changes: 28 additions & 0 deletions chapter03/Chapter 03/flashblog files/message_template.xml
@@ -0,0 +1,28 @@
<?xml version="1.0"?>

<!-- Parent node, all FlashBlog content within -->
<FlashBlog>

<!-- The message node contains information for one message only -->
<message id="1">

<!-- Author node: store first name and last name -->
<author>
<firstName></firstName>
<lastName></lastName>
</author>

<!-- The time the post was written -->
<time></time>

<!-- The subject of the post -->
<subject></subject>

<!-- The body of the post -->
<body></body>

<!-- Close the message node -->
</message>

<!-- Close the parent node -->
</FlashBlog>
Binary file not shown.
98 changes: 98 additions & 0 deletions chapter03/Chapter 03/tutorial files/XMLparsing_code.txt
@@ -0,0 +1,98 @@
// Fix whitespace big
XML.prototype.ignoreWhite = true;

// Create XML object and load file
my_xml = new XML();
my_xml.onLoad = parsePurchaseXML;
my_xml.load("purchase_history.xml");


// Functions /////////////////////////////////////////////////////

function parsePurchaseXML(success) {
// Error check - file loaded?
if (success == false) {
trace("purchase_history.xml failed to load");
return;
}

// Error check - file okay?
if (this.status != 0) {
trace("The XML file was loaded, but was not well formed");
return;
}

// Error check - xml data okay?
if (this.firstChild.nodeName.toLowerCase() != "purchasehistory") {
trace("Unexpected XML data: " + this.firstChild.nodeName);
return;
}

// Extract purchase nodes to array
purchases_arr = this.firstChild.childNodes;

// For each purchase node...
for (var count = 0; count < purchases_arr.length; count++) {
// Extract and output purchase details
var purchaseID = purchases_arr[count].attributes.id;
var purchaseTime = purchases_arr[count].attributes.time;
trace("--- Purchase " + purchaseID + " @ " + purchaseTime + " -------------");

// Parse purchase node
parsePurchaseNode(purchases_arr[count].childNodes);

trace("--- End Purchase ------------------");
trace("");
}
}

function parsePurchaseNode(purchase_arr) {
// For each node in purchase array
for (var count = 0; count < purchase_arr.length; count++) {
// Extract node name
var nodeName = purchase_arr[count].nodeName.toLowerCase();

// Is items node?
if (nodeName == "items") {
// Parse items node
parseItemsNode(purchase_arr[count].childNodes);

// Is client node?
} else if (nodeName == "client") {
// Parse client node
parseClientNode(purchase_arr[count].childNodes);
}
}
}

function parseItemsNode(items_arr) {
// For each item node in array
for (var count = 0; count < items_arr.length; count++) {
trace("---- Item " + items_arr[count].attributes.id);

// Parse item node
parseItemNode(items_arr[count].childNodes);

trace("---- End Item");
}
}

function parseItemNode(item_arr) {
// For each detail node in item details array
for (var count = 0; count < item_arr.length; count++) {
// Output node name and value
trace(" " + item_arr[count].nodeName + ": " + item_arr[count].firstChild.nodeValue);
}
}

function parseClientNode(client_arr) {
trace("---- Client Information");

// For each detail node in client details array
for (var count = 0; count < client_arr.length; count++) {
// Output node name and value
trace(" " + client_arr[count].nodeName + ": " + client_arr[count].firstChild.nodeValue);
}

trace("---- End Client Information");
}
Binary file not shown.
44 changes: 44 additions & 0 deletions chapter03/Chapter 03/tutorial files/purchase_history.xml
@@ -0,0 +1,44 @@
<?XML version="1.0"?>
<PurchaseHistory>
<purchase id="1" time="10/24/02 10:15 AM">
<items>
<item id="1">
<productID>GB9983</productID>
<quantity>1</quantity>
<totalPrice>89.95</totalPrice>
</item>
<item id="2">
<productID>BGH112-9</productID>
<quantity>2</quantity>
<totalPrice>16.25</totalPrice>
</item>
</items>
<client>
<firstName>John</firstName>
<lastName>Doe</lastName>
<address>123 Easy St</address>
<suburb>Beverly Hills</suburb>
<postCode>90210</postCode>
<phoneNumber>456-445-2236</phoneNumber>
<paymentMethod>Credit</paymentMethod>
</client>
</purchase>
<purchase id="2" time="10/24/02 6:20 PM">
<items>
<item id="1">
<productID>SF9985-96</productID>
<quantity>1</quantity>
<totalPrice>115.22</totalPrice>
</item>
</items>
<client>
<firstName>July</firstName>
<lastName>Spencer</lastName>
<address>100 Some St</address>
<suburb>Birmingham</suburb>
<postCode>BGH123</postCode>
<phoneNumber>219-767-1936</phoneNumber>
<paymentMethod>Money Order</paymentMethod>
</client>
</purchase>
</PurchaseHistory>
75 changes: 75 additions & 0 deletions chapter03/Chapter 03/tutorial files/purchase_xml_code.as
@@ -0,0 +1,75 @@
function parsePurchaseXML (success) {

if(success == false) {
trace("purchase_history.xml failed to load");
return;
}

if (this.status != 0) {
trace("The XML file was loaded, but was not well formed");
return;
}

if (this.firstChild.nodeName.toLowerCase() != "purchasehistory") {
trace("Unexpected XML data");
return;
}

history_arr = this.firstChild.childNodes;

for (var count = 0; count < purchaseHistoryNodes.length; count++) {
var purchaseID = history_arr[count].attributes.id;
var purchaseTime = history_arr[count].attributes.time;

trace("--Purchase " + purchaseID + " @ " + purchaseTime + " -------------");

parsePurchaseNodes(history_arr[count].childNodes);

trace("-----------------------------------------");
}
}


function parsePurchaseNodes(purchase_arr) {

for (var count = 0; count < purchase_arr.length; count++) {
var nodeName = purchase_arr[count].nodeName.toLowerCase();

if(nodeName == "items") {
parseItemsNode(purchase_arr[count].childNodes);
} else if (nodeName == "client") {
parseClientNode(purchase_arr[count].childNodes);
}
}

}


function parseClientNode(client_arr) {

trace("---- Client Information");

for (var count = 0; count < client_arr.length; count++) {
trace(" " + client_arr[count].nodeName + ": " + client_arr[count].nodeValue);
}

trace("---- End Client Information");
}


function parseItemsNode(items_arr) {

for(var count = 0; count < items_arr.length; count++) {
trace("---- Item " + items_arr[count].attributes.id);
parseItemNode(items_arr[count].childNodes);
trace("---- End Item");
}
}


function parseItemNode(item_arr) {

for (var count = 0; count < item_arr.length; count++) {
trace(" " + item_arr[count].nodeName + ": " + item_arr[count].nodeValue);
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added chapter04.sit
Binary file not shown.
Binary file added chapter04/Chapter 04/flashblog files/template.fla
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added chapter05.sit
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
35 changes: 35 additions & 0 deletions chapter05/Chapter 05/flashblog files/fake_message_data.xml
@@ -0,0 +1,35 @@
<?xml version="1.0"?>

<FlashBlog>

<message id="1">
<author>
<firstName>Scott</firstName>
<lastName>Mebberson</lastName>
</author>
<time>2002, 12, 12, 10, 53</time>
<subject>Flash and XML go hand in hand!</subject>
<body>This a test message that we'll use to create an XML parsing engine.</body>
</message>

<message id="2">
<author>
<firstName>Scott</firstName>
<lastName>Mebberson</lastName>
</author>
<time>2002, 12, 12, 10, 55</time>
<subject>www.friendsofed.com</subject>
<body>Visit the friends of ED site for information on their range of books.</body>
</message>

<message id="3">
<author>
<firstName>Anthony</firstName>
<lastName>Stevens</lastName>
</author>
<time>2002, 10, 9, 16 , 01</time>
<subject>www.pixelogic.org</subject>
<body>Pixelog is Scott's personal site.</body>
</message>

</FlashBlog>
Binary file added chapter05/Chapter 05/flashblog files/template.swf
Binary file not shown.
Binary file not shown.
Binary file added chapter05/Chapter 05/tutorial files/CH05_D~2.FLA
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added chapter05/Chapter 05/tutorial files/meandering.swf
Binary file not shown.
Binary file added chapter06.sit
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 3a1c31a

Please sign in to comment.