Re: [flexcoders] Re: Using arraycollection as text for a flex TextArea Component.

Tuesday, December 27, 2011

 

Either the whole entry is null or one of it's properties. Check which is null, and guard your code if null put empty string or whatever you seem fit for it.

C


From: ZIONIST <stinasius@yahoo.com>
To: flexcoders@yahoogroups.com
Sent: Tuesday, December 27, 2011 5:41 PM
Subject: [flexcoders] Re: Using arraycollection as text for a flex TextArea Component.

 
That works well. It actually outputs the contents of the arraycollection in the textarea component. One very small issue though, it outputs the word NULL before the last item in the arraycollection. How do i get rid of that?

Below is the update.

[Bindable]
private var orderColl:ArrayCollection=new ArrayCollection();

/*** Create an object to hold the data ***/
var obj:Object=new Object();

/*** Assign the variables to it ***/
obj.Product=product.text;
obj.Price=price.text;
obj.Qty=1;
obj.OrderNumber=label1.text;

/*** Add the object to the list ***/
orderColl.addItemAt(obj, 0);

Then i have a TextArea component (id=cart) and i try to assign the arraycollection to it as text like this

var txt:String;
var n:int=orderColl.length;
for (var i:int=0; i < n; i++)
{
var entry:Object=orderColl.getItemAt(i);
txt += entry.OrderNumber + "," + " " + entry.Product + "," + " " + entry.Qty + " " + "Unit" + "(" + "s" + ")" + "," + " " + "$" + entry.Price + " " + "per unit" + "\n\n";
}
cart.text = txt;



__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

[Windows Azure] Tution For Android Development

 

Asalam o alikum,
Tuition available for Android Development. If anyone Interested, then contact on +92-333-242-6711 for more details.
Thanks

__._,_.___
Recent Activity:
Cloud Computing Education: http://www.OperationBadar.net
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

[flexcoders] Re: Using arraycollection as text for a flex TextArea Component.

 

That works well. It actually outputs the contents of the arraycollection in the textarea component. One very small issue though, it outputs the word NULL before the last item in the arraycollection. How do i get rid of that?

Below is the update.

[Bindable]
private var orderColl:ArrayCollection=new ArrayCollection();

/*** Create an object to hold the data ***/
var obj:Object=new Object();

/*** Assign the variables to it ***/
obj.Product=product.text;
obj.Price=price.text;
obj.Qty=1;
obj.OrderNumber=label1.text;

/*** Add the object to the list ***/
orderColl.addItemAt(obj, 0);

Then i have a TextArea component (id=cart) and i try to assign the arraycollection to it as text like this

var txt:String;
var n:int=orderColl.length;
for (var i:int=0; i < n; i++)
{
var entry:Object=orderColl.getItemAt(i);
txt += entry.OrderNumber + "," + " " + entry.Product + "," + " " + entry.Qty + " " + "Unit" + "(" + "s" + ")" + "," + " " + "$" + entry.Price + " " + "per unit" + "\n\n";
}
cart.text = txt;

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Re: [flexcoders] Resize and Scale Window Content

 

Find below an exemple:

<?xml version="1.0" encoding="utf-8"?>
<windowSkin:wCustomWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
                          xmlns:s="library://ns.adobe.com/flex/spark"
                          xmlns:mx="library://ns.adobe.com/flex/mx"
                          skinClass="fr.isoe.ui.windowSkin.CustomWindowSkin"
                          resizable="true"
                          creationComplete="wcustomwindow1_creationCompleteHandler(event)"
                          xmlns:windowSkin="fr.isoe.ui.windowSkin.*"
                          minWidth="400" minHeight="300"
                          width="400" height="300"
                          resize="wcontact_resizeHandler(event)"
                          xmlns:customNavTab="fr.isoe.component.customNavTab.*"
                          xmlns:componentGlob="fr.isoe.ui.componentGlob.*">
    <fx:Declarations>
        <!-- Placer ici les éléments non visuels (services et objets de valeur, par exemple). -->
    </fx:Declarations>


    <fx:Script>
        <![CDATA[
            import fr.isoe.config.urlManager;
            import fr.isoe.ui.componentGlob.IconManager;
            import fr.isoe.util.FileSerializer;
            import fr.isoe.util.UserPrefs;
            import fr.isoe.util.windowPlace;
            import fr.kapit.flex.ui.spark.loginBox.RetrievePasswordSkin;
           
            import mx.controls.Button;
            import mx.events.FlexEvent;
            import mx.events.ItemClickEvent;
            import mx.events.ResizeEvent;
            import mx.rpc.events.FaultEvent;
            private var pg:UserPrefs;
           
            private var glossObject:Object={label:"Glossaire", icon:IconManager.bhGlossaire};
            private var allObject:Object={label:"Tout Afficher", icon : IconManager.bhAll};
            private var searchObject:Object={label:"Rechercher", icon : IconManager.bhSearch};
            private var triObject:Object = {label:"Trier", icon : IconManager.bhChart};
            private var printObject:Object={label:"Imprimer", icon : IconManager.bhPrint};
            private var plusObject:Object={label:"Ajouter", icon : IconManager.bhAdd};
            private var editObject : Object = {label:"Editer", icon:IconManager.bhEdit};
            private var trashObject:Object={label:"Supprimer", icon : IconManager.bhTrash};
            private var delObject:Object = {label:"Fermer", icon : IconManager.bhDel};
            private var validObjet:Object = {label:"Valider", icon : IconManager.bhValid};
           
           
            [bindable]
            public var buttons:Array = [glossObject, allObject, searchObject,triObject, printObject, plusObject,editObject, trashObject, delObject, validObjet];
           
            private var _selectedPatient:String;
            private var _patientNomPrenom : String;
            private var _patientNaissance:String;
           
            private var dpContactPat:XMLList;
           
            protected function changeBbHandler(event:ItemClickEvent):void
            {
                var selection:int = event.index;
               
                trace ("index " +selection);
                switch(selection)
                {
                    // affichage des formulaires à coder
                    case 7:
                    {
                        closeMyWindow();
                        break;
                    }
                   
                    case 8:
                    {
                        closeMyWindow();
                        break;
                    }
                   
                }
            }
           
            private function closeMyWindow():void
            {
                stage.nativeWindow.dispatchEvent(new Event("myEventClose", true));
                stage.nativeWindow.close();
            }
           
            private function onMyEventClose(e:Event):void
            {
                pg = new UserPrefs();
                this.pg.appPosX = stage.nativeWindow.x;
                this.pg.appPosY = stage.nativeWindow.y;
                this.pg.appWidth = stage.nativeWindow.width;
                this.pg.appHeight = stage.nativeWindow.height;
                FileSerializer.writeObjectToFile(this.pg, "prefNotesPat.up");
           
            }
           
            private function serviceFault(event:FaultEvent):void
            {
                trace("Erreur "+ event.fault.message);
            }
           
            protected function wcustomwindow1_creationCompleteHandler(event:FlexEvent):void
            {
                this.titleDisplay.text = "Liste des Contacts";
                // suite lancement
                stage.nativeWindow.addEventListener("myEventClose",onMyEventClose);
                var pos:windowPlace = new windowPlace("prefNotesPat.up");
                stage.nativeWindow.x = pos.windowX;
                stage.nativeWindow.y = pos.windowY;
                stage.nativeWindow.height = pos.windowH;
                stage.nativeWindow.width = pos.windowW;
                mainConteneur.left = 7;
                mainConteneur.right = 7;
                mainConteneur.top = 5;
               
                mainConteneur.percentWidth = 100;
                mainConteneur.percentHeight = 100;
                /* trace("mainConteneur" + mainConteneur.width+"/"+this.width);
                trace("stage" + stage.nativeWindow.width); */
               
               
               
               
                // inactive le bouton fermer
                Button(tbbAction.getChildAt(0)).enabled = false;
                Button(tbbAction.getChildAt(1)).enabled = false;
                Button(tbbAction.getChildAt(2)).enabled = false;
                Button(tbbAction.getChildAt(3)).enabled = false;
                Button(tbbAction.getChildAt(4)).enabled = false;
                Button(tbbAction.getChildAt(5)).enabled = false;
                Button(tbbAction.getChildAt(6)).enabled = false;
               
               
               
                var urlPat : urlManager = new urlManager();
                //phpPatientService.url = urlPat.urlService()+"35LoadNotesA.php";
           
           
            }
           
            public function get selectedPatient():String
            {
                return _selectedPatient;
            }
           
            public function set selectedPatient(value:String):void
            {
                _selectedPatient = value;
            }
           
            public function get patientNomPrenom():String
            {
                return _patientNomPrenom;
            }
           
            public function set patientNomPrenom(value:String):void
            {
                _patientNomPrenom = value;
            }
           
            public function get patientNaissance():String
            {
                return _patientNaissance;
            }
           
            public function set patientNaissance(value:String):void
            {
                _patientNaissance = value;
            }
           
           
           
           
            protected function wcontact_resizeHandler(event:ResizeEvent):void
            {
                // TODO Auto-generated method stub
                this.updateDisplayList(this.width, this.height);
           
            }

        ]]>
    </fx:Script>

    <s:VGroup id="mainConteneur" left="7" right="7" top="5" bottom="0" horizontalAlign="center"
              paddingBottom="0" paddingLeft="10" paddingRight="10" >
        <s:HGroup width="100%" height="53" id="titleWin">

            <s:Image x="0" y="0" width="53" height="53" />

            <s:VGroup width="40%">
                <s:HGroup width="100%" height="50%">     <!-- Nom prenom-->
                    <s:Label text="{_patientNomPrenom}" id="lNomPrenom" fontWeight="bold"/>
                </s:HGroup>

                <s:HGroup width="100%" height="50%">     <!-- Naissance-->
                    <s:Label text="{_patientNaissance}" id="lNaissance" />
                </s:HGroup>   

            </s:VGroup>

            <s:VGroup width="40%">     <!-- Modif-->

                <s:Label id="ldhCrea"
                         textAlign="left" styleName="dataCreaModif"/>
                <s:Label id="ldhModif"
                         textAlign="left" styleName="dataCreaModif"/>
            </s:VGroup>

        </s:HGroup>



        <s:Group height="100%" width="100%">

            <s:layout>
                <s:VerticalLayout/>
            </s:layout>
            <!-- partie centrale-->
            <s:DataGrid id="dgContactPat" width="100%" height="100%"
                        editable="false" fontWeight="normal">
                <s:columns>
                    <s:ArrayList>
                        <s:GridColumn dataField="ctId" headerText="" sortDescending="false" width="15"  visible="false"/>
                        <s:GridColumn dataField="ctRelation" headerText="Relation" sortDescending="false" />
                        <s:GridColumn dataField="ctNom" headerText="Correspondant" sortDescending="false" />
                        <s:GridColumn dataField="ctSpec" headerText="Spécialité" sortDescending="false" />
                        <s:GridColumn dataField="ctTel" headerText="Tél" sortDescending="false" />
                        <s:GridColumn dataField="ctFax" headerText="Fax" sortDescending="false" />
                        <s:GridColumn dataField="ctCP" headerText="CP" sortDescending="false" />
                        <s:GridColumn dataField="ctVille" headerText="Ville" sortDescending="false" />
                        <s:GridColumn dataField="ctadr" headerText="Adr" sortDescending="false"  visible="false"/>
                        <s:GridColumn dataField="ctMail" headerText="Mail" sortDescending="false"  visible="false"/>
                        <s:GridColumn dataField="ctNote" headerText="Notes" sortDescending="false"  visible="false"/>
                    </s:ArrayList>
                </s:columns>   
            </s:DataGrid>

            <s:HGroup width="100%">
                <s:Label text="Adresse"/>
                <mx:Text text ="{dgContactPat.selectedItem.ctadr}"/>
            </s:HGroup>

            <customNavTab:IconToggleButtonBar id="tbbAction" height="30"
                                              dataProvider="{buttons}"
                                              itemClick="changeBbHandler(event)" labelPlacement="bottom"
                                              paddingBottom="2" selectedIndex="-1" toggleOnClick="false"
                                              horizontalAlign="center"
                                              bottom="3"
                                              width="100%"/>
        </s:Group>


    </s:VGroup>



</windowSkin:wCustomWindow>


Le 27/12/11 16:09, claudiu ursica a écrit :

 
Can you show some code?
C


From: Isabelle Loyer Perso <isa_loyer@yahoo.fr>
To: flexcoders@yahoogroups.com
Sent: Tuesday, December 27, 2011 3:51 PM
Subject: Re: [flexcoders] Resize and Scale Window Content

 
Hi,
I have the same problem.
I use groupe with percent height and width. But this doesn't work if window is resize by as3 script during creationcomplete phase.
If someone has an idea?
thanks

Le 27/12/11 07:54, Asad Zaidi a écrit :
 
you can acheive it using Grid control also. depends upon your requirement.
 
Zaidi

From: claudiu ursica <the_braniak@yahoo.com>
To: "flexcoders@yahoogroups.com" <flexcoders@yahoogroups.com>
Sent: Tuesday, December 27, 2011 3:28 AM
Subject: Re: [flexcoders] Resize and Scale Window Content

 
In theory yes, by using percent width and height for components, in practice how much works out of the box depeds on every particular case.

C

From: hkondylk <kondylak@gmail.com>
To: flexcoders@yahoogroups.com
Sent: Monday, December 26, 2011 5:35 PM
Subject: [flexcoders] Resize and Scale Window Content

 
Hello,

I want to be able to resize my Window and the content to scale as the window resizes. Is this possible or do you have an example?

THanks in advnace.







__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Re: [flexcoders] Resize and Scale Window Content

 

Can you show some code?
C


From: Isabelle Loyer Perso <isa_loyer@yahoo.fr>
To: flexcoders@yahoogroups.com
Sent: Tuesday, December 27, 2011 3:51 PM
Subject: Re: [flexcoders] Resize and Scale Window Content

 
Hi,
I have the same problem.
I use groupe with percent height and width. But this doesn't work if window is resize by as3 script during creationcomplete phase.
If someone has an idea?
thanks

Le 27/12/11 07:54, Asad Zaidi a écrit :
 
you can acheive it using Grid control also. depends upon your requirement.
 
Zaidi

From: claudiu ursica <the_braniak@yahoo.com>
To: "flexcoders@yahoogroups.com" <flexcoders@yahoogroups.com>
Sent: Tuesday, December 27, 2011 3:28 AM
Subject: Re: [flexcoders] Resize and Scale Window Content

 
In theory yes, by using percent width and height for components, in practice how much works out of the box depeds on every particular case.

C

From: hkondylk <kondylak@gmail.com>
To: flexcoders@yahoogroups.com
Sent: Monday, December 26, 2011 5:35 PM
Subject: [flexcoders] Resize and Scale Window Content

 
Hello,

I want to be able to resize my Window and the content to scale as the window resizes. Is this possible or do you have an example?

THanks in advnace.







__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Re: [flexcoders] Resize and Scale Window Content

 

Hi,
I have the same problem.
I use groupe with percent height and width. But this doesn't work if window is resize by as3 script during creationcomplete phase.
If someone has an idea?
thanks

Le 27/12/11 07:54, Asad Zaidi a écrit :

 
you can acheive it using Grid control also. depends upon your requirement.
 
Zaidi

From: claudiu ursica <the_braniak@yahoo.com>
To: "flexcoders@yahoogroups.com" <flexcoders@yahoogroups.com>
Sent: Tuesday, December 27, 2011 3:28 AM
Subject: Re: [flexcoders] Resize and Scale Window Content

 
In theory yes, by using percent width and height for components, in practice how much works out of the box depeds on every particular case.

C

From: hkondylk <kondylak@gmail.com>
To: flexcoders@yahoogroups.com
Sent: Monday, December 26, 2011 5:35 PM
Subject: [flexcoders] Resize and Scale Window Content

 
Hello,

I want to be able to resize my Window and the content to scale as the window resizes. Is this possible or do you have an example?

THanks in advnace.





__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

[flexcoders] C Native Extension: Need to replace time structure into millisecond output

 

I'm taking time to experiment how I can track the MIDI timing in milliseconds. In this code below contain date and time format and wish to replace with time function that is capable of milliseconds precision without huge jump in accuracy. This will be run on Window 7 using GCC or MingGW compilers.
Any advice is appreciate!

#include "FlashRuntimeExtensions.h"
#include "Stdlib.h"
#include "SampleANE.h"
#include "String.h"
#include "time.h"

//If AIR can access this function, return 1, ANE is avail
FREObject isSupported(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[]) {
FREObject result;

uint32_t isSupportedInThisOS = 1;
FRENewObjectFromBool(isSupportedInThisOS, &result); //Boolean to object and return, FRE_OK

return result;
}

FREObject getTestString(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[]) {
FREObject result = 0;

//Temporary values to hold our actionscript code.
uint32_t len = -1;
const uint8_t *str = 0;
char *temp;
uint8_t *strAll;

time_t curtime;
struct tm *loctime;

curtime = time(NULL);

loctime = malloc(sizeof(curtime));

loctime = localtime(&curtime);

char *asc = asctime(loctime);

//Turn our actionscrpt code into native code.
if(FREGetObjectAsUTF8(argv[0], &len, &str) == FRE_OK) {
temp = "Hello World! This is ";

strAll = (char *)malloc(strlen(temp) + strlen(str) + strlen(asc) + 1);
strcpy(strAll,temp);
strcat(strAll,str);
strcat(strAll,asctime(loctime));
}

FRENewObjectFromUTF8(strlen((const char *)strAll)+1, (const uint8_t *)strAll, &result); //UTF8 to object and return
free(strAll);
free(temp);

return result;
}

FREObject getHelloWorld(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[]) {
FREObject result;

const char *str = "Hello World! This is a String";
FRENewObjectFromUTF8(strlen(str)+1, (const uint8_t *)str, &result);

return result;
}

void contextInitializer(void* extData, const uint8_t* ctxType, FREContext ctx, uint32_t* numFunctions, const FRENamedFunction** functions)
{
// setup the number of functions in this extension
*numFunctions = 3;

// create an array to store all the functions we will use.
FRENamedFunction* func = (FRENamedFunction*) malloc(sizeof(FRENamedFunction) * (*numFunctions));

// create an array entry for each function
func[0].name = (const uint8_t*) "getTestString";
func[0].functionData = NULL; //data type from ctxType?
func[0].function = &getTestString;

func[1].name = (const uint8_t*) "isSupported";
func[1].functionData = NULL; //data type from ctxType?
func[1].function = &isSupported;

func[2].name = (const uint8_t*) "getHelloWorld";
func[2].functionData = NULL; //data type from ctxType?
func[2].function = &getHelloWorld;

// create an array to store all the functions we will use.
*functions = func;
}

// A native context instance is disposed
void contextFinalizer(FREContext ctx) {
return;
}

void initializer(void** extData, FREContextInitializer* ctxInitializer, FREContextFinalizer* ctxFinalizer) {
*ctxInitializer = &contextInitializer;
*ctxFinalizer = &contextFinalizer;
}

void finalizer(void* extData) {
return;
}

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___