ginola29
asked on
Sending variables from ASP to flash
Database name: Library.mdb
table name: Policy
Fields: BookOverDueCharge, CDOverDueCharge, MagazineOverDueCharge, BookLoanPeriod, CDLoanPeriod, MagazineLoanPeriod, BookRenewalPeriod, MagazineRenewalPeriod
ASpFILE
---------
<%
dim rs, strCon, strSql
set rs = Server.CreateObject("ADODB .Recordset ")
strCon = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Library.md b")
strSql = "Select * from Policy"
rs.open strSql, strCon
dim strPolicy = "&BOC=" & rs("BookOverDueCharge") & "&CDOC=" & rs("CDOverDueCharge") & "&MOC=" & rs("MagazineOverDueCharge" ) & "&BLP=" & rs("BookLoanPeriod") & "&CDLP=" & rs("CDLoanPeriod") & "&MLP=" & rs("MagazineLoanPeriod") & "&BRP=" & rs("BookRenewalPeriod") & "&MRP=" & rs("MagazineRenewalPeriod" )
response.write &strPolicy&
rs.close
set rs = nothing
%>
Flash
------
i have a movieclip called sidemenu, in the sidemenu, theres a movieclip called policy, then the policy consists of some dynamic textfields
i wanted to press the next button, then the variables will be loaded and send to the flash and update my textfields, but now the next button is pressed, but can't go to the 2nd frame and my variables dun load(i tik) pls help to solve the problem
FlashAS
----------
butNext.onRelease = function()
{
butPrev.enabled = true;
butPrev._alpha = 100;
butNext.enabled = false;
butNext._alpha = 50;
policy_data_var.load("poli cy.asp");
};
policy_data_var = new LoadVars();
policy_data_var.path = this;
policy_data_var.onLoad = function(success)
{
if(success)
{
bookLoan.text = this.BLP;
bookRenew.text = this.BRP;
cdLoan.text = this.CDLP;
magazineLoan.text = this.MLP;
magazineRenew.text = this.MRP;
bookCharge.text = this.BOC;
cdCharge.text = this.CDOC;
magazineCharge.text = this.MOC;
gotoAndStop(2);
}
else
{
trace("ASP FILE NOT FOUND")
}
};
stop();
table name: Policy
Fields: BookOverDueCharge, CDOverDueCharge, MagazineOverDueCharge, BookLoanPeriod, CDLoanPeriod, MagazineLoanPeriod, BookRenewalPeriod, MagazineRenewalPeriod
ASpFILE
---------
<%
dim rs, strCon, strSql
set rs = Server.CreateObject("ADODB
strCon = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Library.md
strSql = "Select * from Policy"
rs.open strSql, strCon
dim strPolicy = "&BOC=" & rs("BookOverDueCharge") & "&CDOC=" & rs("CDOverDueCharge") & "&MOC=" & rs("MagazineOverDueCharge"
response.write &strPolicy&
rs.close
set rs = nothing
%>
Flash
------
i have a movieclip called sidemenu, in the sidemenu, theres a movieclip called policy, then the policy consists of some dynamic textfields
i wanted to press the next button, then the variables will be loaded and send to the flash and update my textfields, but now the next button is pressed, but can't go to the 2nd frame and my variables dun load(i tik) pls help to solve the problem
FlashAS
----------
butNext.onRelease = function()
{
butPrev.enabled = true;
butPrev._alpha = 100;
butNext.enabled = false;
butNext._alpha = 50;
policy_data_var.load("poli
};
policy_data_var = new LoadVars();
policy_data_var.path = this;
policy_data_var.onLoad = function(success)
{
if(success)
{
bookLoan.text = this.BLP;
bookRenew.text = this.BRP;
cdLoan.text = this.CDLP;
magazineLoan.text = this.MLP;
magazineRenew.text = this.MRP;
bookCharge.text = this.BOC;
cdCharge.text = this.CDOC;
magazineCharge.text = this.MOC;
gotoAndStop(2);
}
else
{
trace("ASP FILE NOT FOUND")
}
};
stop();
First of all, did the output shows "ASP FILE NOT FOUND"? If not, then change your gotoAndStop(2) to _root.gotoAndStop(2); if you want it to go to frame 2 of main timeline. To see if your variables did load, open up the debugger (press CTRL+Shift+Enter instead of CTRL+Enter), from there u can check if your variables are loaded or not. If it shows that the variables are loaded, then maybe the paths are wrong. Come back and comment after you've tried what I've said :)
You could also try adding some trace statements, and try changing the gotoAndStop(2) to this: this.path.gotoAndStop(2);
if(success)
{
trace("we made it into here");
bookLoan.text = this.BLP;
bookRenew.text = this.BRP;
cdLoan.text = this.CDLP;
magazineLoan.text = this.MLP;
magazineRenew.text = this.MRP;
bookCharge.text = this.BOC;
cdCharge.text = this.CDOC;
magazineCharge.text = this.MOC;
trace("all texts should be set " + this.MOC);
this.path.gotoAndStop(2);
}
if(success)
{
trace("we made it into here");
bookLoan.text = this.BLP;
bookRenew.text = this.BRP;
cdLoan.text = this.CDLP;
magazineLoan.text = this.MLP;
magazineRenew.text = this.MRP;
bookCharge.text = this.BOC;
cdCharge.text = this.CDOC;
magazineCharge.text = this.MOC;
trace("all texts should be set " + this.MOC);
this.path.gotoAndStop(2);
}
ASKER
the thing is cuz i am using using asp communicating with flash so i can retrieve values from database, i have to test them out in my localhost, and when i do so, theres no trace things coming out...and when i click my next button, it doesn't move to the second frame the movieclip
Instead of using trace command add some textboxes (you can delete them later again). And set the value that you want to see to these textboxes.
In this case if the movie does not go to the next frame I would make sure that success if true (set it to some textfield).
The second thing you want to make sure that you are adressing the right movie clip. So I would try printing the following values ot textboxes: this, this.path
BTW, I installed a webserver on my local machine so I can still debug flash. I have never tried it with asp, but I have apache, mysql, and php installed locally, and in that way am able to debug flash as much as I would like to as I can run flash from the editor itself.
In this case if the movie does not go to the next frame I would make sure that success if true (set it to some textfield).
The second thing you want to make sure that you are adressing the right movie clip. So I would try printing the following values ot textboxes: this, this.path
BTW, I installed a webserver on my local machine so I can still debug flash. I have never tried it with asp, but I have apache, mysql, and php installed locally, and in that way am able to debug flash as much as I would like to as I can run flash from the editor itself.
ASKER
u nid me to send u the files to check? cuz i really tried lots of ways, the strange thing is if i juz run the swf on my flash, the button will goto the second frame, but asp can't work, and if i run on the localhost, the buttons fails..
Well, you can post your fla somewhere and I'll have a look at it. I won't be able to do much testing, as I don0t ahve asp installed locally, but I'll have a look at it to see what the problem could be.
This will take me some time as I am quite busy now. I'll get back to you when I have something
why not just download the debugger player?? all u have to do is enable remote debugging when u export ur swf, then u will be able to see the trace things and check for the values. I think that is so much more simpler then to use textboxes. *shrugs*
ASKER
wat i am having now is very critical, all my files are placed in the localhost, when i run my flash using ctrl+enter, flash codes works but asp codes fail...but when i run it by opening InternetExplorer and type the address and run the file, asp codes works, but flash codes fails(meaning data is inserted into database and retrieve or wateva but it won't execute those gotoAndPlay codes)
ASKER
is there a problem if i export as flash player 6, but my comp is using flash player 7 to view?
nope there's no problem if i'm not wrong. i know u gotta run it by IE, so when u installed debugger player (which can be downloaded at macromedia), u are able to debug ur swf while running in IE, provided u have launch ur flash and enable remote debugging. its the same as debugging ur swf by CTRL+shift+enter.
ASKER
but i duno hw to use the debugger..
u mean u never use ctrl+shift+enter before?
ASKER
never
but u know how to use trace right? by enabling remote debugging, u will be able to see the output window too.
hmmm.....or u upload everything online and i'll debug for u? just need to check the debugging box when exporting.
er...that is not wat i meant, can't debug with just the fla right? what i meant is, can u put everything up on the web, the ASP, the exported swf and enable debugging. I'll debug from a url given by u that contains the asp and swf.
ASKER
its psoted up ... btw.. do u know y the this asp page is alwaz open in a new windwos everytime i run this script
<%
dim rs, strCon, strSql
set rs = Server.CreateObject("ADODB .Recordset ")
strCon = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Library.md b")
strSql = "Insert into Membership values ('" & request("userNRIC") & "', '" & request("userName") & "', '" & request("userPwd") & "', '" & request("userGender") & "', '" & request("userAdd") & "', '" & request("userNum") & "', '" & request("userEmail") & "', 10, '', 'Not Active')"
rs.open strSql, strCon
rs.close
set rs = nothing
%>
<%
dim rs, strCon, strSql
set rs = Server.CreateObject("ADODB
strCon = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Library.md
strSql = "Insert into Membership values ('" & request("userNRIC") & "', '" & request("userName") & "', '" & request("userPwd") & "', '" & request("userGender") & "', '" & request("userAdd") & "', '" & request("userNum") & "', '" & request("userEmail") & "', 10, '', 'Not Active')"
rs.open strSql, strCon
rs.close
set rs = nothing
%>
erm...well that is stillnot what i mean....coz i don't have the db etc....i guess it would be easier for u to try what Calron had suggested ;)
ASKER
erm..nvm..i try myself...btw..do u know how to solve the above comment i posted? if u can, i will award u the pts
regarding the ASP page always open in a new window, does this happen while running on browser or does this happen on when running in flash?
ASKER
both, i tik its the asp code tat causes to open it...duno how to solve tat
btw, do u know hw to response write a number value of a field in database?
e.g database name: Library.mdb
table name: Policy
field name: BookOverDueCharge
field value: 1
this is only 1 record
so how do i write this value back to flash using asp?
btw, do u know hw to response write a number value of a field in database?
e.g database name: Library.mdb
table name: Policy
field name: BookOverDueCharge
field value: 1
this is only 1 record
so how do i write this value back to flash using asp?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.