ArrayCollection error
Hi All,
I am getting this error when i try to add an item to an arrayCollection:
Error: Find criteria must contain at least one sort field value.
at mx.collections::Sort/findItem()
at mx.collections::ListCollectionView/getItemIndex()
I have an advanced datagrid, base on a comboBox change I reload the data to the dataprovider so I have to remove all the items from the arraycollection and add the new data to be display in my ADG.
I was removing the items with removeAll, the error was showing at this line so change my code to using:
myArrayCollection = null;
myArrayCollection = new ArrayCollection();
After adding the new items to the array collection using a loop I have a sort:
----Loop----
tempObject = new Object();
myArrayCollection.addItem(tempObject);
myArrayCollection.refresh();
----End Loop----
var sort:Sort = new Sort();
my_adg.validateNow();
sort.fields = [new SortField("MY_FIELD",true)];
my_adg.dataProvider.sort = sort;
my_adg.dataProvider.refresh();
If I remove this sort, all work.
What is the issue here? The null is not removing the sort?
Also, in my ADG I have grouping collection.
<mx:GroupingCollection id="myGroupedData" source="{myArrayCollection}" >
Any ideas?
Thanks
Johnny
Hi,
Thanks for reply and help.
"MY_FIELD" is there, i just checked. I think I need to sort the ADG grouping in different way.
I am checking this link:
http://cookbooks.adobe.com/post_How_to_sort_items_within_group_in_AdvancedDataGrid-13047.h tml
I am not using action script to create my grouping.
I try this:
myGroupedData.grouping.fields.compareFunction = positionCompareFunction;
myGroupedData.refresh();
private function positionCompareFunction(a:Object, b:Object):int
return ObjectUtil.stringCompare(a.MY_FIELD, b.MY_FIELD);
But it's not working. Any one can help with this?
Thanks
Johnny
Similar Messages
-
HTTPService and ArrayCollection Error
Update:
After some debugging I think I have found my own answer .
I have added the following line to the event code:
var i:int = evt.result.result.item.length;
When debugging this value if my XMl list has 2 or more items
then the length value returns 2 or more.
i.e. 2 items length =2, 6 items length=6 and so on.
but for 1 item the length =0 (?) so although there is 1 item
in the list and it shows in the debugger the value reported is 0
which might explain wht it cannot be set as an ArrayCollection.
I am processing the result of an HTTPService send in an event
to create an arraycollection of items( using some example code I
found on the net). Basically if the data is received OK then the
items in the XML are cast an an arraycollection and they are
processed. The lines to cast this is as follows.
var source:ArrayCollection = evt.result.result.item as
ArrayCollection;
var cursor:IViewCursor = source.createCursor();
while (!cursor.afterLast){
var currentObj:Object = cursor.current;
//..... code here to manipulate data
cursor.moveNext();
I then iterate through the cursor. The problem I have is
that it all works fine if there are 2 or more "items" returned in
the XML but if there is only 1 item the source var does not get
created and so the rest of the code fails. Does anyone have any
ideas as to why ? I guess I can "get around it" by detecting only 1
item and processing it differently but it would be good to use the
same code.
btw. only be using flex for 4 days so I think it is very
probably my extreme lack of actionscript knowledge.
thanks.I had the same problem and I got the solution from the net:
if( event.result.dataroot.city is ArrayCollection )
myAC = event.result.dataroot.city as ArrayCollection
else
myAC = new
ArrayCollection(ArrayUtil.toArray(event.result.dataroot.city));
I don't mean to hijack the post but it seems relevant. I
encounter the same problem with the Array class (instead of
ArrayCollection). I've used the above method and it does return the
length of 1. However, I tried to access the sub-element and it
crashes because that becomes a null.
Again, the array was set as follow initially which crashes
right the way when there is one market on that day:
MarketArray = event.result.list.day.Market.source as Array;
This will be fine:
MarketArray = new Array
(ArrayUtil.toArray(event.result.list.day.Market.source ));
But, as soon as I access the sub-items underthe market, it
return null.
var iSize = MarketArray[0].stats.length; // where it should
return 3 items.
Anyone has input? -
Howdy everyone!
I've only been playing with Flex for about 6 weeks or so and
I've figured out lots and lots from the online tutorials and help
system. However the project that I'm trying to put together
requires that I can pass data back and forth to Db's. I haven't
even tried to write into a database yet because for the last 3
weeks I've been trying every combination (except the working one's)
to write my Db data into XML and use an HTTPService tag to retrieve
it for use as dataProviders. I've tried everything remotely related
on this site. Several others I've found online and modified the
resultFormat and my variable types in every combination
(resultFormat = "[' ', Object, xml, e4x, text, array]" &
myDP:[ArrayCollection, Array, XML, XMLList, XMLListCollection]) and
have received as many errors & nonworking results for my
efforts. I'm not sure if perhaps there's a PHP/MySQL setting on my
server that's not set how it should be? or if I just have failed to
notice some simple detail.
Here's the PHP version I currently believe most promising:
quote:
<?php
require_once('Connections/peaceheartconnection.php');
header("Content-type: text/xml");
mysql_select_db($database_peaceheartconnection,
$peaceheartconnection);
$query_topics = "SELECT * FROM p_insight_topics";
$topics = mysql_query($query_topics, $peaceheartconnection)
or die(mysql_error());
$row_topics = mysql_fetch_assoc($topics);
$totalRows_topics = mysql_num_rows($topics);
mysql_select_db($database_peaceheartconnection,
$peaceheartconnection);
$query_categories = "SELECT * FROM p_insight_types";
$categories = mysql_query($query_categories,
$peaceheartconnection) or die(mysql_error());
$row_categories = mysql_fetch_assoc($categories);
$totalRows_categories = mysql_num_rows($categories);
print("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
$dataXML = '';
$dataXML .= "<data><categories>";
while($cat = mysql_fetch_object($categories))
$dataXML .= "<category>$cat->type</category>"
$dataXML .= "</categories>";
$dataXML .= "<topics>";
while($topic = mysql_fetch_object($topics))
$dataXML .="<topic>$topic->topic</topic>";
$dataXML .= "</topics></data>";
?>
<?php
echo $dataXML;
?>
<?php
mysql_free_result($topics);
mysql_free_result($categories);
?>
This gives me results that show up in the browser identical
to
An XML file from
"Flex 2 Training from the Source" (I event get the "no
associated style information ... document tree is shown" message
from Firefox).
Here are the relevant parts of the Flex app:
quote:
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
xmlns:ns1="Components.*" layout="absolute" autoLayout="true"
horizontalScrollPolicy="off" verticalScrollPolicy="off"
creationComplete=" getData()" >
<!-- Service Definitions -->
<mx:HTTPService id="getTypesNTopics" url="../../data.xml"
method="POST" useProxy="false"
result="showData(event)" fault="handleFault(event);" />
<mx:HTTPService id="getTypesNTopics2"
url="../../topicsNcategories5.php" method="POST" useProxy="false"
result="showData2(event)" fault="handleFault2(event);" />
<!-- End Service Definitions-->
<mx:Script>
<![CDATA[
import mx.collections.XMLListCollection;
import mx.effects.*;
import mx.effects.easing.*;
import mx.containers.*;
import mx.core.*;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.events.FlexEvent;
import mx.controls.Alert;
import flash.events.*;
import mx.managers.DragManager;
import mx.events.DragEvent;
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
[Bindable] private var topicsAC:ArrayCollection = new
ArrayCollection();
[Bindable] private var categoryAC:ArrayCollection = new
ArrayCollection();
[Bindable] private var topics2AC:XMLListCollection = new
XMLListCollection();
public function getData():void
getTypesNTopics.send();
getTypesNTopics2.send();
private function showData2(event:ResultEvent):void
//topics2AC = event.result.data.topics.topic;
lastResultValue2.text = "Event, Categories:"
+event.result.data.categories.category
+ "Event, Topics:" + event.result.data.topics.topic;
scrollMenu.dataProvider = event.result.data.topics.topic;
lastResultValue2.text = "Result: " +
String(event.result.data.topics.topic);
private function handleFault2(event:FaultEvent):void
lastResultValue2.text = "Error: " + event.fault;
(Keep in mind that the function & service tag contents
are just the latest version as of 20 mins ago.)
Any help would be greatly appreciated. There are still dozens
of other things I want to get working on but there's no point until
I can get my app. to talk with mySQL (databases). I'm begging
PLEASE after weeks of wasting time trying to get my <topic>
& <category> nodes to populate two ComboBoxes I just
wrote a static XML file last night--just so I could feel like I had
accomplished something (that's what the first Service tag does).
Thanks 2^65536 times!
ToddAs it is posted right now (resultFormat (rF) = default object
with the result assigned directly), I don't receive an error but
lastResultValue.text & scrollMenu (a comboBox) both read
"$topic->topic."
With rF = default (object) & topics2AC:ArrayCollection
(assigned to the text & CB) I get: "Type Coercion failed:
cannot convert "$topic->topic" to
mx.collections.ArrayCollection. ..."
With rF = e4x, data type (dT) = arrayCollection I get:
"Error: [RPC Fault faultString="Error #1088: The markup in the
document following the root element must be well-formed."
faultCode="Client.CouldNotDecode" faultDetail="null"] "
(e4x is the format that I WANT to use, but anything working
will suffice for now)
rF = xml, dT = AC: "Property data not found on
flash.xml.XMLDocument and there is no default value."
With the "xml version" tag removed rF = e4x, dT =
XMLListCollection I get " Error #1034: Type Coercion failed: cannot
convert "$topic->topic" to mx.collections.XMLListCollection."
Likewise with dT=arrayCollection: "Error #1034: Type Coercion
failed: cannot convert "$topic->topic" to
mx.collections.ArrayCollection." (Same with dT=XMLList)
The underlying code(source) of the PHP page's output is:
"<data><categories><category>Poem</category>
...</categories><topics><topic>Teaching</topic>...<topic>Kids</topic></topics></data>"
There's an empty line above the source. The <?xml version="1.0"
encoding="utf-8"?> tag is/isn't there depending on whether I
leave it in or not. I don't know how/why the empty line is there.
The general result seems to be that I get either "cannot
decode" using e4x, "cannot convert $topic->topic" using anything
else. Perhaps the problem is still in the PHP, but Firefox
recognizes & treats it as valid XML giving me the "
This XML file does not appear to have any style information
associated with it. The document tree is shown below.
−
<data>
−
<categories>
<category>Poem</category>
<category>Song</category>
<category>Prayer</category>
<category>Idea</category>
<category>Whim</category>
<category>Enlightenment</category>
<category>Quote</category>
<category>Answers</category> ..." when I call the
page. So I'm at a loss as to what to even try anymore.
Thanks again anyone, everyone
Merry Christmas, Happy Hannukah, Happy Holidays, etc.
Todd -
Error while Adding Elements in a ArrayCollection .
Hi ,
I have created a ArrayCollection and trying to add elements to it using ArrayCollection.addItem("NewElement");
In the response it is giving me a compile error showing
"Variable 'NewElement' is not defined "
var myArrayCollection:ArrayCollection = new ArrayCollection();
myArrayCollection.addItem("NewElement");
Can anybody please let me know how to resolve this ??
Thanks in advance .It should not give any error...
The error "Variable 'NewElement' is not defined " will only come if you used the 'NewElement' without any quotes...
If you use
var myArrayCollection:ArrayCollection = new ArrayCollection();
myArrayCollection.addItem(NewElement);
then only it will show the error "Variable 'NewElement' is not defined " but if you give as below it doesn;t show any error..
var myArrayCollection:ArrayCollection = new ArrayCollection();
myArrayCollection.addItem("NewElement");
Check whether you have used quotes around the word NewElement or not.
Thanks,
Bhasker Chari -
LCDS commit error from arraycollection
Hi all,
I am attempting to hook Flex up to the LCDS engine installed
with CF8. I can get the ds.fill() method to populate an
ArrayCollection just fine, pump the data out in a DataGrid and
shows perfectly. However, when I update a record in the datagrid I
get an error indicating that "Error during update: The OLDBEAN
argument passed to the update function is not of type" and then it
says my CFC type.
I changed to code to set autoCommit to false and update one
entrry via code then manually call commit, and this works fine,
although I did have to cast the single record to my data type (it
was a generic Object). Setting it back and debugging shows that all
of the records in my ArrayCollection are typed as generic Object's
not as my defined data type.
My question is: how do I get the ds.fill() method to return
the correctly typed objects (I am using the CF8 wizard-generated
CRUD arguments)
OR
How can I programatically convert the contents of the
ArrayCollection to the required type "on-the-fly" before calling
ds.commit()?
Hoping somebody can help, this is driving me nuts!
Just as a final thought, does this indicate a bug in the CF
CRUD generation wizard or am I just doing it wrong?
Cheers,
Owen West
HNE Health
[email protected]Which the information provide it's hard to troubleshoot because there's no Oracle related information.
What's your Oracle version? do you have enough space on rollback segment tablespace or undo tablespace (9i and above)
Any error in your database's alert log file? -
Error when reading data in to ArrayCollection using HTTPService
Hi,
I am trying to read data in to ArrayCollection using HTTPService result property:
[Bindable] private var myData:ArrayCollection=new ArrayCollection();
private function result_handler(e:ResultEvent):void
myData = e.result.root.contact;
<mx:HTTPService id="post_submit"
url="test.php"
method="POST"
result="result_handler(event)"
fault="fault_handler(event)">
<mx:request xmlns="">
</mx:request>
</mx:HTTPService>
I am getting the following error when there is no "contact" record in the xml root:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
Also I am getting the following error when there is only ONE "contact" record in the xml root:
TypeError: Error #1034: Type Coercion failed: cannot convert mx.utils::ObjectProxy@280c9ca1 to mx.collections.ArrayCollection.
And it works fine when there is two or more "contact" records in the xml root.
Am I missing something?
ThanksI am getting the following error when there is no "contact" record in the xml root:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
You'll be getting this error because it's trying to access nodes that don't exist;
there are no 'contact' records, thus when it tries to access node 'root.contact', it doesn't exist, hence it's receiving NULL when it's expecting something
Also I am getting the following error when there is only ONE "contact" record in the xml root:TypeError: Error #1034: Type Coercion failed: cannot convert mx.utils::ObjectProxy@280c9ca1 to mx.collections.ArrayCollection.
And it works fine when there is two or more "contact" records in the xml root.
Am I missing something?
Thanks
When there is only 1 value, it'll be returned as an object (Arrays are used for multiple items). So it throws an error as it isn't expecting a single object, it wants an Array.
This is also why when it returns 2+ records, there is no error. Multiple results will be returned as an Array, what your flex app was expecting.
My initial guess to solve the first problem would be similar to Greg's, although i'm guessing you'd want;
if(e.result != null){
instead of
if(e.result.root.contact != null){
as you'd initially want to check if anything was returned in the result, rather than checking to see if a certain node exists.
If you attempt to see if a certain node isn't null, and the node doesn't exist, it'll probably throw another #1009
For the #1034 error, you'll have to check to see how many results were returned, as Madhav has described for you. -
Hi All,
Having an error hoping someone can help me! Baiscally I have a chart object and a grid object that is based off of this ArrayCollection that is dynamically created but I cannot get the grid or chart to show the data even though I can see the data is in the list in debug view: My code:
//Before This I do a lot of ifs and counts to get he total for the month based on an XML Collection then I have:
BarData1.addItem([
{ Month:
"Aug2008", Admitted: amonth1, NotAdmitted: nmonth1, Pending: pmonth1}]);
BarData1.refresh();
My chart and Grid look like this:
<mx:DataGrid x="536" y="127" dataProvider="{BarData1}">
<mx:columns>
<mx:DataGridColumn headerText="Month" dataField="Month"/>
<mx:DataGridColumn headerText="Admitted" dataField="Admitted" />
<mx:DataGridColumn headerText="NotAdmitted" dataField="NotAdmitted" />
<mx:DataGridColumn headerText="Pending" dataField="Pending"/>
</mx:columns>
</mx:DataGrid>
<mx:ColumnChart x="65" y="40" id="columnchart1" dataProvider="{BarData1}">
<mx:horizontalAxis>
<mx:CategoryAxis dataProvider="{BarData1}" categoryField="Month"/>
</mx:horizontalAxis>
<mx:series>
<mx:ColumnSeries displayName="Admitted" dataProvider="{BarData1}" yField="Admitted" xField="Month"/>
</mx:series>
</mx:ColumnChart>
<mx:Legend dataProvider="{columnchart1}" x="10" y="40"/>
(Sorry not sure how everyone gets code in here?)
Anyone see what I missed?Hi,
when u add an objct value to ur array collection u need to chage the format
u add like this
BarData1.addItem({ Month:"Aug2008", Admitted: amonth1, NotAdmitted: nmonth1, Pending: pmonth1});
if in the above amonth1, nmonth1, pmonth1 are variable then it's fine otherwise u give quots like first filed.
i think this answer help u.
if u sucess then give me mark. -
ArrayCollection & AddEventListener: error 1006
HI..
in order to handler some custom components (usuallyCanvas) I need to put them in an ArrayCollection....
the problem is that a this point I can't use AddEventListener on AC objects.....
myArrayCollection[index].AddEventListener give me the error nr. 1006...
because AddEventListener is not a method for myArrayCollection[index]
someone can help me?
questa soluzione http://www.gongon2.com/flex/pippo/bin/OrizListOL.html non posso usarla...
now I show you how make AC, maybe error is here...
Codice:
import com.myComponents.*;
private function LoadInterfaces():void {
myArrayCollection.addItemAt( FirstMenu, 0 );
myArrayCollection.addItemAt( SecondMenu, 1 );
myArrayCollection.addItemAt( ThirdMenu, 2);
in com.myComponents there are Firs Second e Third menu, of course
bye and thanks for aids@Michael Borbor
Hi there, if you want to handle components you should add the event listener to the components, why do you want to add a listener to the AC? Even though you could use setters to have some sort of awareness over the ac changes.
Because, I must add and remove differents effect listener... so I want handle my menu only a structure, myArrayCollection
@Greg Lafrance
Menu(myArrayCollection[index].AddEventListener(.........));
where Menu is whatever type you are dealing with (need to know in advance).
Thank but doesn't work.... I've tried with DisplayObject but cast give me an error...
cast in Object works, but Object has not AddEventListener
@ergo_eleven
You problem is that you trying to assign event listener to an object that does not an IEventDispatcher. [omissis]
Yes, you have hit the target,
but I prefered don't create a new istance.....
but if this is the only way, I'll walk it...
Thanks at all three for your advice! -
Error after close popup with swfloader
Hi all, hope some one could help me with this i get this
error ( Error: Unable to load '' ) each time after i close a popup
with a swfloader the error popsup when i click on the datagrid
*****************************main mxml
private function ShowPano():void
var SWFLoaderInstance:Panoramica2 =
Panoramica2(PopUpManager.createPopUp(this,Panoramica2,true));//
instantiate and show the title window
PopUpManager.centerPopUp(SWFLoaderInstance);
SWFLoaderInstance.mainAppPano = this //Reference to the main
app
scope
*******************************this is the mxml Panoramica2
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="doInt()"
cornerRadius="10" width="600" height="450">
<mx:Script><![CDATA[
import mx.controls.PopUpMenuButton;
import mx.managers.PopUpManager;
import mx.collections.ArrayCollection;
import mx.controls.Button;
[Bindable]public var mainAppPano:Object = null;
//called by the close event raised byclicking the close
button
private function closeWindow():void
PopUpManager.removePopUp(this);
}//closeWindow
private function doInt():void
PopUpManager.centerPopUp(this);
]]>
</mx:Script>
<mx:TitleWindow layout="absolute" right="10" left="10"
showCloseButton="true"
close="closeWindow()" top="10" bottom="10">
<mx:SWFLoader
source="{mainAppPano.datagrid.selectedItem.pano..src}"
scaleContent="false"
horizontalCenter="0" verticalCenter="0"/>
</mx:TitleWindow>
</mx:Canvas>
********************************xml structure
<catalog>
<libro>
<name><![CDATA[<b>Biblioteca Central
</b> ]]></name>
<desc><![CDATA[Se inauguró el 20 de noviembre
de 1978 ]]></desc>
<imagen>FOTOS/est/Biblioteca Central Manuel Bartlett
Bautista.jpeg</
imagen>
<pano nombrePano="Biblioteca Central Bautista">
<src>FOTOS/Panoramicas/PanoZoom642007.swf</src>
</pano>
<ico>BOTONES/gifs/video.gif</ico>
<video nombreVid="Biblioteca Manuel Bartlet">
<src>VIDEOS/Biblioteca Manuel Bartlet.flv</src>
</video>
<audio/>
<pie>Biblioteca Central Manuel Bartlett
Bautista</pie>
</libro>
</catalog><script type="text/javascript">
function saveChanges(){
doSubmit('SUBMIT');
var test = $x('P7_FLAG').value;
if(test == '1')
window.close();
window.opener.doSubmit('REFRESH');
</script>javascript does not wait for the current action to complete and then perform the next line.
means in your function call
doSubmit('SUBMIT');is triggered and it carry on's to next line that is
$x('P7_FLAG').value;this will not be set because you are setting the value of P7_FLAG to 1 in plsql and trying to check in javascript, which will not work.
what you need to do is amend your js function like below
<script type="text/javascript">
function saveChanges(){
doSubmit('SUBMIT');
</script>create a page branch to procedure and make it conditional to when P7_FLAG = 1
and set the branch source to below
htp.p('window.close();');
htp.p('window.opener.doSubmit(''REFRESH'');'); -
Problem updating a SOAP Web Service with ArrayCollection
Hello,
I am having issues POST'ing an ArrayCollection to a C# Web
Method. Here's how I have my application set up:
I have a DataGrid in my application and set the dataProvider
to be the result object of a Web Service operation. I set the
DataGrid's editable property to "true" and would like to be able to
edit the data and send off the DataGrid's dataProvider as the
parameter for the Web Method. If I edit the first row of the
DataGrid and trigger the operation, it gets saved just fine. If I
try to edit any other row this way, it keeps sending the same
packet (as verified by a packet sniffer) not allowing me to update
any other row. It seems the Web Service is sending the first 255
characters of the serialized ArrayCollection.
My questions are: why is this happening?
and
How can I fix this?
Here is the request of my Web Service operation:
<mx:request xmlns="">
<GlossaryTerms>
{GlossaryArrayCollection}
</GlossaryTerms>
</mx:request>
This is the definition of GlossaryArrayCollection:
[Bindable]
public var GlossaryArrayCollection:ArrayCollection = new
ArrayCollection();
Here is the SOAP packet that the C# Web Method is expecting:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
xmlns:soap12="
http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GlossaryUpdate xmlns="">
<GlossaryTerms>
<Glossary cID="int" cDeleted="boolean" cTerm="string"
cDefinition="string" cURL="string" cPublic="boolean"
cRowVersion="string"/>
<Glossary cID="int" cDeleted="boolean" cTerm="string"
cDefinition="string" cURL="string" cPublic="boolean"
cRowVersion="string" />
</GlossaryTerms>
</GlossaryUpdate>
</soap12:Body>
</soap12:Envelope>
Thanks to anyone for their help.
Brian CaryWhere exactly you are seeing this error? possible for you share the screenshot?
Execution failed: These policy alternatives can not be satisfied:
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}SupportingTokens -
Trying to add a motion path to a panel but i get errors...
hey guys.. im trying to move a panel container from one location to another..
basically when i start off the application the panel's horizontalCenter is set to "0"
what i need it to do is move from that center location to left.
the code i have is...
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%"
xmlns:imageHandler="modules.imageHandler.*">
<fx:Script source="loginSuccessScript.as" />
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:ArrayCollection id="sourceData">
<fx:Object label="Content Group" stackId="contentGroup" />
<fx:Object label="Images" stackId="images" />
<fx:Object label="Videos" stackId="videos" />
<fx:Object label="Flash Objects" stackId="flashObjects" />
<fx:Object label="Story Editor" stackId="storyEditor" />
<fx:Object label="Tag Management" stackId="tagManagement" />
<fx:Object label="Image and Video Format" stackId="format" />
<fx:Object label="Rules And Permissions" stackId="rulesAndPermissions" />
</s:ArrayCollection>
<s:Parallel id="clickMove" target="navContainer">
<s:Animate duration="250">
<s:SimpleMotionPath id="motionPath" valueFrom="0" valueTo="300"/>
</s:Animate>
<!--s:Fade id="fade" alphaFrom="0.4" alphaTo="1.0"/-->
</s:Parallel>
</fx:Declarations>
<s:states>
<s:State name="all" />
<s:State name="videoUpload" />
<s:State name="imageUpload" />
<s:State name="contentGroup" />
<s:State name="flashObjects" />
</s:states>
<s:HGroup horizontalCenter="0">
<s:Panel id="navContainer" width="250" height="100%">
<s:List id="nav" width="250" height="100%" dataProvider="{sourceData}" click="updateStack()" />
</s:Panel>
<s:Panel width="100%" height="100%" visible="false">
<mx:ViewStack id="displayComponents" creationPolicy="all">
<mx:Canvas id="blank">
</mx:Canvas>
<mx:Canvas id="images">
<imageHandler:imageHandler />
</mx:Canvas>
</mx:ViewStack>
</s:Panel>
</s:HGroup>
</s:Group>
and in my actionscript in the updateStack function, i just call clickMove.play();
ive also tried setting the simpleMotionPath property to "x" and "left" and neither of them work...
and when i play the animation i get an error that says
"error: Property null is not a property or a style on object navContainer: TypeError: Error #1006: value is not a function..
or
"error: Property x is not a property or a style on object navContainer: TypeError: Error #1006: value is not a function..
or
"error: Property left is not a property or a style on object navContainer: TypeError: Error #1006: value is not a function..ok never mind... so i think this i have my problem almost figured out...
i changed my code to resemble the following...
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%"
xmlns:imageHandler="modules.imageHandler.*">
<fx:Script source="loginSuccessScript.as" />
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:ArrayCollection id="sourceData">
<fx:Object label="Content Group" stackId="contentGroup" />
<fx:Object label="Images" stackId="images" />
<fx:Object label="Videos" stackId="videos" />
<fx:Object label="Flash Objects" stackId="flashObjects" />
<fx:Object label="Story Editor" stackId="storyEditor" />
<fx:Object label="Tag Management" stackId="tagManagement" />
<fx:Object label="Image and Video Format" stackId="format" />
<fx:Object label="Rules And Permissions" stackId="rulesAndPermissions" />
</s:ArrayCollection>
<s:Parallel id="clickMove" target="{cont}">
<s:Animate duration="500">
<s:SimpleMotionPath id="motionPath" property="left" valueFrom="0" valueTo="600"/>
</s:Animate>
<!--s:Fade id="fade" alphaFrom="0.4" alphaTo="1.0"/-->
</s:Parallel>
</fx:Declarations>
<s:states>
<s:State name="all" />
<s:State name="videoUpload" />
<s:State name="imageUpload" />
<s:State name="contentGroup" />
<s:State name="flashObjects" />
</s:states>
<s:HGroup horizontalCenter="0" id="cont" height="100%" width="100%">
<s:Panel id="navContainer" width="250" height="100%" left="300">
<s:List id="nav" width="250" height="100%" dataProvider="{sourceData}" click="updateStack()" />
</s:Panel>
<s:Panel width="30" height="100%" creationPolicy="all">
<mx:ViewStack id="displayComponents" creationPolicy="all">
<mx:Canvas id="blank">
</mx:Canvas>
<mx:Canvas id="images">
<imageHandler:imageHandler />
</mx:Canvas>
</mx:ViewStack>
</s:Panel>
</s:HGroup>
</s:Group>
forsome reason my hgroup will not center its self to the window... any reason why? -
Implicit coercion Error while Adding Dynamic Rows To Flex DataGrid
Hi friends
I want to add interger for in next next rows while clicking tab button,one i enter all the values in one row if i press tab means next row will be editable.for making that i added the following code.i have some error shows like this
[Bindable]
private var tasks:ArrayCollection;
private static const ADD_TASK:int= "";
private function init():void
tasks = new ArrayCollection();
tasks.addItem(new Task(0.01,100000,0));
tasks.addItem({frmAmount:ADD_TASK});
private function checkEdit(e:DataGridEvent):void
// Do not allow editing of Add Task row except for
// "Click to Add" column
if(e.rowIndex == tasks.length - 1 && e.columnIndex != 0)
e.preventDefault();
private function editEnd(e:DataGridEvent):void
// Adding a new task
if(e.rowIndex == tasks.length - 1)
var txtIn:TextInput =TextInput(e.currentTarget.itemEditorInstance);
var dt:Object = e.itemRenderer.data;
// Add new task
if(parseInt(txtIn.text) != ADD_TASK)
tasks.addItemAt(new Task(parseInt(txtIn.text), 0, ""), e.rowIndex);----->Multiple markers at this line:
-1067: Implicit coercion of a value of type String to an unrelated type int.
-txtIn
// Destroy item editor
commPlanDetGrid.destroyItemEditor();
// Stop default behavior
e.preventDefault();
]]>
Please help if any suggession
Thanks in advance
B.VenkatesanVenktesan,
You are trying compare String and int..! which is not possible try to case the txtIn.text to int using parseInt(txtIn.text).
ORIGINAL:
if(txtIn.text != ADD_TASK).---->error : Comparison between a value with static type String and a possibly unrelated type int
tasks.addItemAt(new Task(txtIn.text, 0, ""), e.rowIndex);----> error:Implicit coercion of a value of type String to an unrelated type int.
EDITED:
if(parseInt(txtIn.text) != ADD_TASK).---->error : Comparison between a value with static type String and a possibly unrelated type int
tasks.addItemAt(new Task(parseInt(txtIn.text), 0, ""), e.rowIndex);----> error:Implicit coercion of a value of type String to an unrelated type int.
Thanks
Pradeep -
Is this a bug: ModelLocator.ArrayCollection.length
ModelLocator.ArrayCollection.length that equals to 4 starting
from index 0 (zero)
I see:
going into the objects using for each item i see correctly:
item:[object Object]
item:[object Object]
item:[object Object]
item:[object Object]
going into the objects using for loop with
ModelLocator.ArrayCollection.length, it is not counting the full
length:
0 --this is page:springgraph16.UIComponent0.template1 with
index:0 and pageid:1
1 --this is page:springgraph16.UIComponent0.template2 with
index:1 and pageid:2
2 --this is page:springgraph16.UIComponent0.template3 with
index:2 and pageid:3
If I index into ModelLocator.ArrayCollection[3] in the for
loop I get errors.
example:
checked the length with:
trace("---lenbefore:" + __modelLocator.siteRef.length); //
displays a trace, ---lenbefore:3
__modelLocator.siteRef.addItem(templatesAllData);
trace("---lenafter:" + __modelLocator.siteRef.length) //
displays a trace, ---lenafter:4
THIS WORKS AND DISPLAYS 4 ITEMS:
for each (var item:* in __modelLocator.siteRef){
trace("item:" + item);
trace result is:
item:[object Object]
item:[object Object]
item:[object Object]
item:[object Object]
THIS DOES NOT WORK:
for(s =0 ; s < __modelLocator.siteRef.length; s++){
trace(s +" --this is page:" +
__modelLocator.siteRef[s]['template']);
trace("CHECK:" +__modelLocator.siteRef[3]['template']); //
this thoughts up an error below:
ERROR: RangeError: Index '3' specified is out of bounds.
which is why these do not work in the for loop:
for(s =0 ; s <= __modelLocator.siteRef.length; s++)
for(s =0 ; s < __modelLocator.siteRef.length+1;
s++)If you use the debugger and step through the ArrayCollection
as it does each loop - what does the watch variables panel show?
This shouldn't make a difference, but out of curiosity -
after the AC has all it's day, if you make a copy of it and then
loop over it... what happens...? E.g.:
__modelLocator.siteRef.addItem(templatesAllData);
var newAC : ArrayCollection =
ObjectUtil.copy(__modelLocator.siteRef);
for(s =0 ; s < newAC.length; s++)
Or another idea... instead of accessing the AC via index
(e.g. siteRef[s]), what if in the loop you do a getItemAt(s)? -
I am getting the following error while migrating my application from Flex 3.6 to Flex 4.5.1:
1067: Implicit coercion of a value of type __AS3__.vec:Vector.<Object> to an unrelated type Array.
The error is thrown on the following piece of code:
var list:ArrayCollection=new ArrayCollection(dgSoftwareTitles.selectedItems);
dgSoftwareTitles is defined as:
<s:DataGrid id="dgShareCategoryForTransfer"
x="34"
y="369"
requestedRowCount="5"
width="90%"
selectedIndex="-1"
selectionMode="multipleRows">
<s:columns>
<s:ArrayList>
<s:GridColumn headerText="SoftwareTitle"
dataField="idSoftware"
visible="false"/>
<s:GridColumn headerText="SoftwareName"
dataField="softwareName"
visible="false"/>
...more GridColumns
</s:columns>
</s:ArrayList>
</s:DataGrid>
Any ideas why this would trow the "1067: Implicit coercion of a value of type __AS3__.vec:Vector.<Object> to an unrelated type Array" error?
Thanks!
LeeI think that dgSoftwareTitles.selectedItems is a type of Vector while
public function ArrayCollection(source:Array = null) expects an array as a source. -
Error while saving dynamic row values of datagrid with record.
hi friends,
i am trying to add dynamic row in datagrid and save that value with record.i succeeded in first part while i am saving the record the error show like this.
errro:Property fromAmount not found on com.ci.view.Task and there is no default value.
how i resolve this error.
any suggession welcom
thanks in advance.
B.venkatesan
code:
package:
package com.ci.view
[Bindable]
public class Task
public function Task(frmAmount:String,toAmount:String,commissionPercentage:String)
this.frmAmount=frmAmount;
this.toAmount=toAmount;
this.commissionPercentage=commissionPercentage;
public var frmAmount:String;
public var toAmount:String;
public var commissionPercentage:String;
main mxml:
[Bindable]
private var tasks:ArrayCollection;
private static const ADD_TASK:String= "";
private function init():void
tasks = new ArrayCollection();
tasks.addItem(new Task("0","1000","0"));
tasks.addItem({frmAmount:ADD_TASK});
private function checkEdit(e:DataGridEvent):void
// Do not allow editing of Add Task row except for
// "Click to Add" column
if(e.rowIndex == tasks.length - 1 && e.columnIndex != 0)
e.preventDefault();
private function editEnd(e:DataGridEvent):void
// Adding a new task
if(e.rowIndex == tasks.length - 1)
var txtIn:TextInput =TextInput(e.currentTarget.itemEditorInstance);
var txtIn1:TextInput =TextInput(e.currentTarget.itemEditorInstance);
var txtIn2:TextInput =TextInput(e.currentTarget.itemEditorInstance);
var dt:Object = e.itemRenderer.data;
// Add new task
if((txtIn.text) != ADD_TASK)
var x:String=String(txtIn.text);
tasks.addItemAt(new Task("", "", ""), e.rowIndex);
// Destroy item editor
commPlanDetGrid.destroyItemEditor();
// Stop default behavior
e.preventDefault();Venktesan,
You are trying compare String and int..! which is not possible try to case the txtIn.text to int using parseInt(txtIn.text).
ORIGINAL:
if(txtIn.text != ADD_TASK).---->error : Comparison between a value with static type String and a possibly unrelated type int
tasks.addItemAt(new Task(txtIn.text, 0, ""), e.rowIndex);----> error:Implicit coercion of a value of type String to an unrelated type int.
EDITED:
if(parseInt(txtIn.text) != ADD_TASK).---->error : Comparison between a value with static type String and a possibly unrelated type int
tasks.addItemAt(new Task(parseInt(txtIn.text), 0, ""), e.rowIndex);----> error:Implicit coercion of a value of type String to an unrelated type int.
Thanks
Pradeep
Maybe you are looking for
-
Page numbers display as 5 of 1 and 2 of 2121 in a PDF that was created from a Word 2003 document
We merge several Word 2003 documents into 1 larger document that we then convert to PDF. The page numbers in the Word document display properly - 1 of 21, 2 of 21, 3 of 21, etc. We then convert that merged document to PDF by right-clicking the file
-
ByteArrayInputStream as source for zip file entry corrupts the ByteArray
Hi All, I have managed to create and add a (in-memory) zip file as an email attachment. I add a file to the zip file , then push data to this file via a ByteArrayInputStream. Adding the file (created via ByteArrayInputStream) to an email works perfec
-
BacNet Protocol Support ==================== My application uses Real-Time devices. Hence I prefer to use BacNet protocol for monitoring via Remote. But I don't have any idea about Java's support about Bacnet. Let me know if we have any support in Ja
-
Optimizing After Effects Performance/ Rendering Speed for large projects
Problem: My after effects is extremely slow and i want to use an external harddrive to increase the speed temporarily until i can afford to change the internal hard drive. i also have other video production software like Cinema 4D, Final Cut Pro, Pr
-
JTree scrollPathToVisible with large model
Hi all, I use method scrollPathToVisible but the tree do not expand and scroll to the path if the model is large ( > 20000 node of custom TreeModel). I also tried makeVisible but it didnt work neither. Any one ever had this problem and how to fix it