troubleshooting Question

Few basic Flex questions

Avatar of joy_de_vivre
joy_de_vivreFlag for Croatia asked on
Adobe FlashApache FlexPHP
5 Comments1 Solution661 ViewsLast Modified:
Hello.
I have lots of dilemmas regarding Adobe Flex since I am new in that programming language so I would like you to help me with this. I will compare everything with php/mysql because it's the easiest way to describe what my dilemma is about...

So, my first question is:
when I use php, I like to use lots of 'include' statements in my 'application'. For example, my index.php page usually looks like this:

<?
include("includes/session.php");
include("includes/html_header.php");

if($session->logged_in){
      include ('in/menu.php');
      include ('in/details.php');
      include ('in/other_menu.php');

      if (isset($_GET['c'])) {
            $page = $_GET['c'];
            include ('in/'.$page.'.php');
      } else {
            include ('in/info.php');
      }
} else {
      include ('login_form.php');
}
?>

It doesn't matter what this script does, important thing is that I found some 'flexibility' here and I easily manage everything in my application. I know that Flex can work the same way but I also know that there are few ways to accomplish what I need. For example, I could do it with <mx:State> (and I think it is the most similar to my include() stuff from php), next, I could do  it with  <mx:ViewStack> but I'm not sure if I can 'include' my file in each stack? Then, I can do it with <mx:ToggleButtonBar> etc etc etc.

What is the best option for me here considering that I need to pass variables all around my 'includes'?


Second question:
If i choose to use <mx:State> method for my needs, and in each <mx:State> I include a custom component, how do i send requests from one custom component to another, or to my main application?
For example, i have a page.mxml with some form and a button:
<mx:Button label="submit" id="submitButton"click="login.send();" />
but my HTTPService is in main application file and it looks like this:
<mx:HTTPService id="login" result="something(event)" method="POST" url="some.php"/>
Here I get an error on button which says
1120: Access of undefined property login_user
But if I put exactly same form and button inside my <mx:State> in main application (not including it as a custom component) everything works fine. I am generally confused about that =)


Third question:
Is there a 'standard' iterating through results in Flex? (this probably sounds stupid but I will try to explain)
In php I would use this code to iterate through results:
<?
while($row = mysql_fetsch_array($query)){
      echo $row['blah']
}
?>
I know that there is an thing in Flex which is used for that (dataProvider) but what if I want to get some results from XML and display them as few <mx:Label> which cannot use dataProvider option?


Fourth (and final) quesion:
What is the best way to handle all my queries if I use mysql as my database? For now I made few php files which get data from mysql and generates XML output which I use in Flex. I hope that there is other way than creating php files for each custom query I need. I also wonder how do I insert, update and delete records from mysql with Flex?


I hope you will find some time to explain me even a single thing from my list of mega-noobish questions =)
Thank you for your patience and effort to make me understand these basics =)
ASKER CERTIFIED SOLUTION
lexxwern

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros