is it me or is the send button not working in the preview version?
Here is an 'other free utilities for Flash CS3 created by FlepStudio.
Since the previous Guest Book, despite having a big success was a little cumbersome, I well thought of creating a new simple Guest Book Flash CS3 + and PHP mySQL.
This time was created with dimensions far more appropriate and is also prepared to be loaded into another SWF without having to change the code.
If you want to load it into your SWF root of your site or application or the site of your clients, just create the logics on your main FLA to load it and the game is made.
Easy to install, will certainly be a greatly appreciated resource for those of you need a classic Guest Book without many "frills":)
Installation
- Open the file configuration.php and change the setting for access to your database.
- Upload the PHP folder on your server in a folder in which you wish to install the Guest Book
- Go with the brower to address where is located PHP/install.php that you just uploaded
- Delete the file PHP/install.php from the server
- Open the file main.fla
- Open the file LoadingXML.as at line 22 and enter the absolute url of file PHP/getMessages.php you just uploaded
- Open the file SendMessage.as and rows 17 and 18 enter the absolute urls of files PHP/gettime.php and PHP/storeMessage.php you just uploaded
- Re-create the SWF by main.fla and GuestBook is already working
- Upload the new main.swf to server
Result
Description
GuestBook - Flash CS3 - PHP - mySQL
File packages
main.fla
package org.FlepStudio
package caurina ( Tweener by Zeh Fernando )
package PHP ( with all PHP files )
Last edited by Flep; 06-10-08 at 12:52.
is it me or is the send button not working in the preview version?
nah, its not working with me either
looks alright tho
Sorry guys, I am fixing the bug.
Yeah send button wont work
But its look cool
Ok,
problem was with "<" and ">" characters.
I added a control and they are not allowed.
Re- download the files or do the following:
change Main.as with the following:
Re-create the SWF.Code:/* ************************************* Flash CS3 Simple Guestbook http://www.flepstudio.org © Author: Filippo Lughi version 1.0 ************************************* */ package org.FlepStudio { import flash.display.*; import flash.events.*; import flash.text.*; import flash.utils.*; import flash.ui.*; import flash.net.*; import caurina.transitions.Tweener; public class Main extends MovieClip { private var file_xml:LoadingXML; public var messages_array:Array; private var timer:Timer; private var trick_mc:MovieClip; private var apple_mc:Apple; private var boo:Boolean=true; public function Main() { addEventListener(Event.ADDED_TO_STAGE,init); } private function init(evt:Event):void { removeEventListener(Event.ADDED_TO_STAGE,init); initMenu(); stage.frameRate=31; area_txt.editable=false; form_mc.name_txt.border=true; form_mc.name_txt.borderColor=0x999999; form_mc.name_txt.background=true; form_mc.name_txt.backgroundColor=0x999999; form_mc.name_txt.textColor=0xFFFFFF; form_mc.mess_txt.border=true; form_mc.mess_txt.borderColor=0x999999; form_mc.mess_txt.background=true; form_mc.mess_txt.backgroundColor=0x999999; form_mc.mess_txt.textColor=0xFFFFFF; loadXML(); } private function loadXML():void { file_xml=new LoadingXML(this); } public function displayMessages():void { messages_array.reverse(); displayText(); addButtonListener(); } private function displayText():void { var final:String=""; for(var i:int=0;i'+""+messages_array[i].date+""+ ""+"\n"+""+''+messages_array[i].name+""+ ""+''+" says :"+""+"\n"+ ''+messages_array[i].mess+""+"\n\n"; } area_txt.htmlText=final; } private function addButtonListener():void { form_mc.send_mc.mouseChildren=false; form_mc.send_mc.buttonMode=true; form_mc.send_mc.addEventListener(MouseEvent.MOUSE_DOWN,checkFields); } private function checkFields(evt:MouseEvent):void { if(form_mc.name_txt.text!="") { if(form_mc.mess_txt.text!="") { sendMessage(); } else { noMessage(); removeError(); } } else { noName(); removeError(); } } private function removeError():void { timer=new Timer(2000,1); timer.addEventListener(TimerEvent.TIMER,resetErrorField); timer.start(); } private function resetErrorField(evt:TimerEvent):void { form_mc.error_txt.text=""; boo=true; } private function noString():void { form_mc.error_txt.text=">< NOT SUPPORTED"; } private function noName():void { form_mc.error_txt.text="UNDEFINED NAME"; } private function noMessage():void { form_mc.error_txt.text="UNDEFINED MESSAGE"; } private function sendMessage():void { var s:String=form_mc.mess_txt.text; for(var j:int=0;j ") { boo=false; noString(); removeError(); break; } } if(boo) { onSending(); var message_sender:SendMessage=new SendMessage(this); } } private function onSending():void { trick_mc=new MovieClip(); trick_mc.alpha=0; trick_mc.graphics.beginFill(0xFFFFFF,1); trick_mc.graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight); addChild(trick_mc); Tweener.addTween(trick_mc,{alpha:0.8,time:0.4,transition:"linear"}); apple_mc=new Apple(); apple_mc.width=40; apple_mc.height=40; apple_mc.alpha=0.7; apple_mc.x=stage.stageWidth/2-apple_mc.width/2; apple_mc.y=stage.stageHeight/2-apple_mc.height/2; addChild(apple_mc); } public function successSending():void { apple_mc.stop(); removeChild(apple_mc); Tweener.addTween(trick_mc,{alpha:0,time:0.4,transition:"linear",onComplete:removeTrick}); } private function removeTrick():void { refresh(); removeChild(trick_mc); } public function refresh():void { messages_array=new Array(); area_txt.text=""; form_mc.name_txt.text=""; form_mc.mess_txt.text=""; loadXML(); } public function initMenu():void { var etichetta:String='Flash CS3 GuestBook'; var cm:ContextMenu=new ContextMenu(); var item:ContextMenuItem=new ContextMenuItem(etichetta); cm.hideBuiltInItems(); cm.customItems.push(item); item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,itemHandler1); this.contextMenu=cm; } private function itemHandler1(event:ContextMenuEvent):void { var url:String='http://www.flepstudio.org/'; var request:URLRequest=new URLRequest(url); navigateToURL(request,'_parent'); } } }
Change getMessages.php with the following:
PHP Code:<?php
/*
*************************************
Flash CS3 Simple Guestbook
http://www.flepstudio.org
Author: Filippo Lughi
version 1.0
*************************************
*/
include('configuration.php');
$mysql = mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname);
$Query="SELECT * from simple_guestbook";
$Result=mysql_query( $Query );
$Return="<?xml version=".'"1.0"'." encoding=".'"UTF-8"?>'."\n"."<items>";
while($item=mysql_fetch_object($Result))
{
$Return.="<item><id>".$item->ID."</id><name>".$item->name."</name><message>"."<![CDATA[".$item->message."]]>"."</message><date>".$item->date."</date></item>";
}
$Return.="</items>";
mysql_free_result($Result);
echo ($Return)
?>
Last edited by Flep; 15-05-08 at 06:08.
you also forgot to add < > here"![CDATA[".$item->message."]]"
i get an ![CDATA[ in front of my message???? how to fix?
Replace getMessages.php with this:
PHP Code:<?php
/*
*************************************
Flash CS3 Simple Guestbook
http://www.flepstudio.org
Author: Filippo Lughi
version 1.0
*************************************
*/
include('configuration.php');
$mysql = mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname);
$Query="SELECT * from simple_guestbook";
$Result=mysql_query( $Query );
$Return="<?xml version=".'"1.0"'." encoding=".'"UTF-8"?>'."\n"."<items>";
while($item=mysql_fetch_object($Result))
{
$Return.="<item><id>".$item->ID."</id><name>".$item->name."</name><message>"."<![CDATA[".$item->message."]]>"."</message><date>".$item->date."</date></item>";
}
$Return.="</items>";
mysql_free_result($Result);
echo ($Return)
?>
Bookmarks