I have a magazine and the issues are loaded on a javascript file. I want to add phaser games to this jaascript file. I tried putting phaser.js & gamet.js in my default.cs and if I do that they I can't see the pages. enclosed are parts of the default.js and also the javascript where the pages games etc go to open the issue.
default.aspx.cs:
here is a sample of the javascript file that opens up the pages and games etc.Code:private void LoadJavaScript() { String javaScript = ""; javaScript += LoadFile("~/Issues/JavaScript/Movime.js"); javaScript += LoadFile("~/Issues/JavaScript/DivClass.js"); javaScript += LoadFile("~/Issues/JavaScript/TalkingBalloon.js"); javaScript += LoadFile("~/Issues/JavaScript/Magazine.js"); javaScript += LoadFile("~/Issues/JavaScript/PuzzleClass.js"); javaScript += LoadFile("~/Issues/JavaScript/MemoryClass.js"); javaScript += LoadFile("~/Issues/JavaScript/MoveObjectsTo.js"); javaScript += LoadFile("~/Issues/" + this.IssueName() + "/JavaScript.js"); javaScript += LoadFile("~/Issues/JavaScript/phaser.js"); javaScript += LoadFile("~/Issues/JavaScript/gamet.js"); ( here is where I tried putting in phaser.js and gamet.js ) Page.ClientScript.RegisterStartupScript(this.GetType(), "", javaScript, true); } public String LoadCss() { return "<style type=\"text/css\"> " + LoadFile("~/Issues/" + this.IssueName() + "/CssStyles.css") + " </style>"; } private String IssueName() { return "Issue" + ((this.issue < 100) ? "0" : "") + ((this.issue < 10) ? "0" : "") + this.issue.ToString().Trim() + this.section; } private String LoadFile(String fileName) { //Open a file for reading fileName = Server.MapPath(fileName); //Get a StreamReader class that can be used to read the file StreamReader objStreamReader = File.OpenText(fileName); //Now, read the entire file into a string String fileContent = objStreamReader.ReadToEnd(); objStreamReader.Close(); return fileContent; } /* protected void Page_Render(object sender, EventArgs e) { try { //LinkButton lb = (LinkButton)FormViewItem.Row.FindControl("LinkButtonProcessUpload"); //LinkButton lb = (LinkButton)RepeaterInfo.Items[0].FindControl("LinkButtonProcessUpload"); //HiddenField hf = (HiddenField)FormViewItem.Row.FindControl("FlashArguments"); //HiddenField hf = (HiddenField)RepeaterInfo.Items[0].FindControl("FlashArguments"); String javaScript = "function UploadComplete() {"; javaScript += String.Format("__doPostBack('{0}', '' );", "var a=0;"); javaScript += "};"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "FileCompleteUpload", javaScript, true); } catch { } }
Code:////////////////////////////////////////////////////////////////////////////////////////////////// // Issue Settings ////////////////////////////////////////////////////////////////////////////////////////////////// var issueNumber = 6; var issuePageCount = 32; var issuePageWidth = 578; var issuePageHeight = 680; var issueNextPage = 1; // =============================================================================================== // Issue Name // =============================================================================================== Issue_IssueName = function() { return "Issue" + ((issueNumber < 100) ? "0" : "") + ((issueNumber < 10) ? "0" : "") + issueNumber.toString(); }; // =============================================================================================== // Page 31 - Mad cow lotto their is a lotto game under javascript file listed on default // =============================================================================================== var madcowlottoContainer = null; var madcowlottoGame = null;I hope that someone can help me.Code:// =============================================================================================== //this is the phaser gamet that I set up// =============================================================================================== var turtlegametContainer = null; var turtleGame = null; // =============================================================================================== // Page 24 - Falling Strawberries using movime javascipt listed in the default file // =============================================================================================== var strawberryCount = 23; var movimeStrawberry = null; var strawberry = new Array(); var strawberryTimer = null; var currentStrawberry = 0; function BmStartStrawberry() { if(currentStrawberry >= 23) return; var y1 = Math.floor(Math.random() * 170 + 40) * (-1); var y2 = Math.floor(Math.random() * 20 + 350); var x1 = Math.floor(Math.random() * 490 + 10); strawberry[currentStrawberry].style.top = y1 + "px"; strawberry[currentStrawberry].style.left = x1 + "px"; movimeStrawberry.Insert(strawberry[currentStrawberry], 0, y2 - y1, movimeStrawberry.MovimeLike.StraitLine, 3500, false, false); movimeStrawberry.Start(); currentStrawberry++; strawberryTimer = setTimeout("BmStartStrawberry()", Math.floor(Math.random() * 1000 + 1000)); }; function BmStopStrawberry() { movimeStrawberry.Clear(); clearTimeout(strawberryTimer); strawberryTimer = null; currentStrawberry = 0; for(var sCnt = 0; sCnt < strawberryCount; sCnt++) strawberry[sCnt].style.top = "-40px"; }; / =============================================================================================== // Load // =============================================================================================== function BmOnLoad() { // =============================================================================================== // settings // =============================================================================================== bmPageWidth = issuePageWidth; bmPageHeight = issuePageHeight; bmNextPage = issueNextPage; var pageUriTemplate = Issue_IssueName() + "/Pages/page-"; for(var pg = 1; pg <= issuePageCount; pg++) bmPages[pg] = pageUriTemplate + ((pg < 10) ? "0" : "") + pg.toString() + ".jpg"; BmInitialize(); // =============================================================================================== // Page 31 - Mad cow Lotto // =============================================================================================== MadcowLottoContainer = InsertDinamicDiv(31, "MadcowlottoContainer", "", 25, 615, 524, 417, "", "", "", ""); MadcowLottoGame = new MemoryGame(MadCowLottoContainer, 5, 4, "Issue006/Games/Madcowlotto/piece-", 25, 290, 90, 90); // =============================================================================================== // Page 31 - turtle game // =============================================================================================== TurtleContainer = InsertDinamicDiv(31, "TurtleContainer", "", 25, 615, 524, 417, "", "", "", ""); TurtleGame = new gametGame(turtleContainer, 5, 4, "Issue006/Games/turtle ""); // =============================================================================================== // Page 24 - Falling Strawberries // =============================================================================================== movimeStrawberry = new Movime(10); for(var s = 0; s < strawberryCount; s++) { strawberry[s] = InsertDinamicDiv(24, "", "", 30, -40, 40, 40, "", "", "", ""); strawberry[s].style.backgroundImage = "url(Issue001/Images/Strawberry" + (s % 5 + 1) + ".png)"; } BmAddActionInOut(24, "BmStartStrawberry()", "BmStopStrawberry()"); // =============================================================================================== // Start // =============================================================================================== BmStart(); BmFlipTo(issueNextPage); }
Thanks Jen


Reply With Quote
Bookmarks