If you only want the function to execute once no matter how many
components you can use a static member of the component to keep track of
whether it's been called and only call once.

Static var called:Boolean = false;

In your function:

If (!called)
{
  //make the call
  Called = true;
}

Matt

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Jeremy Rottman
Sent: Tuesday, January 03, 2006 11:20 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Double database Insertions with initialize

It is the custom comp senario that you mentoined in your first post. I
have setup all my comps as custom comps, is there something I need to
do to have the functions I am using post only once to my webservice?

--- In flexcoders@yahoogroups.com, "Jeremy Rottman" <[EMAIL PROTECTED]>
wrote:
>
> Well I know the function is not being called twice, as this is the
> first comp that I have written for this function. But I think you are
> right on track with the custom compoent. I do have this comp setup as
> a custom comp. 
> 
> --- In flexcoders@yahoogroups.com, Tariq Ahmed <[EMAIL PROTECTED]> wrote:
> >
> > Well the first thing to determine is, is qiAdminListFileNumAdd()
being 
> > called twice. Eg open up your net connection debugger and see if a
call 
> > is being made twice, or on the result handler pop up an alert and
> see if 
> > that alerts occurs twice, etc...
> > 
> > My guess is that is the case. And my super wild guess is that that 
> > Canvas is being included in your app as a custom component twice.
> > 
> > <comp:mycomp1 ../>
> > <comp:mycomp2.../>
> > 
> > 
> > 
> > Jeremy Rottman wrote:
> > 
> > >I have started to develope a simple flex app using coldfusion as my
> > >backend. While working on some of the more detailed portions of the
> > >app. I have ran into this problem. 
> > >
> > >On the backend, I have the coldfusion fucntion below. It is pretty
> > >straight forward and works like a charm when I run it through a cf
> > >page. However when I use this function from with in flex, it insert
> > >two records into the data base. So if my listCompletePrimer was
> > >L051234 it would insert that and the next number in order. So that
I
> > >have L051234 and L051235. 
> > >
> > >I am using initalize to create this insertion so that I can call
back
> > >the inserted number and display it in a form field to an admin. 
> > >
> > >Here is my as/flex/cf code. Can someone lead me to the direction of
> > >fixing this.
> > >
> > >Flex:
> > ><mx:Canvas width="100%" height="100%"
> > >xmlns:mx="http://www.macromedia.com/2005/mxml";
> > >initialize="qiAdminListFileNumAdd();" xmlns="*">
> > >
> > >AS:
> > >function qiAdminListFileNumAdd(){
> > >   srv.qiAdminListFileNumAdd();}
> > >
> > >CF:
> > >   <cffunction name="qiAdminListFileNumAdd" access="remote"
> > >returntype="string" output="false"> 
> > >           <!--- Global File Number Manipulation Query  - Sale --->
> > >           <cfquery name="CheckNumList"
datasource="#application.dsn#">
> > >                   SELECT fld_fileNum 
> > >                   FROM tbl_smartPanel_propInfo_List
> > >                   ORDER BY fld_fileNum
> > >                   DESC LIMIT 1
> > >           </cfquery>
> > >           <cfset listPrimer =
removeChars(CheckNumList.fld_fileNum, 1,
> > >len(APPLICATION.systemInfo.fld_listPrefix) +
> > >len(dateformat(APPLICATION.todayDate, "YY")))>
> > >           <cfset listCompletePrimer =
APPLICATION.systemInfo.fld_listPrefix &
> > >APPLICATION.datePrimer & listPrimer + 1>
> > >           <cfquery datasource="#application.dsn#">
> > >           insert into tbl_smartPanel_propInfo_List
> > >           (fld_fileNum)
> > >           values('#listCompletePrimer#')
> > >           </cfquery>              
> > >           <cfreturn listCompletePrimer />
> > >           </cffunction>
> > >
> > >
> > >
> > >
> > >
> > >--
> > >Flexcoders Mailing List
> > >FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > >Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> > >Yahoo! Groups Links
> > >
> > >
> > >
> > > 
> > >
> > >
> > >
> > >  
> > >
> >
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



 




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to