Hi Axay,

You can try something like this:

//SOME FUNCTION

startInt() //start the function

.......
private var counter:int;
private var interval:uint;

           private function startInt():void
           {
              counter = 1; //maintain a counter outside instead of for loop
              createCchart();
           }


private function createCchart(event:FlexEvent=null):void
{

 //code for preparing data for columnset etc....

var disp:DisplayObject = null;
disp = this.addChild(columnChart);

counter++; //increment the counter after every addition
                                if (counter < noOfCharts) //stop the
interval once all the charts are ready
                               {

disp.addEventListener(FlexEvent.CREATION_COMPLETE,createCchart)
                               }

}

I wrote this code on the fly and may have syntax errors. Just fix those and
see if it works.


Regards,
Venkat
www.venkatv.com


On Fri, Jan 2, 2009 at 11:18 AM, Axay <[email protected]> wrote:

>
> Thanks a lot Venkat for this suggestion. But this does not seem to be
> working as needed. Also tried with larger time interval but didn't
> work.
>
> Seems like addChild() function is not getting enough time to render
> data on the chart component and then invalidateDisplayList() and
> updateDisplayList().
>
> Also tried with first rendering all the component and then updating
> the dataProvider. This also
> Can I try something else for this?
>
> Thanks,
> Axay
>
>
>
> On Dec 19 2008, 10:41 pm, "Venkat Viswanathan" <[email protected]>
> wrote:
> > Hi Axay,
> >
> > Well you did not write it the way I intended it to be... change your code
> to
> > something like this:
> >
> > //SOME FUNCTION
> >
> > startInt() //start the function
> >
> > .......
> > private var counter:int;
> > private var interval:uint;
> >
> >            private function startInt():void
> >            {
> >               counter = 1; //maintain a counter outside instead of for
> loop
> >                interval = setInterval(createCchart, 1000); // 1 second
> >               //same as what you had done
> >
> >            }
> >
> >            private function stopInt():void
> >            {
> >                if (interval) {
> >                    clearInterval(interval);
> >
> >                }
> >            }
> >
> > private function createCchart(numChart:int):void
> > {
> >
> >  //code for preparing data for columnset etc....
> >
> > var disp:DisplayObject = null;
> > disp = this.addChild(columnChart);
> >
> > counter++; //increment the counter after every addition
> >                                 if (counter == noOfCharts) //stop the
> > interval once all the charts are ready
> >                                {
> >                                        stopInt();
> >                                        disp=null; // remove this unless
> > absolutely necessary
> >                                }
> >
> > }
> >
> > Try this and let me know if it worked.
> >
> > Regards,
> > Venkatwww.venkatv.com
> >
> > On Fri, Dec 19, 2008 at 12:01 PM, Axay <[email protected]>
> wrote:
> >
> > > Thanks Venkat for this. But actually, I tried but not successful. I
> > > tried something like this:
> >
> > > //SOME FUNCTION
> >
> > > for(var i:int;i<noOfCharts.length;i++)
> > > {
> >
> > >        startInt(i);
> > > }
> >
> > > .......
> >
> > > private var interval:uint;
> >
> > >            private function startInt(i:int):void
> > >            {
> > >                interval = setInterval(createCchart, 1000,i); // 1
> > > second
> >
> > >            }
> >
> > >            private function stopInt():void
> > >            {
> > >                if (interval) {
> > >                    clearInterval(interval);
> >
> > >                }
> > >            }
> >
> > > private function createCchart(numChart:int):void
> > > {
> >
> > >  //code for preparing data for columnset etc....
> >
> > > var disp:DisplayObject = null;
> > > disp = this.addChild(columnChart);
> >
> > >                                 while(disp!=null)
> > >                                {
> > >                                        stopInt();
> > >                                        disp=null;
> > >                                        break;
> > >                                }
> >
> > > }
> >
> > > Please tell me if I am doing anything wrong in this..
> >
> > > Thanks,
> > > Axay
> >
> > > ======================================
> >
> > > On Dec 18, 9:38 pm, "Venkat Viswanathan" <[email protected]>
> > > wrote:
> > > > Hi Axay,
> >
> > > > When you are adding the ColumnSets at runtime, are you adding them
> using
> > > > some kind of a for loop? If yes, can you try to add after setting a
> > > delay.
> > > > Something like using setInterval, call a method at a certain
> interval.
> > > And
> > > > in the method, check for the loop condition and if the condition does
> not
> > > > satisfy, then do clearInterval. By doing this, we can ensure that we
> will
> > > > give enough time for Flex to build the column sets.
> >
> > > > Regards,
> > > > Venkatwww.venkatv.com
> >
> > > > On Thu, Dec 18, 2008 at 7:39 PM, Axay <[email protected]>
> > > wrote:
> >
> > > > > Error: Error #1502: A script has executed for longer than the
> default
> > > > > timeout period of 15 seconds.
> > > > >        at
> mx.managers::LayoutManager/validateDisplayList()[E:\dev\3.0.x
> > > > >
> \frameworks\projects\framework\src\mx\managers\LayoutManager.as:598]
> > > > >        at
> > > mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.0.x
> > > > >
> \frameworks\projects\framework\src\mx\managers\LayoutManager.as:675]
> > > > >        at 
> > > > > Function/http://adobe.com/AS3/2006/builtin::apply()<http://adobe.com/AS3/2006/builtin::apply%28%29>
> <http://adobe.com/AS3/2006/builtin::apply%28%29>
> > > <http://adobe.com/AS3/2006/builtin::apply%28%29>
> > > > >        at
> > > > > mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.0.x\frameworks
> > > > > \projects\framework\src\mx\core\UIComponent.as:8460]
> > > > >        at
> > > > > mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.0.x\frameworks
> > > > > \projects\framework\src\mx\core\UIComponent.as:8403]
> >
> > > > > Can any one please tell how to debug this error. There is no
> infinite
> > > > > loop problem with the code. Error comes when there are large amount
> of
> > > > > ColumnChart having ColumnSets are added to a container at runtime.
> > > > > This error doesn't come if the number of charts are less.
> >
> > > > > Please post your suggestions to debug this.
> > > > > Thanks,
> > > > > Axay
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to