macromedia flash flash remoting:
Hello,
This is driving me crazy. I reported this since plain MX and the bug is
present in MX2004 too.
=======================
Bug Description
=======================
Summary:
Flash Asset bug
Flash Movie inside Director will not fetch paged recordsets correctly.
Outside Director will work OK
Steps to Reproduce:
1. Create an MSAccess db with a table named myTable with 2 fields inside:
Field1 and Field2
a) Create a datasource in coldfusion and name it myDataSource pointing to the
mdb file of step 1.
b) Create a component in ColdFusion and name it mycomponent.cfc in your
webroot:
<cfcomponent>
<cffunction name="getRecords" access="remote" RETURNTYPE="numeric">
<cfquery name="theQuery" dbtype="odbc" datasource="myDataSource">
SELECT * from myTable
</cfquery>
<cfset Flash.Pagesize = 10>
<cfreturn theQuery>
</cffunction>
<cffunction name="populatetable" access="remote">
<cfloop index="loopcount" from="1" to="100">
<cfquery datasource="myDataSource">
INSERT INTO myTable(field1,field2) VALUES ('test1','test2')
</cfquery>
</cfloop>
<cfreturn 1>
</cffunction>
</cfcomponent>
2. Create a movie in flash that uses remoting to fetch records from a
database.
a)create a text instance an name it mytext (to output the results)
b)In the first frame insert the next action script:
//------------------------------------------------------------------
#include "NetServices.as"
NetServices.setDefaultGatewayUrl([yourserverIP]/flashservices/gateway);
_root.GC=NetServices.createGatewayConnection();
_root.ServiceCFC = _root.gatewayConnection.getService("mycomponent", this);
_root.ServiceCFC.populatetable();
_root.theRecordset="";
//this object updates the status of received records
_root.theWatch = new Object();
//this function will update text field to display the number of records
received
_root.theWatch.modelChanged = function(info) {
themessage="Event:"+info.eventName+"
"+_root.theRecordset.getNumberAvailable()+ " of " +
_root.theRecordset.getLength() + " records have been downloaded."
trace(themessage);
_root.myText.text=themessage;
};
//rececive the answer to getrecords from server and create watch object
_root.getRecords_Result=function(aRecordSet){
trace("answer received");
_root.theRecordset=aRecordSet;
_root.theRecordset.addView(_root.theWatch);
_root.theRecordset.setDeliveryMode("fetchall");
}
//call recordset
_root.ServiceCFC.getRecords();
_root.myText.text="Starting..";
stop();
//---------------------------------------------------------------------
3. publish the movie as actionscript 1.0 and 2.0
=======================
Expected Results:
the movie runs ok on flash or in IE. you can se how it fetches pages of 10
records each
=======================
Actual Results:
If you import that flash movie to director mx 2004 only the first 10 records
are fetched
Thanks in advance