Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Few basic Flex questions

Avatar of joy_de_vivre
joy_de_vivreFlag for Croatia asked on
PHPAdobe FlashApache Flex
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
Avatar of lexxwern
lexxwernFlag of Netherlands image

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

Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answers