dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [RESOLVED] Help converting this to AS3 from AS2

  1. #1
    AS3 N00B
    Join Date
    Feb 2002
    Location
    NYC
    Posts
    308

    resolved [RESOLVED] Help converting this to AS3 from AS2

    I used this snippet to create a chart in AS2

    Code:
    	cfdatapoints = this.datapoints.split(",");
    	lenghtofarray = cfdatapoints.length-1;
    	incx = 400/lenghtofarray // x position increment 400 is width of chart
    	incy = 300/1500; // y position increment 300 is height of chart
    
    	chart.lineStyle(3, 0xFFFFFF, 150);
    	chart.moveTo(0,0);
    	for(var ii=0;ii!=cfdatapoints.length-1;ii++){
    		chart.lineTo(ii*incx,-(cfdatapoints[ii]-cfdatapoints[0])*incy);
    	}
    	init(0);
    cfdatapoints contained a set of number separated by commas, for example: 1,2,3,4,5,6,
    and it also end in a comma
    Last edited by neo1487; 01-11-2010 at 12:53 AM.
    -Neo

  2. #2
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    PHP Code:
        var cfdatapoints:Array = this.datapoints.split(",");
        var 
    lenghtofarray:uint cfdatapoints.length-1;
        var 
    incx:Number 400/lenghtofarray // x position increment 400 is width of chart
        
    var incy:Number 300/1500// y position increment 300 is height of chart

        
    chart.graphics.lineStyle(30xFFFFFF1.5);
        
    chart.graphics.moveTo(0,0);
        for(var 
    ii:int=0;ii!=cfdatapoints.length-1;ii++){
            
    chart.graphics.lineTo(ii*incx,-(cfdatapoints[ii]-cfdatapoints[0])*incy);
        }
        
    init(0); 

  3. #3
    AS3 N00B
    Join Date
    Feb 2002
    Location
    NYC
    Posts
    308
    thank you so much!
    -Neo

  4. #4
    ___________________
    Join Date
    May 2004
    Posts
    3,174

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center