PDA

View Full Version : Please, check the code - flash to asp, xml to flash


piki
11-08-2006, 01:31 PM
Hi,

I have a system.swf, where are functions. All other swfs are loaded into system.swf. What the functions do? They load swfs, send variables to asp, make some objects visible other invisible, ... OnEnterFrame the first swf in loaded (home.swf into which a swf called scene.swf is loaded). When the user clicks on a button (in a scene.swf), the function PROGRAM is called. It receives variables, sends them to asp and opens the program.swf (it's loaded directly into system.swf). And here's my problem. When I do that, the asp page opens in a new window and the program.swf doesn't receive any data.

Here's the code:

SYSTEM.swf.....

home_mc._visible = false;
main_mc._visible = false;

var mcl:MovieClipLoader = new MovieClipLoader();
var mclL:Object = new Object();
mclL.onLoadProgress = function(target,loaded,total){
loaderA.percent.text = Math.round((loaded/total) * 100) + "%";
}

mclL.onLoadInit = function(){
loaderA._visible = false;
loaderA.percent.text = "";
}

mcl.addListener(mclL);
mcl.loadClip("home.swf", home_mc);

var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);

home = function(){
home_mc._visible = true;
mcLoader.loadClip("home.swf", home_mc);
};

odbori = function(){
home_mc._visible = false;
main_mc._visible = true;
mcLoader.loadClip("odbori.swf", main_mc);
};

program = function(){
movie = this.swf;
id = this.query;
var sendProgram = new LoadVars();
sendProgram.scene = movie;
sendProgram.programID = id;
//sendProgram.send("actions1.asp","POST");
home_mc._visible = false;
main_mc._visible = true;
mcLoader.loadClip("program.swf", main_mc);
trace(id);
trace(movie);
trace(sendProgram);
};

onEnterFrame = function(){
_root.loaderA.spin_mc._rotation+=10;
};


SCENE.swf......

stop();
odbori_btn._visible = true;
struktura_btn._visible = true;
program_btn._visible = true;
statut_btn._visible = true;

odbori_btn.onRelease = this._parent._parent._parent.odbori;
struktura_btn.onRelease = this._parent._parent._parent.struktura;
program_btn.swf = "program";
program_btn.query = "1";
program_btn.onRelease = this._parent._parent._parent.program;
statut_btn.onRelease = this._parent._parent._parent.statut;



PROGRAM.swf.....

var my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(success){
if (success){
var program = my_xml.firstChild;
program_content.text = program.firstChild.nodeValue;
trace(this);
}
}
my_xml.load("actions1.asp"+(_url.indexOf("file")==0?"":"?timestamp="+escape(new Date().toString())));
//my_xml.load("actions1.asp"); - IF I USE THIS OPTION, THE PROGRAM.SWF DOES GET THE DATA, SO I ASSUME THE CODE I WORKING


ACTIONS1.asp....

<!--#INCLUDE virtual="/includes/connect.asp"-->

<%
Dim scene
Dim programID
Dim sqlProgram
Dim rsProgram
dim sql
dim rsxml



scene = Request("scene")

if scene = "program" then
programID = Request("programID")

response.ContentType = "text/xml"
sqlProgram ="SELECT subid, title, content, category FROM subparty WHERE subid = " & programID & ";"
set rsProgram=oConn.Execute(sqlProgram)
response.write("<?xml version=""1.0"" encoding=""utf-8""?>")
response.write("<content>")
response.write("<![CDATA[ """ & rsProgram("content") & """" & " ]]>")
response.write("</content>")

rsProgram.Close
Set rsProgram= Nothing
end if
%>


THX for any help