473,387 Members | 1,365 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

changing actionscript to read php/mysql instead of xml

anfetienne
424 256MB
is it possible to change the below code so it reads arrays that php creates and uses it to display the images and captions instead of reading from xml? the purpose of this is because there is not actual html as all codes are stored in a db and all images and clips etc are linked in using http:// links instead of your local /image.jpg etc

i know the main focus is from lines 5 to 9

Expand|Select|Wrap|Line Numbers
  1.     function loadXML(loaded)
  2.     {
  3.         if (loaded)
  4.         {
  5.             xmlNode = this.firstChild;
  6.             total = xmlNode.childNodes.length;
  7.             for (i = 0; i < total; i++)
  8.             {
  9.                 _root.small_image[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
  10.                 _root.big_image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
  11.                 _root.description[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
  12.                 if (i == 0)
  13.                 {
  14.                     _root.loadGImage(_root.description[i], _root.big_image[i]);
  15.                 } // end if
  16.                 ++_root.total_images;
  17.             } // end of for
  18.             createSmall();
  19.             _root.downloadButton._visible = true;
  20.         }
  21.         else
  22.         {
  23.             content = "file not loaded!";
  24.         } // end else if
  25.     } // End of the function
  26.     xmlData = new XML();
  27.     xmlData.ignoreWhite = true;
  28.     xmlData.onLoad = loadXML;
  29.     if (_root.xml_file == undefined)
  30.     {
  31.         _root.xml_file = "images.xml";
  32.     } // end if
  33.     xmlData.load(xml_file);
  34. } // End of the function
  35.  
Jul 18 '09 #1
3 3143
root.xml_file = "images.php";



php do you press the screen, I let my skin again attribution xml server
Jul 18 '09 #2
anfetienne
424 256MB
@flexteacher
i dont understand what you mean?
Jul 20 '09 #3
gopan
41
Dear anfetienne,
I hope you know that the flash cannot directly take data from mysql. it can take data as xml or variables... in case of large data we prefer xml.

So all you have to do is to echo the data with a php as an xml. You see the below example...

Expand|Select|Wrap|Line Numbers
  1. newsfeed.php
  2.  
  3. <?php 
  4.  header('Content-Type: text/xml');
  5.  echo '<?xml version="1.0"?>
  6. <doc xml:base="http://thenewsflash.net/" xmlns:xlink="http://www.w3.org/1999/xlink">';
  7.  $query = "SELECT ddate,heading,matter FROM news ORDER BY ddate DESC";
  8.  $result = mysql_query($query,$link) or die('Fatal error occured! Inform <a href="mailto:webmaster@thenewsflash.net">webmaster</a>');
  9.  $rec = mysql_num_rows($result);
  10.  echo ' <news totrec="'.$rec.'">';
  11.  $i= 1;
  12.  while ($row = mysql_fetch_assoc($result)) {
  13.     $matq=$row["matter"];
  14.     $matq=str_replace ("\r\n","<br>",$matq);
  15.     $matq=htmlspecialchars($matq,ENT_QUOTES);
  16.     echo '  <newsrow id="'.$i.'" heading="'.$row["heading"].'" date="'.$ddate.'" mattr="'.$matq.'"/>';
  17.     $i++;
  18.  }
  19.  mysql_free_result($result);
  20.  mysql_close($link);
  21.  echo ' </news>
  22. </doc>';
  23. ?>
  24.  
and replace xmlData.load("newsfeed.xml") to xmlData.load(newsfeed.php)
Aug 14 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Steven Buroff | last post by:
Is there any way to get MySQL to create the directory for a new database in a specified directory instead of its "data" directory?
4
by: Good Man | last post by:
Hi there I have a database with about 20 or so tables, maybe a few thousand rows in each. I am starting to do more complex things with my insertions etc, and I want to start to use...
3
by: paolazi | last post by:
Hello I have a problem: I have a database(mysql) with the following fields: test, descr, title I want to display them into a flash file. Now my php file called list.php (which collect the...
0
by: flaviosemeao | last post by:
I am new in Flash, and I already read two Adobe Official Books regarding actionscript 2.0 and I have a big questions for you guys who know much more than me. How can I draw basic forms like a...
0
by: grouchy | last post by:
Hello everyone, hope u r all well. Got a bit of a simple question. I have a textArea box (mesgArea.text) where a user can write a simple message and then press a send button ("sendMsg"). All i...
8
by: Zarwadi | last post by:
Hi, I have been creating a simple flash site and I need to use PHP and MySql, which I have never done. And I really need help. I've created a database but I can't get my action script to send my...
3
by: Zarwadi | last post by:
Hi, I have been creating a simple flash site and I need to use PHP and MySql, which I have never done. And I really need help. I've created a database but I can't get my action script to send my...
1
by: cyra | last post by:
Hi guys, this is the first time I post in our forum, I would like to say thanks to whom reading this. I'm new to ASv3 and in stuck of dealing with a problem like this : I have some .fla file...
4
nathj
by: nathj | last post by:
Hi, Well the title of the thread is the question. I have tried searching for this and after several days of getting nowhere with it I decided I would ask. So here's the deal. I am using Flash...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.