Autor Zpráva
Kubanec
Profil *
Cau
mam problem , potrebuju dat graf do vyskakujiciho okna ve flash aplikaci , nasel jsem kod na develeper.yahoo.com , presne co potrebuju...Jenze je to napsane pro as3-file , ale ne to co se da vlozit do timelajny (nebo do toho vyskakovaciho okna) takze pokud to vlozim do timelajny tak to nefunguje.
1) Nevite nekdo jak loadovat takovejhle kod aby slapal ve fla pak teda i v swf
2) ja to zmenit, pokud to vlozit nejde ,na kod kterej bude funguvat ve flashy
Jen chci rict ze kod as3, a ze cela aplikace taky. A ze kod je 100% funkcni neb jsem to videl v akci ....

Kdyby nekdo nahodou chtel graf kterej cte z xml data....Sem si skoro 100% jistej ze je problem v package,public,private ale nevim treba nekdo poradi ... Diky


package {
import flash.display.Sprite;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import com.yahoo.astra.fl.charts.*;

public class YahooColumnChart extends Sprite {
private var xml:XML;
private var valueList:XMLList;
private var labelList:XMLList;
private var xPoint:Array;
private var tPoint:Array;
private var graphArray:Array;
private var medianArray:Array;
private var medianArrIndex:uint;
private var medianPoint:Array;

public function YahooColumnChart() {
var loader:URLLoader=new URLLoader ;
loader.addEventListener(Event.COMPLETE,xmlDisplay);
loader.load(new URLRequest("graph.xml"));
}
private function xmlDisplay(e:Event):void {
var chart:ColumnChart=new ColumnChart ;
chart.x=0;
chart.y=0;
chart.width=stage.stageWidth;
chart.height=stage.stageHeight;

xml=new XML(e.target.data);

var valueList:XMLList=xml.Report.Point.Value.text();
var labelList:XMLList=xml.Report.Point.Label.text();

var xPoint:Array=new Array ;

for each (var graphPoints:XML in valueList) {
xPoint.push(graphPoints);
}
var tPoint:Array=new Array ;

for each (var timePoints:XML in labelList) {
tPoint.push(timePoints);
}
var graphArray:Array=new Array ;

for (var c:uint; c < xPoint.length; c++) {
graphArray.push({point:xPoint[c],time:tPoint[c]});
}
// adjust the points on the line series a bit smaller
chart.dataProvider=[graphArray];
chart.setStyle( "seriesMarkerSizes", [ 30 ] ); ;

// add the chart
addChild(chart);

// if the data items are complex objects we need to tell the chart
// how to access the data it needs to display
chart.verticalField="point";
chart.horizontalField="time";
}
}
}
Kubanec
Profil *
tady je jeste kod pro graph.xml

<Graph>
<Report>
<Point>
<Value>48</Value>
<Label>January 25, 2008</Label>
</Point>
<Point>
<Value>26</Value>
<Label>January 26, 2008</Label>
</Point>
<Point>
<Value>29</Value>
<Label>January 27, 2008</Label>
</Point>
<Point>
<Value>42</Value>
<Label>January 28, 2008</Label>
</Point>
<Point>
<Value>40</Value>
<Label>January 29, 2008</Label>
</Point>
<Point>
<Value>43</Value>
<Label>January 30, 2008</Label>
</Point>
<Point>
<Value>38</Value>
<Label>January 31, 2008</Label>
</Point>
<Point>
<Value>38</Value>
<Label>February 1, 2008</Label>
</Point>
<Point>
<Value>13</Value>
<Label>February 2, 2008</Label>
</Point>
</Report>
</Graph>

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0