• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Xml content

New Here ,
Aug 25, 2012 Aug 25, 2012

Copy link to clipboard

Copied

Hello

wanted to know with the help of all what better way to visualize or

which forms to view this content in Flash.

I've never used XML, Flash only, so I'm kinda lost.

Flash File

http://www.mediafire...82o6f72hdxa2xkc

reference

MusicXML

Code: XML

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE score-partwise PUBLIC

  "-//Recordare//DTD MusicXML 2.0 Partwise//EN"

  "http://www.musicxml.org/dtds/partwise.dtd">

<score-partwise version="2.0">

  <part-list>

  <score-part id="P1">

  <part-name>Music</part-name>

  </score-part>

  </part-list>

  <part id="P1">

  <measure number="1">

  <attributes>

  <divisions>1</divisions>

  <key>

  <fifths>0</fifths>

  </key>

  <time>

  <beats>4</beats>

  <beat-type>4</beat-type>

  </time>

  <clef>

  <sign>G</sign>

  <line>2</line>

  </clef>

  </attributes>

  <note>

  <pitch>

  <step>C</step>

  <octave>4</octave>

  </pitch>

  <duration>4</duration>

  <type>whole</type>

  </note>

  </measure>

  </part>

</score-partwise>

Tanks.

TOPICS
ActionScript

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 25, 2012 Aug 25, 2012

Copy link to clipboard

Copied

What are you trying to do?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 26, 2012 Aug 26, 2012

Copy link to clipboard

Copied

Hi Murphy,

something like this site,

for now the only part of the score display xml

but I'll use mysql and php

http://musicrain.com/demo-sheetmusic.php

Tanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 26, 2012 Aug 26, 2012

Copy link to clipboard

Copied

I think you misunderstand what I am asking.  In your first posting you say "what better way to visualize or which forms to view this content in Flash"... what does that mean?  For the xml code that you showed, what are you trying to do with it?  How do you hope to manipulate it?  What code have you tried that is not working for you?

Just so you know, few people will download files, especially from sites like mediafire where you have to wonder if a virus is about to infect your machine as they do what they can to divert you from actually getting the file you are trying to get. 

You are more likely to get help when you include everything in your posting, like code and error messages and screenshots.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 26, 2012 Aug 26, 2012

Copy link to clipboard

Copied

Hi right

I'll post the codes and flash images

actions layer

line 1

post-flash-xml-01.JPG

______________________________________________________

// take out if running in Flash MX:

#include "xmlnitro.as"

function Article(id, link, headline, source) {

    this.id = id;

    this.link = link;

    this.headline = headline;

this.source = source;

}

function makeArray(success) {

   var i, j, mainTag, id, link, headline, source;

   if (success) {

      for (i=0; i<=moXML.childNodes.length; i++) {

         if (this.childNodes.nodeValue == null && this.childNodes.nodeName == "moreovernews") {

            mainTag = this.childNodes;

         }

      }

      for (i=0; i<=mainTag.childNodes.length; i++) {

         if (mainTag.childNodes.nodeName == "article") {

            id = mainTag.childNodes.attributes["id"];

            for (j=0; j<mainTag.childNodes.childNodes.length; j++) {

               if (mainTag.childNodes.childNodes.nodeName != null) {

                  if (mainTag.childNodes.childNodes.nodeName == "url") {

                      link = mainTag.childNodes.childNodes.firstChild.nodeValue;

                  } else if (mainTag.childNodes.childNodes.nodeName == "headline_text") {

                      headline = mainTag.childNodes.childNodes.firstChild.nodeValue;

                  } else if (mainTag.childNodes.childNodes.nodeName == "source") {

                      source = mainTag.childNodes.childNodes.firstChild.nodeValue;

                  }

               }

                  }

            thisArticle = new Article(id, link, headline, source);

            articles.push(thisArticle);

delete thisArticle;

         }

      }

      _root.gotoAndStop("showArticles");

   }

}

// articles is an array of Article objects

var articles = [];

// read xml and display when loaded

moXML = new XML();

moXML.ignoreWhite = true;

moXML.onLoad = makeArray;

moXML.load("intdev_page.xml");

stop();

________________________________________

post-flash-xml-02.JPG

Frame 10

news = "";

for (i=0; i<articles.length; i++) {

   news += "<a href='" + articles.link + "'>" + articles.headline + "</a><br>";

   news += "  <font color='#cccccc'>(" + articles.source + ")</font><br>";

}

stop();

______________________________________________________________

"xmlnitro.as"

//--------------------------------------------------

// XMLnitro v 2.1

//--------------------------------------------------

// Branden J. Hall

// Fig Leaf Software

// October 1, 2001

//

// Thanks to Colin Moock for good whitespace info

//--------------------------------------------------

// This file simply replaces the built-in parseXML

// method.  In doing so it increases the speed of

// XML parsing 70-120% (dependent on file size).

// In addition, the ignoreWhite property now works

// in all versions of the Flash 5 plugin and no

// just the R41/42 versions. In order to do such

// this parser removes all text from mixed content

// nodes (i.e. nodes that contain both child nodes

// and child text nodes). This code is Flash 5

// specific so it makes sure that the user has only

// a Flash 5 plugin.

//--------------------------------------------------

Object.version = getVersion().split(",");

Object.majorVersion = int(substring(Object.version[0],Object.version[0].length, 1));

Object.minorVersion = int(Object.version[2]);

if (Object.majorVersion == 5){

XML.prototype.checkEmpty = function(text){

var max = text.length;

var empty = true;

for (var i=0;i<max;++i){

if (ord(substring(text, i+i, 1))>32){

empty = false;

break;

}

}

return empty;

}

XML.prototype.parseXML = function(str){

this.firstChild.removeNode();

var treePtr = this;

var tags = new Array();

var textNode = null;

if (Object.minorVersion == 30){

this.status = ASnative(300, 0)(str, tags);

}else{

this.status = ASnative(300, 0)(str, tags, false);

}

if (this.status == 0){

var curr;

var i=0;

var max = tags.length;

if (this.ignoreWhite){

while (i<max){

curr = tags;

if (curr.type == 1){

if (curr.value == "/"+treePtr.nodeName){

treePtr = treePtr.parentNode;

}else{

treePtr.appendChild(this.createElement(curr.value));

treePtr = treePtr.lastChild;

treePtr.attributes = curr.attrs;

if (curr.empty){

treePtr = treePtr.parentNode;

}

}

}else{

if (curr.type == 3){

if (!this.checkEmpty(curr.value)){

treePtr.appendChild(this.createTextNode(curr.value));

}

}else{

if (curr.type == 6){

treePtr.appendChild(this.createTextNode(curr.value));

}else{

if (curr.type == 4){

this.xmlDecl = curr.value;

}else{

this.docTypeDecl = curr.value;

}

}

}

}

++i;

}

}else{

while (i<max){

curr = tags;

if (curr.type == 1){

if (curr.value == "/"+treePtr.nodeName){

treePtr = treePtr.parentNode;

}else{

treePtr.appendChild(this.createElement(curr.value));

treePtr = treePtr.lastChild;

treePtr.attributes = curr.attrs;

if (curr.empty){

treePtr = treePtr.parentNode;

}

}

}else{

if (curr.type == 3 || curr.type == 6){

treePtr.appendChild(this.createTextNode(curr.value));

}else{

if (curr.type == 4){

this.xmlDecl = curr.value;

}else{

this.docTypeDecl = curr.value;

}

}

}

++i;

}

}

}

}

}

____________________________________________________________

Tanks...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 26, 2012 Aug 26, 2012

Copy link to clipboard

Copied

For all the questions I asked in the first paragraph you seem to have missed answering all of them.  If you cannot explain your problem I am not going to be able to try to help resolve it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 27, 2012 Aug 27, 2012

Copy link to clipboard

Copied

LATEST

I'm trying to adapt this code is that the original

"xml" is this

"intdev_page.xml"

<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE moreovernews SYSTEM "http://p.moreover.com/xml_dtds/moreovernews.dtd">

   <!-- by using this feed you have read and agree to our terms and conditions at

   http://w.moreover.com/site/about/termsandconditions.html

   If the presence of this comment has caused an error in your parser you may use the older

   uncommented version by using &o=xml_1 or +xml_1 in the URL. Using the xml_1 version

   still means that you have read and agree to our terms and conditions above -->

   <moreovernews>

      <article id="_35605614">

         <url>http://c.moreover.com/click/here.pl?x35605614</url>

         <headline_text>Trade and the Third World - hypocrisy in action</headline_text>

         <source>Africa Online</source>

         <media_type>text</media_type>

         <cluster>International development news</cluster>

         <tagline></tagline>

         <document_url>http://www.africaonline.com/topnews-english-rss.xml</document_url>

         <harvest_time>Apr 9 2002 11:42PM</harvest_time>

         <access_registration></access_registration>

         <access_status></access_status>

      </article>

      <article id="_35602943">

         <url>http://c.moreover.com/click/here.pl?x35602943</url>

         <headline_text>Terrorism, poverty are new foes: Macapagal</headline_text>

         <source>INQ7.net</source>

         <media_type>text</media_type>

         <cluster>International development news</cluster>

         <tagline></tagline>

         <document_url>http://www.inquirer.net</document_url>

         <harvest_time>Apr 9 2002 11:05PM</harvest_time>

         <access_registration></access_registration>

         <access_status></access_status>

      </article>

      <article id="_35598087">

         <url>http://c.moreover.com/click/here.pl?x35598087</url>

         <headline_text>E. Asia enjoying strong economic recovery, World Bank says</headline_text>

         <source>Kyodo</source>

         <media_type>text</media_type>

         <cluster>International development news</cluster>

         <tagline></tagline>

         <document_url>http://home.kyodo.co.jp/</document_url>

         <harvest_time>Apr 9 2002 9:54PM</harvest_time>

         <access_registration></access_registration>

         <access_status></access_status>

      </article>

   </moreovernews>

The end

________________________________

I gave a brief it had many "articles" with only three left.

For the case of the score that would be, many lines, just enough

have the base to read the first few lines and then go adapting

according to the elements that appear

then by what I understand has a function called Article

Calling the rest through (id, link, etc.)

but I can not see all the elements in order,

no more giving this error but this blank or sometimes shows a "0"

changes in flash I'm doing (or have some other way to view

otherwise, because then I'll make adaptations with MID and MP3

// take out if running in Flash MX:

#include "xmlnitro.as"

function part(list, id, headline, source) {

    this.list = list;

    this.id = id;

    this.headline = headline;

this.source = source;

}

function makeArray(success) {

   var i, j, mainTag, list, id, headline, source;

   if (success) {

      for (i=0; i<=moXML.childNodes.length; i++) {

         if (this.childNodes.nodeValue == null && this.childNodes.nodeName == "score-partwise") {

            mainTag = this.childNodes;

         }

      }

      for (i=0; i<=mainTag.childNodes.length; i++) {

         if (mainTag.childNodes.nodeName == "part") {

            list = mainTag.childNodes.attributes["list"];

            for (j=0; j<mainTag.childNodes.childNodes.length; j++) {

               if (mainTag.childNodes.childNodes.nodeName != null) {

                  if (mainTag.childNodes.childNodes.nodeName == "id") {

                      id = mainTag.childNodes.childNodes.firstChild.nodeValue;

                  } else if (mainTag.childNodes.childNodes.nodeName == "headline_text") {

                      headline = mainTag.childNodes.childNodes.firstChild.nodeValue;

                  } else if (mainTag.childNodes.childNodes.nodeName == "source") {

                      source = mainTag.childNodes.childNodes.firstChild.nodeValue;

                  }

               }

                  }

            thispart = new part(list, link, headline, source);

            part.push(thispart);

delete thispart;

         }

      }

      _root.gotoAndStop("showArticles");

   }

}

// articles is an array of Article objects

var part = [];

// read xml and display when loaded

moXML = new XML();

moXML.ignoreWhite = true;

moXML.onLoad = makeArray;

moXML.load("score_musical.xml");

stop();

_______________________________

The end

the file "score_musical.xml" is the 'XML' in the first post

Thanks for now but I will try to modify and will post the results.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines