XMLLists as Dataprovider problem
I have an XML variable "theResult" equal to the following xml
from a flickr webservice call (without data):
<rsp>
<photos>
<photo>
<tags>
<tag>here1</tag>
<tag>here2</tag>
<tag>here3</tag>
</tags>
</photo>
<photo/>
<photo/>
<photo/>
<photo/>
</photos>
</rsp>
I added the <tags> and <tag> manually. I wanted
to display this data in a TileList of VBoxes, so I set the
dataProvider of the TileList as "{theResult.photos.photo}", without
any problem. I also wanted to display each tag, so I tried setting
a Repeater in the VBox with a dataProvider of "{data.tags.tag}".
However, nothing displayed, so after much searching I discovered
that setting "{data.tags.children()}" as the dataProvider for the
Repeater would work. I just would like to know why this is so, just
to satisfy the curiosity that futile hours of work have built up.
Shouldn't data.tags.tag be an XMLList just as
theResult.photos.photo or is data found using "." notation handled
somehow differently for XMLLists than XMLs?
Thanks for the reply. When I set theResult your way it works
fine. However, in my code I set theResult with the following
statements:
public function handlePhotos(event:ResultEvent):void
theResult = XML(event.result);
theResult.photos.photo[0].tags.@id = "enabled";
theResult.photos.photo[0].tags.tag[0]="here1";
theResult.photos.photo[0].tags.tag[1]="here2";
theResult.photos.photo[0].tags.tag[2]="here3";
I guess data binding might only be recognizing the first
statement and ignoring the rest? Or perhaps it's that
theResult.photos.photo.tags.tag does not exist when theResult is
first changed, so flex doesn't know what to listen to for data
binding? The reason I tested my code like this is because I need to
set the tags for each photo by making a call to a flickr web
service for each one before having the data to attach. I guess I'll
need to keep using the children() method.
Similar Messages
-
Hello there,
I would like to create a legend to a gantt chart in order to identify the colors in the chart.
For that I created a xml to be used as a data provider.
The XML is:
<?xml version="1.0" encoding="utf-8"?>
<items>
<item id="1" label="livre a 100%" color="0x66CC00" />
<item id="2" label="livre de 75% a 100%" color="0x009900" />
<item id="3" label="livre de 50% a 75%" color="0xFFFF33" />
<item id="4" label="livre de 25% a 50%" color="0xFF9900" />
<item id="5" label="livre de 0% a 25%" color="0x3366FF" />
<item id="6" label="não está livre" color="0x3300CC" />
</items>
And I already have the labels in the legend, but I'm having some problem's with the color... The legend shows every marker as black.
<mx:Legend id="legAvailable" dataProvider="{legAvai}"
toolTip="Available legend" backgroundColor="#CDCDCD"/>
Can anyone help or give any idea of how to sort this out?!?! I'm in a bit of a tight schedule...
Thanks in advance.I've been looking for some answers and haven't found anything yet...
Does anyone has any idea of how to work this out?? Or why are all the markers colored as black...
Thank you
P.S. I'm leaving an image so you can visualize my problem... -
LineChart category axis labelFunction / dataProvider problem
Hi,
I am trying to plot a line chart using actionscript.
What I am trying to achive is plot the chart with entire dataset, but show only limited number of points in x and y axis's.
Problem:
When I give dataProvider to category axis with some limited values, nothing gets plotted .
Explaination:
In the attached main.mxml file
var lineCategoryXAxis:CategoryAxis = new CategoryAxis();
//lineCategoryXAxis.dataProvider = getDatePointsArray(datesArray);
lineCategoryXAxis.categoryField = "DATE";
lineCategoryXAxis.labelFunction = lineCategoryXAxisLabelFunction;
lineChart.horizontalAxis = lineCategoryXAxis;
Here, I am giving category axis for x-axis. Linechart takes care of values in the vertical axis by itself and so the line chart gets plotted properly.
But when I try giving values to vertical axis, then nothing is plotted in the line chart.
var lineCategoryYAxis:CategoryAxis = new CategoryAxis();
lineCategoryYAxis.dataProvider = getNumericPointsArray(valuesArray)
//lineCategoryYAxis.categoryField = "VALUE";
lineCategoryYAxis.labelFunction = lineCategoryYAxisLabelFunction;
lineChart.verticalAxis = lineCategoryYAxis;
Also if I try to reduce the number of points in the x-axis, nothing gets plotted
var lineCategoryXAxis:CategoryAxis = new CategoryAxis();
lineCategoryXAxis.dataProvider = getDatePointsArray(datesArray);
lineCategoryXAxis.labelFunction = lineCategoryXAxisLabelFunction;
lineChart.horizontalAxis = lineCategoryXAxis;
where getNumericPointsArray() returns an array with 7 values for vertical axis and getDatePointsArray() returns array with 7 dates for horizontal axis.
Need help in resolving this problem.
P.S: Unable to attach mxml file so attaching it as a txt file.Hi,
This is the code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:components="com.yahoo.data.digits.components.*"
layout="vertical"
backgroundColor="#FFFFFF"
backgroundGradientAlphas="[0,0]"
width="100%" creationComplete="cc()">
<mx:Script>
<![CDATA[
import mx.utils.ArrayUtil;
import mx.collections.XMLListCollection;
import mx.collections.Sort;
import mx.charts.CategoryAxis;
import mx.charts.chartClasses.Series;
import mx.collections.ArrayCollection;
import mx.charts.series.LineSeries;
import mx.charts.LineChart;
public var dataForLineChart:ArrayCollection = new ArrayCollection([
{DATE:"20090509", VALUE:"3538943147"},
{DATE:"20090510", VALUE:"5047760823"},
{DATE:"20090511", VALUE:"5046865494"},
{DATE:"20090512", VALUE:"4983771032"},
{DATE:"20090513", VALUE:"5032039834"},
{DATE:"20090514", VALUE:"4897303525"},
{DATE:"20090515", VALUE:"4496020991"},
{DATE:"20090516", VALUE:"3525547244"},
{DATE:"20090517", VALUE:"3596982398"},
{DATE:"20090518", VALUE:"4947978254"},
{DATE:"20090519", VALUE:"4932182219"},
{DATE:"20090520", VALUE:"4909069875"},
{DATE:"20090521", VALUE:"4781830807"},
{DATE:"20090522", VALUE:"4431176690"},
{DATE:"20090523", VALUE:"3476323135"},
{DATE:"20090524", VALUE:"3444512240"},
{DATE:"20090525", VALUE:"4329018809"},
{DATE:"20090526", VALUE:"5086390081"},
{DATE:"20090527", VALUE:"5012778551"},
{DATE:"20090528", VALUE:"4770167180"},
{DATE:"20090529", VALUE:"4408927585"},
{DATE:"20090531", VALUE:"3488537357"},
{DATE:"20090601", VALUE:"3630748728"},
{DATE:"20090602", VALUE:"5007093913"},
{DATE:"20090603", VALUE:"5015210737"},
{DATE:"20090604", VALUE:"4999236097"},
{DATE:"20090605", VALUE:"4934609881"},
{DATE:"20090606", VALUE:"4588135281"},
{DATE:"20090607", VALUE:"3615291868"},
{DATE:"20090608", VALUE:"3666209346"},
private function cc():void
var lineSeriesArray:Array = new Array();
var lineChart:LineChart = new LineChart();
lineChart.percentHeight = 100;
lineChart.percentWidth = 100;
lineChart.showDataTips = true;
lineChart.dataProvider = dataForLineChart;
var valuesArray:Array = new Array();
var datesArray:Array = new Array();
var lineSeries:LineSeries;
lineSeries = new LineSeries();
lineSeries.dataProvider = dataForLineChart;
lineSeries.dataFunction = lineSeriesDataFunction;
lineSeriesArray.push(lineSeries);
var dLength:int = dataForLineChart.length;
for (var k:int=0;k<dLength;k++)
valuesArray.push(dataForLineChart[k].VALUE);
datesArray.push(dataForLineChart[k].DATE);
lineChart.series = lineSeriesArray;
var lineCategoryXAxis:CategoryAxis = new CategoryAxis();
//lineCategoryXAxis.dataProvider = getDatePointsArray(datesArray);
lineCategoryXAxis.categoryField = "DATE";
lineCategoryXAxis.labelFunction = lineCategoryXAxisLabelFunction;
lineChart.horizontalAxis = lineCategoryXAxis;
var lineCategoryYAxis:CategoryAxis = new CategoryAxis();
//lineCategoryYAxis.dataProvider = getNumericPointsArray(valuesArray)
lineCategoryYAxis.categoryField = "VALUE";
lineCategoryYAxis.labelFunction = lineCategoryYAxisLabelFunction;
//lineChart.verticalAxis = lineCategoryYAxis;
chartContainer.removeAllChildren();
chartContainer.addChild(lineChart);
private function lineCategoryXAxisLabelFunction(categoryValue:Object, previousCategoryValue:Object, axis:CategoryAxis, categoryItem:Object):String
/** Will do date formatting here */
return categoryItem.DATE;
//return categoryItem.toString();
private function lineCategoryYAxisDataFunction(axis:CategoryAxis, item:Object):Object
return item.VALUE;
private function lineCategoryYAxisLabelFunction(categoryValue:Object, previousCategoryValue:Object, axis:CategoryAxis, categoryItem:Object):String
/** Will do number formatting here */
return categoryItem.VALUE;
//return categoryItem.toString();
private function lineSeriesDataFunction(series:Series, item:Object, fieldName:String):Object
if (fieldName == "yValue")
return item.VALUE;
else if(fieldName == "xValue")
return item.DATE.toString();
return null;
private function getNumericPointsArray(inputArray:Array):Array
var numValues:int = inputArray.length;
/** Sorting the array to find min and max values */
var inputAC:ArrayCollection = new ArrayCollection(inputArray);
inputAC.sort = new Sort();
inputAC.refresh();
var minValue:Number = Number(inputAC.getItemAt(0));
var maxValue:Number = Number(inputAC.getItemAt(inputAC.length - 1));
var outputArray:Array = new Array();
var i:int;
var diffFactor:Number;
var diffMinMax:Number;
/** axis takes 0 by default so not pushing that into array */
if (minValue == maxValue)
/** Dividing by 6 to get 5 points */
diffFactor = Math.round(maxValue / 6);
for (i=1;i<=5;i++)
outputArray.push((i * diffFactor));
outputArray.push(maxValue);
else
outputArray.push(minValue);
/** Find some points between minValue and maxValue */
diffMinMax = (maxValue - minValue);
/** Dividing by 5 to get 4 points */
diffFactor = Math.round(diffMinMax / 5);
for (i=1;i<=4;i++)
outputArray.push((i * diffFactor) + minValue);
outputArray.push(maxValue);
return outputArray;
private function getDatePointsArray(inputArray:Array):Array
var numValues:int = inputArray.length;
/** Subtracting 2 because first and last values are undconditinally pushed in output array.*/
var stepValue:int = (numValues - 2) / 5;
var outputArray:Array = new Array();
outputArray.push(inputArray[0]);
/** Starting from 1 and ending in numValues - 2 because first and last values of array are already taken.*/
for (var i:int=stepValue;i<numValues - 2;i+=stepValue)
outputArray.push(inputArray[i]);
outputArray.push(inputArray[numValues - 1]);
return outputArray;
]]>
</mx:Script>
<mx:HBox id="chartContainer" width="100%" height="100%">
</mx:HBox>
</mx:Application>
As you can see in the code, my dataPovider is complex (can become much more complex). In the code above, the ArrayCollection has only one element currently but will have more. So the graph should be plotted in such a way that each array element corresponds to one line series.
What I need to achive is that the horizontal axis should show dates only from the "0th" element of the ArrayCollection and that too only some limited 6-7 points, the rest of the ArrayCollection elements should get plotted according to these dates.
I think I was able to explain my problem. Pls let me know if any more explaination is required.
P.S. Re-attaching the file.
Thanks in advance -
ComboBox w/RO DataProvider Problem
I've got a combobox that is supposed to get filled from a
RemoteObject call, but for some reason all I'm seeing is the text
"[objectOperation]" in the dropdown.
Here's the combobox:
<mx:ComboBox width="150" id="categorySelector"
labelField="CATEGORYNAME">
<mx:dataProvider>{parentApplication.groupsService.groupsService.categoryList}</mx:dataProv ider>
</mx:ComboBox>
The dataprovider is built from an array that is returned
from the remoteObject like such:
categoryResult =
ArrayUtil.toArray(parentApplication.groupsService.groupsService.getCategories.lastResult) ;
for (var i:int = 0; i < categoryResult.length; ++i) {
var catLabel:String = categoryResult
.CATEGORYNAME;
var catID:int = categoryResult.CATEGORYID
var obj:Object = {label:catLabel, data:catID};
categoryComboDP.addItem(obj);
I know the service is returning data properly (it is already
being used in some repeaters elsewhere), and as far as I can tell
the categoryComboDP collection is built properly. I've stepped
through in the debugger mode as well and can't see where it is
malformed.
Any ideas?yikes... sorry, I bungled that one pretty badly... had some
bad scoping issues as well.
Thanks for wasting a little bit of your life reviewing the
code. I was butting my head against a styrofoam wall of my own
creation.... -
I use removeAll function to clean the dataProvider then I additem to it.
There is an error occured. Because the dataProvider is null !
So I recreate the dataProvider the error still there Why ~~?
this is the code:
var i:int = 0;
if( TileList.dataProvider )
TileList.dataProvider.removeAll(); // I remove all items.
else{ // next time I try to recreate it but I still can't add item to the dataprovider
// TileList.dataProvider.addItem("Class 1"); I can't do it because the dataprovider is null now
TileList.dataProvider = new ListCollectionView( );
while( i++ < 15 ){
TileList.dataProvider.addItem("Class" + i);Hmm.. It seems that the data provider is not getting instanciated, which is resulating into null object reference error. I tried out the following code.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[
import flash.text.engine.ContentElement;
import mx.collections.ArrayCollection;
public function btnClick():void
var i:int=0;
if (contentList.dataProvider.length > 0)
contentList.dataProvider.removeAll();
else
contentList.dataProvider=new ArrayCollection();
while (i++ < 15)
contentList.dataProvider.addItem("Class" + i);
]]>
</mx:Script>
<mx:Canvas width="100%"
height="100%">
<mx:TileList id="contentList"
visible="true"
width="50%"
height="50%"
horizontalCenter="0"
bottom="10"
horizontalScrollPolicy="off"
verticalScrollPolicy="off"
verticalAlign="middle"
maxColumns="3"
maxRows="5"
rowHeight="{contentList.height*0.20}"
columnWidth="{contentList.width*0.33}"
dataProvider="{new ArrayCollection()}">
</mx:TileList>
<mx:Button id="btn"
label="Populate Tile List"
width="{btn.label.length * 8}"
height="20"
click="btnClick()">
</mx:Button>
</mx:Canvas>
</mx:Application>
May be this will help you.
Thanks and Regards,
Pooja Kuber | [email protected] | www.infocepts.com -
Hello:
I have a ObjectLIstDataProvider (i.e. oldp) stored in session in order to support sorting functions. It works fine.
However, when a user leavs the page where a table uses this oldp and browses some other pages, then comes back to this page, the data will still be shown for this user since oldp is stored in session (i.e. SessionBean1.java).
Here is my question: Is there any way knowing a user is browsing away from the page with oldp so i could clean the oldp in session? Where should i put this code for cleaning?
I did not find a way to distinguish when a page is rendering due to button action/sorting action/Dropdown list change (in those case, you should keep the oldp in session), and when a user is coming to this page from another page (In this case you DO need to clean oldp in sesion)?
I guess i could record last rendered page in session in order to distinguish where a user is from (same page or another page). However, I would like a more descent way to do it.
Please help.
thanksHi Anand,
I have launched two of the same application from the content area of the portal screen. Each one opens up in a separate internet explorer window. They share the same data since i am writing the data to the session. I do not want them to share the same data. How can this be achieved? Taking into mind that i have another portal application jsp dyn page embedded within this component that uses the shared data.
Regards
Jana -
Flex datagrid re-assign dataprovider
Hi,
I am working on a datagrid with custom itemRenderer & [Bindable]xmllist as dataprovider. Now the changes done in xmllist are not reflected on datagrid UI until unless I re-assign the dataprovider as the same xmllist.
As the dataprovider is Bindable so re-assigning is not required.
But it was not working so I re-assigned the xmllist to the dataprovider of datagrid. It worked.
Now my problem is when I re-assign the dataprovider my datagrid flicker(refreshes). It should not happen.
1) Is there any way out to avoid re-assigning of dataprovider?
2) Is there any way to stop flickering of datagrid on re-assigning the dataprovider?
Thanks in advance.When you change a value in the dataprovider itemupdated method needs to be called in order to make the change reflected. Try using some thing like below
ICollectionView(grid.dataProvider).itemUpdated( event.item, grid.columns[event.columnIndex].dataField );
incase you are not having event then replace it with the item you are updating in the dataprovider. -
DataGrid dataProvider XML with Namespaces,
I have a DataGrid wich dataProvider is a XMLList. The problem
is that, the xml has a default namespace, and in my DataGridColumns
I use the dataField property to define wich XML field should be
displayed. The problem is that the dataField property is used in a
way that do not take into consideration the xml namespace.
I'm already using the use namespace directive with the right
namespace, but that doesn't work.
Has anyone tried to do something similar?This is similar to a problem I stumbled into described in
another post. What I ended up doing was creating a labelFunction
for each column and using the value (without the namespace) as the
element name. In ActionScript you can use the QName to get a child
element:
private function getItemValue(data:Object,
column:DataGridColumn):String {
return data.child(new QName(mb, column.dataField));
Note that "mb" was a namespace variable I declared at a
module level. I couldn't find a more elegant way of overcoming this
namespace deficiency of the built in controls. I suppose you could
also extend the DataGrid control, add a namespace attribute and
override the appropriate function that provides the default
rendering. However, that is something for another day.... Hope this
helps.
Dan -
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
var xmlProducts:XMLList = graphList;
[Bindable]
public var products:ArrayCollection = new ArrayCollection([
{unit:"Radio", year:2007, quantity:5},
{unit:"Radio", year:2008, quantity:7},
{unit:"Radio", year:2009, quantity:10}
]]>
</mx:Script>
<mx:XMLList xmlns="" id="graphList">
<record>
<unit>Radio</unit>
<year>2007</year>
<quantity>5</quantity>
</record>
<record>
<unit>Radio</unit>
<year>2008</year>
<quantity>7</quantity>
</record>
<record>
<unit>Radio</unit>
<year>2009</year>
<quantity>10</quantity>
</record>
</mx:XMLList>
<mx:LineChart x="386" y="23" id="unitChart" height="199" dataProvider="{products}" showDataTips="true">
<mx:horizontalAxis>
<mx:CategoryAxis dataProvider="{products}" categoryField="year" />
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries yField="quantity" displayName="Quantity" />
</mx:series>
</mx:LineChart>
<mx:Legend dataProvider="{products}"/>
</mx:Application>
1- I have to draw a line chart for the products based on XMLList as dataprovider. In which horizontal axis is based on year values i.e 2007, 2008 , 2009. Vertical axis showing quantity for each unit data item Radio.
2- When i make a graph based on arraylist as data provider it works fine as in given example. but when i use xmlList as data provider it shows nothing. I think values in XMLList are all text but i don't know how to convert them to numeric.Hi Asif,
You need to modify Your XmlList structure and you need to give XMLListCollection as a dataprovider to the LineGraph.
See the working sample below:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var products:ArrayCollection = new ArrayCollection([
{unit:"Radio", year:2007, quantity:5},
{unit:"Radio", year:2008, quantity:7},
{unit:"Radio", year:2009, quantity:10}
]]>
</mx:Script>
<!--<mx:XMLList xmlns="" id="graphList">
<record>
<unit>Radio</unit>
<year>2007</year>
<quantity>5</quantity>
</record>
<record>
<unit>Radio</unit>
<year>2008</year>
<quantity>7</quantity>
</record>
<record>
<unit>Radio</unit>
<year>2009</year>
<quantity>10</quantity>
</record>
</mx:XMLList>-->
<mx:XMLListCollection id="graphList">
<mx:source>
<mx:XMLList>
<record unit="Radio" year="2007" quantity="5" />
<record unit="Radio" year="2008" quantity="7" />
<record unit="Radio" year="2009" quantity="10" />
</mx:XMLList>
</mx:source>
</mx:XMLListCollection>
<mx:LineChart x="386" y="23" id="unitChart" height="199" dataProvider="{graphList}" showDataTips="true">
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="@year" title="Year"/>
</mx:horizontalAxis>
<mx:verticalAxis>
<mx:LinearAxis baseAtZero="false" title="Quantity" />
</mx:verticalAxis>
<mx:series>
<mx:LineSeries yField="@quantity" displayName="Quantity"/>
</mx:series>
</mx:LineChart>
<mx:Legend dataProvider="{unitChart}"/>
</mx:Application>
If this post answers your question or helps, please kindly mark it as such.
Thanks,
Bhasker Chari -
Quick Description: Essentially I want two XMLLists, an original list that gets saved to file and holds all information, and a display XMLList for the tree that has less information.
This is how I'm doing it. But the problem is that my display XMLList is still referencing the original XMLList inside the array!
1) I have an array that holds an XMLList.
2) I create another XMLList object based on the children of the XMLList in the array
var xmlList:XMLList = new XMLList(xmlArray[PROPS].children())
3) I set my tree's data source to the xmlList.
xmlColDataProvider.source = xmlList; tree.dataProvider = xmlColDataProvider;
4) Create another XMLList that references the current tree's data source and delete some children.
var nodeList:XMLList = xmlColDataProvider.source.prop.children();
// For each node attribute that is a prop, delete all of its children
for(var i:int = nodeList.length() -1; i >= 0; i--)
delete nodeList[i];
Any Help would be much appreciated, or if you have any questions I can try to go further into detail.The data binding isn't the problem, that is working fine.
The problem is that when I edit the xml list that is being used in my tree, is still referencing my original xml list that I got the data from(which I don't want)
What you could say is that I am getting a shallow copy, but I want a deep copy. -
Specs for XML in AdvancedDataGrid?
Hi All,
I am trying to get XML-data generated by a PHP-page (based on
data out of a MySQL-database) displayed in a AdvancedDataGrid. I
cannot get it to work. Comparison with XML-data constructed with a
XML-tag in Flex (mx:XML) has taught me that the XML-data needs to
be converted to an XMLListCollection in order to get the
tree-property of the ADG filled with the XML-data (and thereby
displayed in the ADG itself). And for some reason the XML-data
coming out of PHP cannot be converted to an XMLListCollection. The
ADG fails silently on this but if I try to convert the XML to an
XMLListCollection I get a 1034-error. Converting it to an XMLList
is no problem.
So my question is what are the differences between
XML/XMLList and the XMLListCollection that I have to take into
account for doing a successfull conversion?
For information. I have generated the XML out of PHP both via
a loop for-routine (as regular text so to say) and via the
functions of DOCDocument and I have been playing around with the
chosen character set but that has not made any difference.
Hope someone can help,
Edwin"EdwinvD" <[email protected]> wrote in
message
news:g6vqhu$jfr$[email protected]..
> Hi All,
>
> I am trying to get XML-data generated by a PHP-page
(based on data out of
> a
> MySQL-database) displayed in a AdvancedDataGrid. I
cannot get it to work.
> Comparison with XML-data constructed with a XML-tag in
Flex (mx:XML) has
> taught
> me that the XML-data needs to be converted to an
XMLListCollection in
> order to
> get the tree-property of the ADG filled with the
XML-data (and thereby
> displayed in the ADG itself). And for some reason the
XML-data coming out
> of
> PHP cannot be converted to an XMLListCollection. The ADG
fails silently on
> this
> but if I try to convert the XML to an XMLListCollection
I get a
> 1034-error.
> Converting it to an XMLList is no problem.
> So my question is what are the differences between
XML/XMLList and the
> XMLListCollection that I have to take into account for
doing a successfull
> conversion?
>
> For information. I have generated the XML out of PHP
both via a loop
> for-routine (as regular text so to say) and via the
functions of
> DOCDocument
> and I have been playing around with the chosen character
set but that has
> not
> made any difference.
Try XML>XMLList>XMLListCollection.
HTH;
Amy -
I Unable to bind a data provider to a TREE component
I know this should be easy, but I am trying to switch the following
myTree.dataProvider=event.result;
to
private var treeSource:XML;
treeSource = event.result;
myTree.dataProvider = treeSource
BUT, no matter what XML type I use I keep getting a compilation error 1118: Implicit coercion of a value with static type Object to a possibly unrelated type XML. Obviously I am missing something.I have the solution.
var xmlList:XMLList = XML(event.result).node;
myXmlList =
new XMLListCollection(xmlList);mainTree.dataProvider =
new XMLListCollection(xmlList); -
Dynamic Link Buttons & xml file
Hi All
I'm calling an external XML File with a structure of ;
<papers>
<paper id="1">
<name>Net Paper One</name>
<description>
~~~~~~~~~~
</description>
</paper>
</papers>
which i'm calling using
<mx:HTTPService id="myNetPapers"
url="xml/newearthpapers.xml" result="netPapersResultHandler(event)"
resultFormat="e4x"/>
and
private function
netPapersResultHandler(event:ResultEvent):void {
xmlNetPapers = event.result.paper as XMLList;
Initially i wanted to use a combobox for the name and display
the description in a textbox.
How can i dynamically disply a Link Button for each name of
the xml document and still display the description as normal. The
link buttons i want to display horizontally across the top of the
page.
Any suggesttions
WhitetimerHi Leotemp
I managed to sort it out with this ;
<mx:Script>
<![CDATA[
import mx.controls.LinkButton;
import mx.controls.Button;
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
private var xmlNetPapers:XMLList = new XMLList();
private function
netPapersResultHandler(event:ResultEvent):void
xmlNetPapers = event.result.paper as XMLList;
/* resultCombo.dataProvider = xmlNetPapers.name; */
createButtons();
private function createButtons():void
for each(var name:String in xmlNetPapers.name)
var myButton:Button = new LinkButton();
myButton.label = name;
myButton.addEventListener("buttonDown", buttonClick);
resultBox.addChild(myButton);
/* private function comboChanged(eventObj:Event):void
textOutput.text = xmlNetPapers.(name ==
eventObj.target.selectedItem).description;
private function buttonClick(eventObj:Event):void
textOutput.text = xmlNetPapers.(name ==
eventObj.target.label).description;
]]>
</mx:Script>
Many thanks
Whitetimer -
Chart flickering problem when updating members of dataProvider
Hi all,
I'm having an issue with a PieChart, where the dataProvider
i'm using is getting updated under the hood and it's causing the
labels to drop in and out. Specifically, it looks like in the
updateDisplayList() method of PieSeries, there's a call to clear
the "labelLayer". I could have sworn i'd seen an example of an
updating pie chart that did not have a problem of flickering
labels, but i can't seem to figure out how to get rid of this
annoyance.
Here is a sample application that demonstrates what i'm
facing. Anyone have any ideas on how to get the labels to stick
around yet display the updated values?
Thanks,
./paul
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute"
width="500" height="300" creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.events.CollectionEventKind;
import mx.events.CollectionEvent;
import flash.utils.getTimer;
import mx.events.PropertyChangeEvent;
import mx.formatters.NumberFormatter;
import mx.collections.ArrayCollection;
private var timer:Timer = new Timer(3000,1);
private var fireUpdate:Boolean = true;
private var ac:ArrayCollection = new ArrayCollection(
[ { "name":"record A", "mydata": 30 },
{ "name":"record B", "mydata": 60 },
{ "name":"record C", "mydata": 70 },
{ "name":"record D", "mydata": 80 },
{ "name":"record E", "mydata": 40 },
{ "name":"record F", "mydata": 90 } ]);
private var percentFormat:NumberFormatter = new
NumberFormatter();
private function init():void
timer.addEventListener( TimerEvent.TIMER, onTimerEvent );
percentFormat.precision = 0;
mychart.dataProvider = ac;
grid.dataProvider = ac;
pieSeries.field = "mydata";
timer.start();
private function onTimerEvent( evt:TimerEvent ):void
for each( var r:Object in ac )
r.mydata = int(((Math.random() * 0.1) + 0.95) *
Number(r.mydata)); // plus or minus 5%
trace( getTimer() + ": " + r.name + " -> " + r.mydata );
if( fireUpdate )
var cevt:CollectionEvent = new CollectionEvent(
CollectionEvent.COLLECTION_CHANGE );
cevt.kind = CollectionEventKind.UPDATE;
ac.dispatchEvent( cevt );
statusLabel.text = "Last Updated: " + getTimer();
timer.reset();
timer.start();
public function labelFunc(data:Object, field:String,
index:Number, percentValue:Number):String
return data.name + " (" + percentFormat.format(percentValue)
+ "%)";
private function toggleUpdateEvent():void
fireUpdate = !fireUpdate;
if( fireUpdate ) evtToggle.label = "Turn Off UpdateEvent";
else evtToggle.label = "Turn ON UpdateEvent"
]]>
</mx:Script>
<mx:VBox width="100%" height="100%" >
<mx:HBox>
<mx:Button id="evtToggle" label="Turn Off UpdateEvent"
click="toggleUpdateEvent()" />
<mx:Label id="statusLabel" />
</mx:HBox>
<mx:HBox width="100%" height="100%">
<mx:PieChart id="mychart" width="50%" height="100%">
<mx:series>
<mx:PieSeries id="pieSeries" labelFunction="labelFunc"
labelPosition="insideWithCallout" showDataEffect="eff"/>
</mx:series>
<mx:SeriesInterpolate id="eff" duration="1000"/>
</mx:PieChart>
<mx:DataGrid id="grid" width="50%" height="100%">
<mx:columns>
<mx:DataGridColumn dataField="name" />
<mx:DataGridColumn dataField="mydata" />
</mx:columns>
</mx:DataGrid>
</mx:HBox>
</mx:VBox>
</mx:Application>Hi
Please select the right Operating system and download the graphic driver and then update the Bios from the link given below and check if the issue is resolved.
Link
Also easy to find out if this is a Hardware issue once unit is powered on keep tapping F10 key and see if the display is the same if yes you might have to replace the screen.
Let us know how it goes!
"I work for HP."
****Click the (purple thumbs up icon in the lower right corner of a post) to say thanks****
****Please mark Accept As Solution if it solves your problem****
Regards
Manjunath -
Problem in tilelist with dataprovider.
I have a problem in tilelist. with the dataprovider a get the
message error
ArgumentError: Error #2025: The supplied DisplayObject must
be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
if i delete the images from the last added to the first one i
have no prob but if i want to delete from the middle i get the
message error th sode that i use is
<mx:TileList id="tileList"
dataProvider="{imgData}"
columnCount="4"
columnWidth="222"
rowCount="2"
rowHeight="194"
themeColor="haloSilver"
verticalScrollPolicy="on"
x="0" y="415" width="100%">
<mx:itemRenderer>
<mx:Component>
<mx:VBox horizontalAlign="center"
verticalAlign="middle" width="222" height="194"
verticalScrollPolicy="off" horizontalScrollPolicy="off" >
<mx:Image id="img" width="165" height="126"
maintainAspectRatio="true" source="{data.asset}" />
<mx:Label id="txt" text="{data.title}"/>
<mx:Button id="del" label="Delete"
click="outerDocument.deleteSnapShot(event)"/>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:TileList>
the function to add the image is :
public function addImgToTile(bm:Bitmap):void{
var bm1:BitmapData = Bitmap(bm1_source.content).bitmapData;
var bitmap:Bitmap = new Bitmap(bm1);
var vo:MyVOBm = new
MyVOBm(bitmap,formatTime(inStream.time));
imgData.addItem(vo);
And the function to delete the image is:
public function deleteSnapShot(ev:Event):void{
imgData.removeItemAt(tileList.selectedIndex);
tx for your helptx Amy for your help here i give you the code that generate
the image from streaming video
<mx:Canvas id="videoHBox" horizontalScrollPolicy="off"
verticalScrollPolicy="off" backgroundColor="#000000" width="456"
height="284" y="37">
</mx:Canvas>
<mx:Button x="464" y="188" label="In" width="48"
id="btnIn" click="addStart(inStream.time);" enabled="true"
visible="true" useHandCursor="true" buttonMode="true" toolTip="Add
Start Image (shotcut Home)"/>
<mx:Button id="Btn_add_action" x="464" y="221" label="Add
Screenshot" click="addImgToTile(bm1)" useHandCursor="true"
buttonMode="true" toolTip="Add Clip (shotcut insert)"/>
<mx:TileList id="tileList"
dataProvider="{imgData}"
columnCount="4"
columnWidth="222"
rowCount="2"
rowHeight="194"
themeColor="haloSilver"
verticalScrollPolicy="on"
x="0" y="415" width="100%">
<mx:itemRenderer>
<mx:Component>
<mx:VBox horizontalAlign="center"
verticalAlign="middle" width="222" height="194"
verticalScrollPolicy="off" horizontalScrollPolicy="off" >
<mx:Image id="img" width="165" height="126"
maintainAspectRatio="true" source="{data.asset}" />
<mx:Label id="txt" text="{data.title}"/>
<mx:Button id="del" label="Delete"
click="outerDocument.deleteSnapShot(event)"/>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:TileList>
variable:
private var videoHolder:UIComponent = new UIComponent();
[Bindable] public var imgData:ArrayCollection = new
ArrayCollection();
init :
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
netSecurityError);
nc.connect(Srv_Name);
videoHolder.setActualSize(Playing_Video_width,
Playing_Video_height);
Playing_Video = new Video(Playing_Video_width,
Playing_Video_height);
videoHolder.addChild(Playing_Video);
Playing_Video.x = 0;
Playing_Video.y = 0;
videoHBox.width = Playing_Video.width;
videoHBox.height = Playing_Video.height;
videoHBox.addChild(videoHolder);
functions:
public function addStart(timecode:Number):void{
var bm:Bitmap = copyBitmap(videoHBox as
UIComponent,timecode,"start");
bm1 = bm;
img_start_time.text = formatTime(timecode);
start_time = timecode;
public function addImgToTile(bm:Bitmap):void{
var bm1:BitmapData = Bitmap(bm1_source.content).bitmapData;
var bitmap:Bitmap = new Bitmap(bm1);
var vo:MyVOBm = new
MyVOBm(bitmap,formatTime(inStream.time));
imgData.addItem(vo);
private function
copyBitmap(source:UIComponent,timecode:Number,origin:String=''):Bitmap
try{
var bmd:BitmapData = new BitmapData( source.width,
source.height );
bmd.draw(source);
corectImg = false;
catch (err:Error){
this.setFocus();
inStream.seek(timecode);
if (origin == "start") setTimeout(addStart,750,timecode);
return new Bitmap(bmd);
public function deleteSnapShot(ev:Event):void{
imgData.list.removeItemAt(tileList.selectedIndex);
and the MyVOBm class is :
package components
import flash.display.Bitmap;
[Bindable]
public class MyVOBm
private var _asset:Bitmap;
private var _title:String;
public function MyVOBm(asset:Bitmap, title:String)
this.title=title;
this.asset=asset;
public function set title(title:String):void{
_title=title;
public function get title():String{
return _title;
public function set asset(asset:Bitmap):void{
_asset=asset;
public function get asset():Bitmap{
return _asset;
Maybe you are looking for
-
Hi! I am trying to do image processing, where it will detect the object and box it up when detected. However, I did not manage to detect the object, which in this case, a masking tape. Can anyone tell me what is wrong and how to solve it? Below is t
-
Max no of lines appear in the back ground job out put
Dear All, Please help me to solve following query, I am execution ME2N report in background. There are more then 100000 line item in the out put. However only 5000 line appear in the output of background job. Is there any setting in sap, where i can
-
E4200 : Guest Access : No IP-address on cascade routers
configuration : 2 E4200 wireless routers. LAN-LAN connected through a cable. router 1 is connected to internet and has DHCP enabled. router 2 is NOT connected to the internet and has DHCP disabled. wireless is enabled on both of them with the same SS
-
Hi all, PS allows to manage sales invoice plan using milestone. Is there any object I can use to manage in the same way a purchase invoice plan directly in PS? Thanks a lot.
-
Documentation for MSE 7.3.101.0 & Services...
Hey guys- Just did an upgrade on a MSE from 7.2.110.0 to 7.3.101.0. This image upgraded my Context Aware Services from 7.2.1.54 to 7.3.0.40 and upgraded my WiPS from 1.0.3010.0 to 1.0.4038.0. Question is.... where do I find the configuration gu