It's the < inside your for loop - make sure to put your ActionScript into a <![CDATA[]]> block, i.e.
<mx:Script>
<![CDATA[
your code here
]]>
</mx:Script>
Dirk.
-----Ursprüngliche Nachricht-----
Von: [email protected] im Auftrag von pilby1
Gesendet: Fr 16.09.2005 23:49
An: [email protected]
Betreff: [flexcoders] Flex Explorer RemoteObjectDemo.mxml question
I was playing around with the examples that came with Flex, and I'm
encountering something peculiar with RemoteObjectDemo.mxml.
Here is the RemoteObject call:
<mx:RemoteObject id="employeeRO"
source="samples.explorer.EmployeeManager"
showBusyCursor="true" result="empList=event.result" fault="alert
(event.fault.faultstring, 'Error')">
<mx:method name="getList"/>
</mx:RemoteObject>
Notice that the "result" handler simply assigns the return value to a
variable called "empList". Simple enough.
When I try to display "empList.length", it tells me it's an array of
2 elements. Still good.
But when I try to do this:
for (var i=0; i<empList.length; i++) // <----- THIS IS LINE 11
{
}
I get the following errors during compilation:
RemoteObjectDemo.mxml 11 Expected an attribute name[xml]
RemoteObjectDemo.mxml 51 Expected end of
tag 'empList.length'[xml]
RemoteObjectDemo.mxml 52 The input ended before all started
tags were ended. Last tag started was 'mx:Script''[xml]
I am able to do "alert(empList[0].name);" just fine, so the array is
good and I can access all data. But it just doesn't like it when I
use it in a for-loop (!?).
Why is this happening? Does this mean I can't run the array
of objects returned by the RemoteObject call in a loop?
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~->
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
<<winmail.dat>>

