Welcome, Guest. Please login or register.
Did you miss your activation email?
05/22/12, 06:11
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  General
| |-+  Flex, Air, FlashBuilder, Catalyst (Moderators: ..:: Mazhar Hasan ::.., kofi addaquay)
| | |-+  select combobox value from mysql result?
0 Members and 2 Guests are viewing this topic. « previous next »
Pages: 1 [2] Print
Author Topic: select combobox value from mysql result?  (Read 12740 times)
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #15 on: 09/29/08, 10:23 »

Constructor of your DTO class that then looks like this:

[as]
package forms.orders
{      
   
[Bindable]
   public class orders extends Object
   {
      public var date:String;
      public var status:Number
      
      public function orders(obj:Object = null){
         if(currentOrder.date) date = currentOrder.date
         if(currentOrder.status) status= currentOrder.status   
      }
   }
}
[/as]

Jorge
Logged

jarmanje
Senior Programmer
****
Posts: 334


View Profile
« Reply #16 on: 09/29/08, 12:44 »

It seems i won't get off so lightly.

Final error seems to be about my structure. but i have read about it and nothing is apparent


Location   Creation Time   Id
A file found in a source-path must have the same package structure 'forms', as the definition's package, 'forms.orders'.   adman2/src/forms   orders.as   
Logged
jarmanje
Senior Programmer
****
Posts: 334


View Profile
« Reply #17 on: 09/30/08, 17:56 »

Can i just check, this code is 100% correct?
It gives me this frustrating error:

1172: Definition forms.Orders:orders could not be found.   adman2/src   main.mxml


(inside folder 'forms') Orders.as
Code:
package forms.Orders
{     
   
[Bindable]
   public class orders extends Object
   {
      public var date:String;
      public var status:Number
     
      public function orders(obj:Object = null){
         if(currentOrder.date) date = currentOrder.date
         if(currentOrder.status) status= currentOrder.status   
      }
   }
}


inside <![CDATA[ of main.mxml
Code:
import forms.Orders.orders
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #18 on: 09/30/08, 21:19 »

Should be inside forms/Orders/orders.as

Jorge
Logged

jarmanje
Senior Programmer
****
Posts: 334


View Profile
« Reply #19 on: 10/01/08, 06:00 »

I'm going to have to try with this other method and wait for your tutorial. I can't get past the errors.

Now it won't let me call function          
Code:
import forms.Orders.Orders
public var myOrder:orders = new orders({})

I'm going to try to just catch the null value error:

Code:
<mx:DateField id = "orderdate" formatString="YYYY-MM-DD" width="170" showToday="true" text ="getDate()"/>


private function getDate():String
{
    if(currentOrder.orderid==0){
       
        return (new Date()).toString();
   
    } else {
    return currentOrder.date;
    }

}

The function does not get called at the moment. It will just say getDate() inside the text.
« Last Edit: 10/01/08, 06:02 by jarmanje » Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #20 on: 10/01/08, 06:10 »

Databinding works based on some property (like my example)

text="{orderInfo.date}"

You can supply current date in the logic of your DTO. or when fulfilling it, but not using a function as databinding

Jorge
Logged

jarmanje
Senior Programmer
****
Posts: 334


View Profile
« Reply #21 on: 10/01/08, 06:57 »

I really want to use your method but i can't

if i use this way to define the var

Code:
public var myOrder:orders = new orders({});

it gives me the error:

1046: Type was not found or was not a compile-time constant: orders.   adman2/src/forms   OrderForm.mxml

and if i use this way

Code:
public var myOrder:Orders = new orders({});

i get the error:

A file found in a source-path 'Orders' must have the same name as the class definition inside the file 'orders'.   adman2/src/forms/Orders   Orders.as


i'm tantalizingly close

Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #22 on: 10/01/08, 07:28 »

Basic task: import and instantiate a class
The class should be in a path that reflects his package (com.flashdb.utils is com/flashdb/utils), and the name of the Class is the same as the as file, accesible from the source folder where you compile. External libraries path should be added rigth clicking in the Flex Project and editing the compiler path
Work around this, is like ABC of programming

Jorge
Logged

jarmanje
Senior Programmer
****
Posts: 334


View Profile
« Reply #23 on: 10/01/08, 11:25 »

ok cool. followed the tutorial and got the class working.

now trying to fix that the class cannot read the currentOrder var, says its undefined

im going to try to replicate this

http://nwebb.co.uk/nwebb_example_code/basic_architecture_example/srcview/index.html
« Last Edit: 10/01/08, 12:04 by jarmanje » Logged
jarmanje
Senior Programmer
****
Posts: 334


View Profile
« Reply #24 on: 10/01/08, 12:38 »

Hows it possible for my class to access the Object in my mxml file?

1120: Access of undefined property currentOrder.   adman2/src/classfolder   MyClass.as


at this point, the values are fed into the currentOrder Object inside the file OrderForm.mxml. I cannot access it as usual with OrderForm.currentOrder



Logged
jarmanje
Senior Programmer
****
Posts: 334


View Profile
« Reply #25 on: 10/06/08, 09:23 »

As i couldnt get the classes to work properly, i'll wait for your tutorial to understand it better.

I have a workaround code:
Code:
<mx:DateField id = "orderdate" formatString="YYYY-MM-DD" width="170" showToday="true" text = "{currentOrder.orderid==0 ? new Date().toDateString() : currentOrder.date}"/>

I need the output to be "YYYY-MM-DD", but it is not as simple as Date().toDateString("YYYY-MM-DD")

is there a way to work around this and achieve the custom format?
Logged
Pages: 1 [2] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!