Limit variables on Flash with PHP

I was working with login script using the usual code I used to use for always

loadVariableNum(“test.php”,0,”POST”);

kinda nice but wait wait wait, what is this doing? loading all the root variables and spreading php variables on root randomly, HELL that is a real mess? it even didnt work in some cases (like my case today with my XML Flash file)
but yes as usual alot of search and alot of do. I got it to work perfectly with this very very clean code
Send and Load (To send specific variables to PHP) and Get Specific one back.
so here it is

on (release, keyPress ““) {
if (_root.user != “” && _root.pass != “”) {
_root.text=”Connecting..”;
//result_lv to get variables from php
var result_lv:LoadVars = new LoadVars();
//set_lv to post variables to php
var set_lv:LoadVars = new LoadVars();
set_lv.user = _level0.user;
set_lv.pass = _level0.pass;
set_lv.sendAndLoad(“newlogin.php”,result_lv,”POST”);
result_lv.onLoad = function(success:Boolean) {
if (success) {
if (result_lv.checklog == 1) {
_root.text=”Congrat you are logged”;
}
else
{
_root.text=”Sorry no such user name or password”;
}

} else {
_root.text=”Could Not Connect”;

}

};
}
}

I know this is flash thing but if you still curious about the php part then here it is

$user=$_POST['user'];
$pass=$_POST['pass'];
if ($user && $pass){
mysql_connect(“localhost”,”root”,”");
mysql_select_db(“database”);

$query = “SELECT * FROM users WHERE username = ‘$user’ AND password = md5(‘$pass’)”;
$result = mysql_query( $query ) ;

$num = mysql_num_rows( $result );
if ($num == 1){
print “status=You’re in&checklog=1″;
} else {
print “status=Sorry!&checklog=2″;
}
}

Basic Reminder of how to create Joomla Component

Front End : Lets assume our component is called gold

1- Create a sub folder for the component folder call it com_gold

2- Create a file called gold.php inside of it (Known as Entry Point)

<?php
defined(‘_JEXEC’) or die(‘Restricted access’);

require_once( JPATH_COMPONENT.DS.‘controller.php’ );

if($controller = JRequest::getWord(‘controller’)) {

$path = JPATH_COMPONENT.DS.‘controllers’.DS.$controller.‘.php’;

if (file_exists($path)) {

require_once $path;

} else {

$controller = ;

}

}

$classname = ‘goldController’.$controller;

$controller = new $classname( );

$controller->execute( JRequest::getVar( ‘task’ ) );

$controller->redirect();

?>
?>

Back End :

1- Create a sub folder for the administrator/components folder call it com_gold

2- Create a file called admin.gold.php inside of it

Now you can Access the Component

http://localhost/joomla/index.php?option=com_gold

——————

Adding :

1- Controller to Front End : The controller is responsible for responding to user actions

create a file called controller.php inside com_gold

<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport('joomla.application.component.controller');
class GoldController extends JController
{
    function display()
    {
        parent::display();
    }

}
?>

2- View to Front End : part of the component that is used to render the data from the model in a manner that is suitable for interaction

create views/gold/gold.html.php inside com_gold

<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.application.component.view');
class GoldView extends JView
{
    function display($tpl = null)
    {
        $sentence = "Gold Component";
        $this->assignRef( 'sentence', $sentence );

        parent::display($tpl);
    }
}
?>

2- Template to Front End :

create views/gold/tmpl/default.php inside com_gold

<?php // no direct access
defined('_JEXEC') or die('Restricted access'); ?>
<h1><?php echo $this->greeting; ?></h1>


Writing Arabic in Flash, and Fixing Multiline Issue!

Yes Finally. Writing Arabic in Flash and using XML!! Weheeeeeee.

I’m excited about it because this was my concern for years and years and yesterday taraaa! I found the extension that worked perfectly!

The main feature of this extension is the ability to embed fonts and the ability to have multiple lines.

its made for Flash 8 and works for ActionScript2. I have flash CS3 and it worked fine too (>.>; since I still use ActionScript *coughs coughts*) anyways the extension is called Flaraby3 there is a lite version for free and a paid version for 30$.

So far the Lite version works perfectly for me and you can download it and see the video tutorial from here.

http://www.arabicode.com/flaraby/flash_arabic_support.php#license

Hope this will help you.
Good Luck!

Return top

INFORMATION

Change this sentence and title from admin Theme option page.