Jump to content


Photo

Externally updating pages in a flash website


  • Please log in to reply
24 replies to this topic

#1 ogrekey

ogrekey

    Young Padawan

  • Members
  • Pip
  • 31 posts

Posted 26 January 2007 - 03:55 PM

I'm creating a flash website for someone and I need them to be able to update a news section theirselves, without going into the flash file and uploading it and all of that. I have tried using external text files, but it just doesn't cut it. I want to be able to create the file, upload it to the website and then be able to edit it directly from the file in the website file manager.
I know a little bit about XML and basically nothing about PHP, which I assume are the ways to go about this?
This is really important for me to do.. please help. Thanks. :)

#2 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 26 January 2007 - 07:14 PM

If you are going to update it via the website file manager, the only thing you'd need is XML. If you can't use a textfile do you want to be able to add images aswell? Well, it can all be done in XML. Here's a tutorial that should help you:
http://www.community...e.cfm?cid=D1CB3

Edited by Ben, 26 January 2007 - 07:16 PM.


#3 ogrekey

ogrekey

    Young Padawan

  • Members
  • Pip
  • 31 posts

Posted 26 January 2007 - 07:18 PM

If you are going to update it via the website file manager, the only thing you'd need is XML. If you can't use a textfile do you want to be able to add images aswell? Well, it can all be done in XML. Here's a tutorial that should help you:
http://www.community...e.cfm?cid=D1CB3


Yes, I want to be able to add images as well. I'm taking a look at the tutorial now, thanks for the link. Hopefully I'll be able to get it.

#4 ogrekey

ogrekey

    Young Padawan

  • Members
  • Pip
  • 31 posts

Posted 26 January 2007 - 07:50 PM

I tried it using the exact files and exact coding given in the download files. It works for the already made fla they provide which I downloaded and tested, but I cannot get it to work in my fla, no text shows up at all. Does the tutorial file being made in Flash 6 and mine being made in Flash 8 make any difference?

#5 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 26 January 2007 - 08:15 PM

Possibly. This tutorial which I noticed doesn't tell you to add the ignoreWhite method (probably because it wasn't available in Flash 6). You might be better off looking for a Flash 8 version. But after you create the XML object (myXML = new XML()), add this - myXML.ignoreWhite = true; . I find that this solves most of my XML issues.

Try this tutorial instead (I looked through this one and it's good :)):
http://www.spoono.co...orial.php?id=21

Edited by Ben, 26 January 2007 - 08:16 PM.


#6 ogrekey

ogrekey

    Young Padawan

  • Members
  • Pip
  • 31 posts

Posted 26 January 2007 - 09:05 PM

It works, although at first it loads "undefined" and then goes to the text I put into it.

I tried adding images, and once I did that it would only say "undefined" and not load anything of what I had put.

#7 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 27 January 2007 - 12:19 AM

Well, to add images, you'd want to lay your XML out like:
<?xml version="1.0"?>
<firstChild>
<childNode title="Title" image="Image.jpg" />
</firstChild>
Then use the loadMovie() method to load the image into an empty movieclip:
_root.createEmptyMovieClip("imageHold", getNextHighestDepth());
imageHold.loadMovie(xmlObj.firstChild.childNodes[0].attributes["image"]);

Edited by Ben, 27 January 2007 - 12:20 AM.


#8 darkson01

darkson01

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Gfx, skateboarding, playing guitar, listening to punk music and flash!

Posted 27 January 2007 - 03:43 AM

i have a simular question, how can i added say a new image to the xml without having the go into the xml document and type the info myself? is there anyway either flash or the xml document can search to see if an new image has been uploaded and place it in the flash? or is that just like beyond flash?

#9 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 27 January 2007 - 06:39 AM

Technically yes, but maybe if you intergrated PHP into it, PHP might be able to do that sort of thing (I don't know enough to actually answer that question). But I really don't see much of a benefit, I mean editing the XML is easy and quick.

#10 darkson01

darkson01

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Gfx, skateboarding, playing guitar, listening to punk music and flash!

Posted 27 January 2007 - 06:42 AM

can you generate a xml script in a php script?

#11 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 27 January 2007 - 06:43 AM

Yes, you can. And then you get Flash to treat the PHP script like an XML.

#12 darkson01

darkson01

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Gfx, skateboarding, playing guitar, listening to punk music and flash!

Posted 27 January 2007 - 06:49 AM

and chance throw ma a small example? doesn't need to doing any but it would help me alot if i could she how to do it

Edited by darkson01, 27 January 2007 - 06:51 AM.


#13 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 27 January 2007 - 07:02 AM

Ok, well lets say we're retrieving data from a database, and then we want the data to be shown in XML format:
<?php

//I won't bother using the connect to database stuff since it's only an example

//Start the XML
echo "<?xml version=\"1.0\" encode=\"UTF-8\"?>";
echo "<firstChild>";

//Selecting from table..
$query = "SELECT * FROM table ORDER BY id DESC";
//Running a while loop to retrieve everything
while($row = $mysql_fetch_array($query)) {

//Add childNodes
echo "<childNode attribute1=\"".$row["row1"]."\" attribute1=\"".$row["row1"]."\" />";

}

//Close firstChild
echo "</firstChild>";

?>

Then you'd save that file as maybe getData.php, then you would load it inside the XML object:
var myXML:XML = new XML();
myXML.ignoreWhite = true;

...

myXML.load("getData.php");

So you can see how easy it is :)

Edited by Ben, 27 January 2007 - 07:03 AM.


#14 Pax

Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 27 January 2007 - 09:56 AM

Somthing else to check out (if youre willing to drop $200 or so on it) is FlashCMS. They can actually edit a live site just by visiting it in the browser. Its pretty basic, but might we worth it for you.

#15 ogrekey

ogrekey

    Young Padawan

  • Members
  • Pip
  • 31 posts

Posted 27 January 2007 - 11:01 AM

Well, to add images, you'd want to lay your XML out like:

<?xml version="1.0"?>
<firstChild>
<childNode title="Title" image="Image.jpg" />
</firstChild>
Then use the loadMovie() method to load the image into an empty movieclip:
_root.createEmptyMovieClip("imageHold", getNextHighestDepth());
imageHold.loadMovie(xmlObj.firstChild.childNodes[0].attributes["image"]);


When the person I am making the website for wants to update a News section and type whatever and put an image or two in with that entry, will they have to type up all of that stuff? Or is there a way to get around that? He only really knows HTML like <img src=> and <Br>, and doesn't want to do the updating through me.

Edited by ogrekey, 27 January 2007 - 11:02 AM.


#16 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 27 January 2007 - 06:41 PM

Well you could turn it into a CMS, with MySQL and PHP. Then all he'd need to do would to visit the admin section, fill out the header and browse for an image, and click submit. Though you'd need to know enough PHP and MySQL for that. You can get a lot of tutorials like that around the net though.

Alternatively, I could create a simple something that he'd fill the header and the image field out, and click generate, which would generate the XML for him.

Edited by Ben, 27 January 2007 - 06:42 PM.


#17 ogrekey

ogrekey

    Young Padawan

  • Members
  • Pip
  • 31 posts

Posted 27 January 2007 - 09:28 PM

Well.. I really don't know much of anything about CMS, MySQL, PHP which I probably should learn soon... it's just a matter of a lack of time that I have to finish this website. If you could do that... I'd be so so so grateful and that would be just wonderful.

#18 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 27 January 2007 - 11:09 PM

FYI ... CMS = Content Management System, not a script ;)

I could do the generator, but not the CMS, since, well, I honestly don't want to :) Would you like the generator in either Flash or Javascript?

#19 ogrekey

ogrekey

    Young Padawan

  • Members
  • Pip
  • 31 posts

Posted 28 January 2007 - 11:26 AM

Ah, thanks for letting me know haha. :closedeyes: I'll figure that part out myself. Flash, please.

Edited by ogrekey, 28 January 2007 - 11:27 AM.


#20 darkson01

darkson01

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Gfx, skateboarding, playing guitar, listening to punk music and flash!

Posted 28 January 2007 - 02:59 PM

ben, in the example you losted for me, does the php send the data through the XML and into flash one at a time, and after each one it replaces with the next data? or does thr WHILE loop have to be worked on to do that?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users