TileList dataProvider problem
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
Similar Messages
-
Problems in tilelist dataprovider
Hi,
I'm newbie in flex. I have a problem in tilelist. How can i
call the child node of the xml file? I'm having "ArgumentError:
Error #2025: The supplied DisplayObject must be a child of the
caller.
at flash.display::DisplayObjectContainer/getChildIndex()
at mx.managers::SystemManager/getChildIndex()
at mx.managers::SystemManager/::mouseDownHandler()".
Please help me. Thanks in advance. Here's my code:
index.mxmlHi Tracy,
Sorry for that. The problem is when i call the
cfilmstrip.dataProvider =
imageXML.image[imgPosition].subcat; I got an error
ArgumentError: Error #2025: The supplied DisplayObject must be a
child of the caller.
at flash.display::DisplayObjectContainer/getChildIndex()
at mx.managers::SystemManager/getChildIndex()
at mx.managers::SystemManager/::mouseDownHandler() when
the browser has flash debugger.
Here are the involved modules for your reference:
index.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
xmlns:tx="com.adobe.as3.tilex.*" layout="absolute"
usePreloader="true" creationComplete="loadXML(event);" width="808"
height="388" backgroundColor="#ffffff" verticalScrollPolicy="off"
horizontalScrollPolicy="off" backgroundGradientColors="[#ffffff,
#ffffff]">
<mx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.controls.Alert;
import flash.net.*;
import mx.effects.easing.*;
import mx.events.ListEvent;
private var imgPosition:int = 0;
private var imageLoader:URLLoader = new URLLoader();
private var imageXML:XML;
private var timer:Timer;
private var samplePosition:int = 0;
[Bindable]
public var selcamp:int;
private function loadXML(e:FlexEvent):void {
imageLoader.addEventListener(Event.COMPLETE,
processImageXML);
imageLoader.addEventListener(IOErrorEvent.IO_ERROR,
ioErrorListener);
imageLoader.load(new
URLRequest("xml/xml_productlines.xml"));
private function ioErrorListener(event:IOErrorEvent):void {
Alert.show( event.text );
private function processImageXML(e:Event):void {
imageXML = new XML(e.target.data);
filmstrip.dataProvider = imageXML.image;
filmstrip.columnCount = imageXML.image.length();
loadImage();
private function loadImage():void {
banner.visible = false;
banner.source = imageXML.image[imgPosition].@filename;
banner.visible = true;
cfilmstrip.dataProvider =
imageXML.image[imgPosition].subcat;
}//end loadImage
private function pickme(imgpick:Number):void
imgPosition = imgpick ;
loadImage();
]]>
</mx:Script>
<mx:Sequence id="slideBan">
<mx:Move xTo="940" duration="2" target="{CampCanvas}"
/>
<mx:Fade alphaFrom="0.0" alphaTo="1.0" target="{banner}"
duration="1000" />
<mx:Parallel>
<mx:Move xFrom="940" xTo="604" duration="900"
target="{CampCanvas}" />
<mx:Fade alphaFrom="0.3" alphaTo="1"
target="{CampCanvas}" duration="900" />
<mx:Blur duration="900" target="{CampCanvas}"
blurXFrom="3.0" blurXTo="0.0"
blurYFrom="3.0" blurYTo="0.0"/>
</mx:Parallel>
</mx:Sequence>
<mx:Canvas horizontalCenter="0" y="0" width="808"
height="388" horizontalScrollPolicy="off"
verticalScrollPolicy="off" id="canvas1">
<mx:Image id="banner" y="0" width="808" height="388"
maxWidth="920" maxHeight="390" showEffect="slideBan"
maintainAspectRatio="false" horizontalCenter="0"/>
<mx:Canvas backgroundAlpha="0.3" id="CampCanvas" x="807"
y="13" width="170" height="188" cornerRadius="12"
backgroundImage="@Embed('image/Banners.png')" borderStyle="solid"
borderThickness="0" verticalScrollPolicy="off"
horizontalScrollPolicy="off">
<tx:TileListEx id="cfilmstrip" itemRenderer="catRenderer"
height="86" verticalScrollPolicy="off" backgroundAlpha="0"
borderStyle="none" columnCount="1" columnWidth="150"
rowHeight="25" useRollOver="false" y="15" x="10">
</tx:TileListEx>
</mx:Canvas>
<mx:Canvas y="288" width="808" backgroundAlpha="0"
height="100" borderStyle="solid" borderThickness="0"
cornerRadius="6" verticalScrollPolicy="off"
horizontalScrollPolicy="off" horizontalCenter="0">
<tx:TileListEx id="filmstrip" itemRenderer="filmRenderer"
height="86" verticalScrollPolicy="off" backgroundAlpha="0"
rowCount="1" borderStyle="none" columnWidth="203"
rowHeight="86" useRollOver="false"
itemClick="pickme(filmstrip.selectedIndex)" y="-1">
</tx:TileListEx>
</mx:Canvas>
</mx:Canvas>
</mx:Application>
catRenderer.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" width="170" height="188" backgroundAlpha="0"
xmlns:tx="com.adobe.as3.tilex.*">
<mx:Canvas width="150" height="50" y="0"
backgroundColor="#FFFFFF" borderStyle="solid" backgroundAlpha="1"
useHandCursor="true" buttonMode="true" mouseChildren="false">
<mx:Label visible="true" text="{data.@cats}"
fontSize="11" y="0" color="#800000" fontWeight="bold"/>
</mx:Canvas>
</mx:Application>
xml_productlines.xml
<?xml version="1.0" encoding="utf-8"?>
<gallery>
<image filename="xml/images/SAILING.jpg"
film="xml/images/sailing_gear.gif" category="SAILING GEAR">
<subcat cats="MAN1"/>
<subcat cats="MAN1"/>
<subcat cats="MAN1"/>
</image>
<image filename="xml/images/SPORTS.jpg"
film="xml/images/sportswear.gif" category="SPORTS WEAR">
<subcat cats="MAN2"/>
<subcat cats="MAN2"/>
<subcat cats="MAN2"/>
</image>
<image filename="xml/images/GOLF.jpg"
film="xml/images/golf.gif" category="GOLF">
<subcat cats="MAN3"/>
<subcat cats="MAN3"/>
<subcat cats="MAN3"/>
</image>
<image filename="xml/images/REGATTA.jpg"
film="xml/images/regatto.gif" category="REGATTA">
<subcat cats="MAN4"/>
<subcat cats="MAN4"/>
<subcat cats="MAN4"/>
</image>
</gallery>
Hope you can help me. Thanks in advance. -
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. -
TileList.dataProvider doesn't update
Hi,
I have two tilelists with a custom itemrenderer, both are
drag, drop & dragMove enabled.
If I drop one item to the other tilelist, in the dragDrop
event the dataProvider doesn't get updated. But if I dragMove an
item the dataProvider gets updated in the same event...
I've tried validateNow and validateDisplayList for the
tilelists but it doesn't update.
Anyone an idea?
Thx!I have had problems with the tileList updating as well. I am
using flash, but I am sure they are similar in nature. For some
reason the tileList doesn't like to update its state until AFTER
the event is done. I am not positive if that is exactly what it is
doing, but if you create a timer that will go off a hair later than
the event, it will update. At least it does for me. :)
It would be nice to know if there is a better solution
though. -
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 -
TileList dataProvider not Showing Correct Item
I have a tileList control that is using an array collection
into a custom ItemRenderer. I can put the TileList directly above a
DataGrid control and see that the filter on the ArrayCollection is
working properly according to the DataGrid, but the TileList
control shows the incorrect item...
What would cause this?
The TileList and the DataGrid use the exact same
dataProvidor, yet the TileList doesn't show the correct item(s)
once it's dataProvider has been filtered.Please disregard - I'm an idiot! Was overthinking this with
my classes and created references within references... Stupid!
:) -
TileList DataProvider Help!
I have an array collection and within that collection I have
objects. Each of those objects has 2 arrays in it (along with other
properties)
When I have an object selected I want the TileList to display
the 2 arrays as its data provider.
I want to handle this the same way the Tree does with it's
DataDescriptor, but I do not know how to do this with the TileList,
any ideas?
Thanks,
ArtTracy,
I want to use the same dataprovider for my TileList and my
Tree. So the data provider is in a hierarchial structure. I want to
point at a given "node" in the dataprovider and the TileList will
display its contents. Since I have a custom hierarchial data
structure, each "node" has two different child nodes (which are
arrays). So the TileList will need to take those two arrays and
display its contents in the list.
The reason I want to do this is because if I remove a child
in the TileList I dont want to manage a seperate dataprovider for
the tree. Also in my environment I will have multiple instances of
each the tree and TileList. I will be using data binding so that I
dont have to manage each and every different set of Tree and
TileList.
If you can point me in the right direction to use a custom
ItemRenderer to display my data the way I want, please let me know.
Here is some example dataprovider...
-------Example Code---------
myDataProvider =
<node1>
<data/>
<data2/>
<children1>
<node1>
<data/>
<data2/>
<children1>
<node1>
<data/>
<data2/>
<children1></children1>
<children2></children2>
</node1>
<node1>
<data/>
<data2/>
<children1></children1>
<children2>
<node2/>
</children2>
</node1>
</children1>
<children2>
<node2/>
<node2/>
<node2/>
</children2>
</node1>
<node1>
<data/>
<data2/>
<children1></children1>
<children2>
<node2/>
</children2>
</node1>
</children1>
<children2></children2>
</node1>
---------------------End of Code-----------
So above is an example of my data structrue, so I want to
pass node1 to the TileList and the TileList will display children1
and children2 in it's list - with keeping an handle back to the
dataprovider so I dont have to manage seperate lists.
Hope this helps clear what I am trying to do, and thanks for
your help so far!
Art -
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.... -
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 -
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; -
Several same objects in a tilelist not selectable
Hello.
I have 2 horizontal lists in my application. The first one
contains images and I am allowed to drag them from first one and
drop in the another one. Everything seems to work perfectly in
first look. I can drag images to one list to another and it copies
the images a move to other one. The problem appears when I move
same image for a several times (2 or more). There seems to be
several items, but the problem is that I can only select the last
one. I have also a numeric stepper there. When I change a value in
other, value changes in another as well.
I think problem is that the objects have same UID, but I
can't figure out how to change that.
Can you please tell me the solution to this problem. I have
totally lost my nerves with this.
Thank you!
Here is the source:
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var valitut_kuvat:ArrayCollection=new
ArrayCollection();
<mx:Canvas label="Choose images">
<mx:TileList
dataProvider="{taustakuvalataus.lastResult.multime dia.images.img}"
dropEnabled="false" allowDragSelection="false" dragEnabled="true"
dragMoveEnabled="false" itemRenderer="Thumbnail"
id="tilelist_kuvat"
creationComplete="taustakuvalataus.send()"></mx:TileList>
<mx:HorizontalList dropEnabled="true" dragEnabled="true"
dragMoveEnabled="true" itemRenderer="Thumbnail2"
dropShadowEnabled="true" id="multimedia_valitut"
dataProvider="{valitut_kuvat}"></mx:HorizontalList>
</mx:Canvas>
-----------Thumbnail.mxml----------------------------------------------
<?xml version="1.0"?>
<mx:VBox xmlns:mx="
http://www.adobe.com/2006/mxml"
xmlns="*" width="80" height="65" horizontalScrollPolicy="off"
verticalScrollPolicy="off" borderStyle="none">
<mx:Image id="img" height="60" width="80"
source="{data.kuva}"/>
</mx:VBox>
-----------Thumbnail2.mxml---------------------------------------------
<?xml version="1.0"?>
<mx:VBox xmlns:mx="
http://www.adobe.com/2006/mxml"
xmlns="*" width="125" horizontalScrollPolicy="off"
verticalScrollPolicy="off" borderStyle="none" height="158">
<mx:Image id="img" height="100" width="120"
source="{data.kuva}"/>
</mx:VBox>i have had the same exact problem, it only happens if you
move one image and have 2 instances of it on the other side. i have
been trying from this mornin to figure out a solution. i am getting
close, ill let u know -
How use PHP to read image files from a folder and display them in Flex 3 tilelist.
Hello. I need help on displaying images from a folder dynamically using PHP and display it on FLEX 3 TileList. Im currently able to read the image files from the folder but i don't know how to display them in the TileList. This is my current code
PHP :
PHP Code:
<?php
//Open images directory
$imglist = '';
$dir = dir("C:\Documents and Settings\april09mpsip\My Documents\Flex Builder 3\PHPTEST\src\Assets\images");
//List files in images directory
while (($file = $dir->read()) !== false)
if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
echo "filename: " . $file . "\n";
$dir->close();
?>
FLEX 3 :
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="pic.send();">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.rpc.events.FaultEvent;
import mx.events.ItemClickEvent;
import mx.rpc.events.ResultEvent;
public var image:Object;
private function resultHandler(event:ResultEvent):void
image = (event.result);
ta1.text = String(event.result);
private function faultHandler(event:FaultEvent):void
ta1.text = "Fault Response from HTTPService call:\n ";
]]>
</mx:Script>
<mx:TileList x="31" y="22" initialize="init();" dataProvider = "{image}" width="630" height="149"/>
<mx:String id="phpPicture">http://localhost/php/Picture.php</mx:String>
<mx:HTTPService id="pic" url="{phpPicture}" method="POST"
result="{resultHandler(event)}" fault="{faultHandler(event)}"/>
<mx:TextArea x="136" y="325" width="182" height="221" id="ta1" editable="false"/>
<mx:Label x="136" y="297" text="List of files in the folder" width="182" height="20" fontWeight="bold" fontSize="13"/>
</mx:Application>
Thanks. Need help as soon as possbile. URGENT.i have made some changes, in the php part too, and following is the resulting code( i tried it, and found that it works.):
PHP Code:
<?php
echo '<?xml version="1.0" encoding="utf-8"?>';
?>
<root>
<images>
<?php
//Open images directory
$dir = dir("images");
//List files in images directory
while (($file = $dir->read()) !== false)
if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
echo "<image>" . $file . "</image>"; // i expect you to use the relative path in $dir, not C:\..........
//$dir->close();
?>
</images>
</root>
Flex Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="callPHP();">
<mx:Script>
<![CDATA[
import mx.rpc.http.HTTPService;
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.rpc.events.FaultEvent;
import mx.events.ItemClickEvent;
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
private var arr:ArrayCollection = new ArrayCollection();
private function callPHP():void
var hs:HTTPService = new HTTPService();
hs.url = 'Picture.php';
hs.addEventListener( ResultEvent.RESULT, resultHandler );
hs.addEventListener( FaultEvent.FAULT, faultHandler )
hs.send();
private function resultHandler( event:ResultEvent ):void
arr = event.result.root.images.image as ArrayCollection;
private function faultHandler( event:FaultEvent ):void
Alert.show( "Fault Response from HTTPService call:\n " );
]]>
</mx:Script>
<mx:TileList id="tilelist"
dataProvider="{arr}">
<mx:itemRenderer>
<mx:Component>
<mx:Image source="images/{data}" />
</mx:Component>
</mx:itemRenderer>
</mx:TileList>
</mx:Application> -
How to get the number of elements in a tilelist
I'm writing test cases for a flex application using FlexSelenium and I need to get the number of elements displayed in the tilelist.
I know that that the tilelist is fed by an array. but i can't access that array from my test case.
Can anyone tell me how I can get the number of elements in a tilelist on the application? which property of the tilelist can provide that number?try tileList.dataProvider.length;
-
How to populate a tilelist via my remote xml file?
I have a mysql database set up and have produced it's contents into an xml format via php. Here is the xml data:-
http://www.coolvisiontest.com/getcategories.php
In my app I've set up a http request pointing to this url but I now need to assign this as the data provider of my tilelist so that the categorynames are displayed within the tilelist. How do I edit the dataprovider of the tilelist to show this?
Here's my code:-
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:HTTPService id="getProductCategories" url="http://www.coolvisiontest.com/getcategories.php" useProxy="false"/>
<mx:TileList dataProvider="{getProductCategories}" x="137" y="84"/>
</mx:Application>I have a mysql database set up and have produced it's contents into an xml format via php. Here is the xml data:-
http://www.coolvisiontest.com/getcategories.php
In my app I've set up a http request pointing to this url but I now need to assign this as the data provider of my tilelist so that the categorynames are displayed within the tilelist. How do I edit the dataprovider of the tilelist to show this?
Here's my code:-
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:HTTPService id="getProductCategories" url="http://www.coolvisiontest.com/getcategories.php" useProxy="false"/>
<mx:TileList dataProvider="{getProductCategories}" x="137" y="84"/>
</mx:Application>
Maybe you are looking for
-
Payment terms using a fixed amount.
Is there a way to create a payment terms for a fixed amount instead of a percent discount. We have a term where the customer can take a 10.00 discount if paid within 30 days. All i can see is a percent of discount. This wont work cause the invoice
-
No Integration Server under Adapter Engine at Communication Channel
Hello all, This is new PI7.0 install. I configured a file Adapter communication channel for an Integration Scenario. At field "Adapter Engine" under Parameters tap I am not able to select the Integration Server. Pull down menu is empty. I did sxmb_ad
-
CS5 Design premium download problem,
i hope the group can help me, I ahve downloaded the CS5DP suite for the mac and it says download complete. When it tries to mount the DMG file it says verify fail, checksum error, this is bad. I have tried both Akami and the alternative link. The fil
-
Hey there - Is seems re - linking is different for every outside software (PS, Ai and so on), and so I'd like to ask you how to re link my C4D file with my AE project... I've begun working on a AE project using some 3D elements and the Maxon link, an
-
Hi, I´m moving my works to new JDev release3. I used GridBagLayout earlier, but I have face a little problem. There is no grid on background in new release! How can I get grid to shown in GridBagLayout?? Design --> Show Grid is invalid option. I have