problame with updating data automatic from database...please help


hello ,
I made a simple messageing script with php and when i send message somebody he need to refresh his page for biew new message... but i want that will be automatically show to him after i send message, thats mean when i send a message to anybody it will be shown to him without refresh like facebook chatting so i need help, i need that script which will be help me to retrive data from database without refresh ... if u know then please help me

Thank You in advance
Posted On: Thursday 25th of October 2012 11:22:11 PM Total Views:  233
View Complete with Replies

RELATED TOPICS OF JavaScript PROGRAMMING LANGUAGE




multiple forms with the same button class name HOW to post it JQuery and Ajax

Im faced with a problem i have a page where there is a list of name For each name there is a form with select box and hidden input and submit button How i can make the user click select box and submit the content to the server without refreshing SO HE/SHE could go to the 2nd and 3rd and so on Please direct me I tried using different field names for each form but the button need to stay with one name so i could call the script BUT JS does not understand which form to take it keep taken the first form in the list.... \ Im sure the answer is simple but i just cant figure it out its been 2 night trying im on the verge of quitting i know the best way is to use JS Help me out
VIEWS ON THIS POST

252

Posted on:

Thursday 25th October 2012
View Replies!

Unable to change the size of drop pins with Google Maps API

I have 3 digit numbers I#d like to display inside drop pins. The number's don't format well given the default size of the pins. Here's my code: Location of Employees function initialize() { var myOptions = { zoom: 6, center: new google.maps.LatLng(51.427484, -0.988941), mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById("map"), myOptions); var locations = [ ['Aberdean', 57.141989,-2.150268, 6], ['Birmingham', 52.446933, -1.723129, 12], ['Bridgend', 51.496291,-3.56102, 9], ['Bristol', 51.503011,-2.541819, 12] ]; var members = [104, 134, 10, 41]; for (var i = 0; i < locations.length; i++) { var image = new google.maps.MarkerImage("http://chart.apis.google.com/chartchst=d_map_pin_letter&chld=" + members[i] +"|FFFF00", new google.maps.Size(21, 34), new google.maps.Point(0, 0), new google.maps.Point(10, 34)); var location = locations[i]; var myLatLng = new google.maps.LatLng(location[1], location[2]); var marker = new google.maps.Marker({ position: myLatLng, map: map, icon: image, title: location[0], zIndex: location[3] }); } } I've been changing the arguments in this line to no avail: new google.maps.Size(21, 34),
VIEWS ON THIS POST

73

Posted on:

Wednesday 7th November 2012
View Replies!

Help with email validation

Can someone please make the code below check for a simple x@x.x format before validating I've tried for days and can't get it right.
VIEWS ON THIS POST

80

Posted on:

Wednesday 7th November 2012
View Replies!

Pausing a script without killing the browser window opened

Apologies if this is breaking forum rules starting a new thread about a problem I have already listed but the issue is now different to the problem I originally had so hopefully this is acceptable. Simply I want to open a window, let it load and close it 5 seconds later but javascript does not have any pause command that I can find, settimer will queue up the close but then carry on executing the rest of the script before it has closed and any delay I have tried using the various pause examples I can understand have resulted in browser lock ups without the page loading before the window is closed. I even tried a very large for loop with nothing being done in it and that still caused a browser freeze. Is there anyway of inducing a delay that will not freeze the loading of a browser window up
VIEWS ON THIS POST

87

Posted on:

Wednesday 7th November 2012
View Replies!

Problem with Steps in Wizard to separate

What I'm attempting to do is come up with my own wizard of steps to put together an event for posting to my database however somewhere its preventing steps 2-3 from being hidden separately from step 1 and I'm wanting to know why and what I need to do to fix this. My wizard event creation page: http://www.kansasout...vents/bookevent Template: http://kansasoutlaww...ate/wizard.html
VIEWS ON THIS POST

115

Posted on:

Wednesday 7th November 2012
View Replies!

What am I doing wrong with this function?

Guys. Im making a Form of sorts where people can fill in their name and email and such.But now Im having problem with the JS validation code. Ive tweaked some of the code fit my website better so here it is. Theres 3 Text fields and TEXT2: is inactive at the moment but Text1 is where one will insert his Email and upon releasing a key while typing in the box it runs the function that checks the content for EMAIL validation.The third box just reports to me if its indeed a valid email. BUT the thid TextField never changes to say "Valid Email". Why is this function validateForm() { var x= document.getElementById('info').value; var atpos=x.indexOf("@"); var dotpos=x.lastIndexOf("."); if (atpos
VIEWS ON THIS POST

113

Posted on:

Saturday 10th November 2012
View Replies!

Targeting iFrames with the self.location script

Hi! I've been rummaging the net for a solution to this and can't find it so I went to the good ol' DIC. The problem: I need a which can reload a frame after an event triggers so I tried it with frame['chatframe'].location='chat_frame.php' but I don't think it works... is there a one-liner echo ""; code where the effect I need be achieved
VIEWS ON THIS POST

102

Posted on:

Saturday 10th November 2012
View Replies!

2) how can i print this format with use of for loop? * * * * * * *

2) how can i print this format with use of for loop * * * * * * * * * * * * * * * * * * * * * *
VIEWS ON THIS POST

140

Posted on:

Saturday 10th November 2012
View Replies!

Resizing a HTML Website with Javascript

I need to resize an HTML website, and I've been thinking of this bit of Javascript code as a solution. It basically resizes the pages on the browser level, and calls the function on load. Can anyone tell me if I'm heading in the right direction here function resizePage() { if (top.screenX>0 || top.screenY>0) top.moveTo(0,0); if (top.outerWidth < screen.availWidth) top.outerWidth=screen.availWidth; if (top.outerHeight < screen.availHeight) top.outerHeight=screen.availHeight; } else { top.moveTo(-4,-4); top.resizeTo(screen.availWidth+8,screen.availHeight+8); }
VIEWS ON THIS POST

154

Posted on:

Saturday 10th November 2012
View Replies!

Help with Order form

all! I seem to be having trouble getting my homework correct. In this assignment i have to set an order form so that when a user opens the form a date should appear i the date field. When a new quantity is entered in the quantity column the cost should automatically update. Anything other than digits entered should result in an error and the value entered should reset to zero. When a shipping option is selected the total cost should automatically be updated to reflect the shipping price. And the form cannot be submitted unless a shipping option is chosen. I am getting no errors in Firefox w/ firebug on, IE, or Chrome so that is what has me stumped thus far, i am not very experienced with JS so i have no idea where to look next. Here is the HTML GPS-ware Order Form Home Page Product Catalog Order Form Maps Online Contact Us Countries States National Parks Hiking Trails Cities Astronomical Natural GoMap 1.0 Drive Planner 2.0 Hiker 1.0 G-Receiver I G-Receiver II G-Receiver III Downloads Tech Support FAQs Order Form Enter the quantity of each item and press the Tab key ProductPrice QuantityCost GoMap 1.0 Drive Planner 2.0 Hiker 1.0 G-Receiver I G-Receiver II G-Receiver III   Sales Tax (5%) Choose a shipping option Standard (4-6 business days) $4.95 Express (2 days) $8.95 Next Day (1 day) $12.95 TOTAL The Javascript file: /* New Perspectives on Javascript, 2nd Edition Tutorial 5 Review Assignment Author: Will Griffin Date: 2/27/12 Filename: form.js Functions List: todayTxt() Returns the current date in the format mm-dd-yyyy initForm() Sets up and initializes the Web form. productCosts() Returns the total product costs shipExpense() Stores the value of the selected shipping option calcTotal() Calculates the total cost of the order calcShipping() Calculates the total cost of shipping and updates the total cost of the order calcCost() Calculates the cost of each order and updates the total cost validateForm() Validates the form prior to submission resetForm() Resets the Web form and Web page */ window.onload=initForm; function todayTxt() { var Today=new Date(); return Today.getMonth()+1+"-"+Today.getDate()+"-"+Today.getFullYear(); } function initForm() { document.forms[0].date.value = todayTxt(); formObject.element.focus(qty1); formObject.element.blur(qty1); formObject.element.blur(qty2); formObject.element.blur(qty3); formObject.element.blur(qty4); formObject.element.blur(qty5); formObject.element.blur(qty6); document.forms[0].onchange = calcShipping(); } function productCosts() { var pc1 = parseFloat(document.forms[0].cost1); var pc2 = parseFloat(document.forms[0].cost2); var pc3 = parseFloat(document.forms[0].cost3); var pc4 = parseFloat(document.forms[0].cost4); var pc5 = parseFloat(document.forms[0].cost5); var pc6 = parseFloat(document.forms[0].cost6); var sum= pc1+pc2+pc3+pc4+pc5+pc6; return sum; }// end of the productionCosts function function shipExpense() { var sindex = document.forms[0].ship.value = selectedIndex; var shipPrice = parseFloat(sindex); return shipPrice; }//end of the shipExpense function function calcTotal() { var orderCost = productCosts(): var orderTax = orderCost*.05; var orderShip = shipExpense(); var orderTotal = orderCost+orderTax+orderShip; document.form[0].tax.value = orderTax.toFixed(2); document.form[0].total.value = orderTotal.toFixed(2); }//end of the calcTotal function function calcShipping() { document.form[0].shipcost.value = shipExpense(); calctotal(); }//end of the calcShipping function function calcCost() { var iNum = document.getElementById(); var price = document.form[0].elements["price"+iNum].value; var qty = document.form[0].elements["qty"+iNum].value; var cost = document.form[0].elements["cost"+iNum]; reqty = /[0-9]/g; if (reqty.test(qty)) { cost.value = (price*qty).toFixed(2); calcTotal(); }else{ alert("Please enter a digit greater than or equal to 0"); qty=0; document.getElementById("qty"+1).focus(); document.getElementById("qty"+1).focus(); } }//end the caclCost function function validateForm() { if (document.forms[0].shipping.selectedIndex ==0); alert("You must select a shipping option"); { return false;} else {return true;} }//end of the validateForm function function resetForm() { I know i have yet to do the resetForm function, but i thought i would post on here before i went any further. And the CSS: /* New Perspectives on Javascript, 2nd Edition Tutorial 5 Review Assignment Filename: gps.css This file contains styles used in the order.htm file. */ body {background-image: url(border.jpg); background-position:left; background-repeat: repeat-y; margin-top:0; padding-top:0} #links {position: absolute; top: 5px; left: 0px; width: 90px; font-family:Arial, Helvetica, sans-serif; font-size:8pt} #links a {color:black; text-decoration:none; display: block; margin-left: 10px} #links a.newgroup {margin-top: 10px} #links a:hover {color:blue; background-color: white} #main {position: absolute; top: 5px; left: 120px; width: 530px} #logo {border-bottom: 2px solid rgb(222,179,126); margin-bottom: 0px} #main h1 {font-family: Arial, Helvetica, sans-serif; letter-spacing: 7; margin-top: 0px; margin-bottom: 0px} #datep {text-align: right; color: brown; font-size: 8pt; margin: 0px; font-family: Arial, Helvetica, sans-serif} #datep input {text-align: center} table {width: 520px; font-size: 9pt; margin: 5px} th {font-family: Arial, Helvetica, sans-serif; text-align: right; padding: 3px; background-color: rgb(228,197,166); letter-spacing: 3; font-weight: normal} th.label {text-align: left} td {font-size:9pt; font-family: Arial, Helvetica, sans-serif; text-align: right} .label {text-align: left} td.col3 {text-align: right; color: brown} td.col4 {border-bottom: 1px solid rgb(102,102,102)} legend {font-family: Arial, Helvetica, sans-serif; font-size: 8pt; color: brown} input {text-align: right; font-size: 9pt} select {font-size: 9pt} #total {background-color: ivory} #pbuttons {text-align: center; margin-top: 5px} #pbuttons input {margin: 0px 10px; background-color: rgb(228,197,166); letter-spacing: 2; width: 120px; text-align: center} I know i am not very experienced and it may just be something small iam not seeing. I just need to be pointed in the right direction.
VIEWS ON THIS POST

84

Posted on:

Saturday 10th November 2012
View Replies!

How can i trigger the submitHandler without the submit button?

the submit button can trigger the submitHandler,.. i want to submit a form without refreshing so I use this. but it only activates when i use the submit button.. I put onclick="document.ShareIndividually.submit();" in my checkboxes but the page refreshes when submitting a form.. $(document).ready(function(){ $("#ShareIndividually").validate({ debug: false, rules: { name: "required", email: { required: true, email: true } }, messages: { name: "Please let us know who you are.", email: "A valid email will help us get in touch with you.", }, submitHandler: function(form){ // do other stuff for a valid form $.post('ShareIndividually.php', $("#ShareIndividually").serialize(), function(data) { $('#ShareIndividuallyResults').html(data); }); } }); });
VIEWS ON THIS POST

91

Posted on:

Saturday 10th November 2012
View Replies!

generating jscript datagrid with php

hi I am populating a datagrid, I was not able to send a query to the PHP file using javascript but I am now. And now I have got a new issue with returning the query result from the PHP file to my jscript. I basically search the order code, transfer the rows into a DB for the modification. and then populate a jscript datagrid to show the transfered records which I am not able to do so. here is the js code var mySite = ''; function submitFun(f1) { var mySite= document.getElementById('order_IDsearch').value t = './get_order.phps=' + mySite; t = encodeURI (t); f1.action = t; f1.submit(); return true; var results = JSON.parse(data); var tbody = document.getElementById(id).getElementsByTagName("tbody")[0]; var row = document.createElement("tr") var data1 = document.createElement("td") data1.appendChild(document.write(' + results.order_id + ')) var data2 = document.createElement("td") data2.appendChild (document.createTextNode("Admin Desc")) var data3 = document.createElement("td") data3.appendChild (document.createTextNode("Link")) var data4 = document.createElement("td") data4.appendChild(document.createTextNode("Photo")) var data5 = document.createElement("td") data5.appendChild(document.createTextNode("Unitprice#")) var data6 = document.createElement("td") data6.appendChild(document.createTextNode("qty")) var data7 = document.createElement("td") data7.appendChild(document.createTextNode("Express")) var data8 = document.createElement("td") data8.appendChild(document.createTextNode("total")) var data9 = document.createElement("td") data9.appendChild(document.createTextNode("Customer Desc")) var data10 = document.createElement("td") data10.appendChild(document.createTextNode("")) row.appendChild(data1); row.appendChild(data2); row.appendChild(data3); row.appendChild(data4); row.appendChild(data5); row.appendChild(data6); row.appendChild(data7); row.appendChild(data8); row.appendChild(data9); row.appendChild(data10); tbody.appendChild(row); } function deleteRow(tableID) { try { var table = document.getElementById(tableID); var rowCount = table.rows.length; for(var i=0; i
VIEWS ON THIS POST

163

Posted on:

Saturday 10th November 2012
View Replies!

get value from checkbox: HTML with javascript and store in websql

I had a problem on how to get the value from checkbox after checked, because i declare all the input checkbox the same id, so it just will check the first value that when i set all with same id, so how im gonna get other value beside than test1, the code like below, testc is the checkbox id var testc = document.getElementById('testc'); function inserttab(){ db.transaction(function(tx){ tx.executeSql(insert,[firstName.value,lastName.value,phone.value,email.value,selectT.value,testc.value],loadAndReset,onerror); }); } html form code form id="cb"> test1 test2 test3 the attach file is the result i get, i noe if using php i get the answer but i want to use html and javascript base to do it, so please tell me how the code will be to save other value.
VIEWS ON THIS POST

102

Posted on:

Saturday 10th November 2012
View Replies!

Capture the name of an image inside a div without defining exactly?

! I have a simple script that changes the image source of my image when I click it. If I click the image, it works great...I'm trying to figure out how to make it work on the div at the same level, if possible. I'm going to be using this 50-60 times and I always find out answers like this too late after I've hard coded a bunch of ID's or Names to go on so I figured I would ask. Any input is always appreciated. Here's the HTML I'm trying to work with Favorite Quotes Here's the script function ChangeImg(CurImg){ if(CurImg.src == "http://mysite.co/int_images/icons/add.png"){ CurImg.src = "http://mysite.co/int_images/icons/close.png"; }else{ CurImg.src = "http://mysite.co/int_images/icons/add.png"; } } As always,
VIEWS ON THIS POST

110

Posted on:

Saturday 10th November 2012
View Replies!

Unable to create submenus with image menus

I am very new to jquery and am having a problem trying to get my submenu to display. I am not getting an error but when I include the submenu code using the ul tags, the only thing that displays is the image for my first link. If I take out the submenu code then all images display for each link (the main links). Can someone take a look at the code below HTML Lien Management Sub menu 1 Sub menu 2 Sub menu 3 Sub menu 4 Sub menu 5 Sub menu 6 Financial Management Investor Management Property Management JQuery $(document).ready(function () { // find the elements to be eased and hook the hover event $('div.jimgMenu ul li.taxlien a').hover(function() { // if the element is currently being animated if ($(this).is(':animated')) { $(this).stop().animate({width: "260px"}, {duration: 450, easing:"easeOutQuad", complete: "callback"}); } else { // ease in quickly $(this).stop().animate({width: "260px"}, {duration: 400, easing:"easeOutQuad", complete: "callback"}); } }, function () { // on hovering out, ease the element out if ($(this).is(':animated')) { $(this).stop().animate({width: "78px"}, {duration: 400, easing:"easeInOutQuad", complete: "callback"}) } else { // ease out slowly $(this).stop(':animated').animate({width: "78px"}, {duration: 450, easing:"easeInOutQuad", complete: "callback"}); } }, function () { // submenu var $elem = $(this); var $submenu = $elem.find('.submenulien'); if($submenu.length){ var left = '170px'; if($elem.parent().children().length == $elem.index()+1) left = '-170px'; $submenu.show().animate({'left':left},200) } }); }); CSS .jimgMenu { position: relative; width: 670px; height: 200px; overflow: hidden; margin: 25px 0px 0px; } .jimgMenu ul { list-style: none; margin: 0px; display: block; height: 200px; width: 1340px; } .jimgMenu ul li { float: left; } .jimgMenu ul li a { text-indent: -1000px; background:#FFFFFF none repeat scroll 0%; border-right: 2px solid #fff; cursor:pointer; display:block; overflow:hidden; width:78px; height: 200px; } .jimgMenu ul li.taxlien a { background: url("../img/taxlien.jpg") repeat scroll 0%; } .jimgMenu ul li.taxlien a ul.submenulien { display:block; position:absolute; width:170px; overflow:hidden; height:170px; top:85px; left:0px; display:none; background: url("../img/fee2.jpg") repeat scroll 0%; } .jimgMenu ul li.financial a { background: url("../img/fee.jpg") repeat scroll 0%; } .jimgMenu ul li.investor a { background: url("../img/investingmagglass.jpg") repeat scroll 0%; } .jimgMenu ul li.property a { background: url("../img/luxuryhome.jpg") repeat scroll 0%; /* in-width:260px; */ }
VIEWS ON THIS POST

90

Posted on:

Saturday 10th November 2012
View Replies!

why those two functions dont work under one button but work ok withTWO

Hi have these checkout page where have billing address fields and credit card fields there are two different scripts to check both billing address and credit card fields but the functions just dont work when try to call them up with one button if I use two buttons both functions do their job but on one form I want have one button... will appreciate if you help me with these! CHECKOUT .greetext { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;color: #006600;} .blacktext { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;color: #000000;} .checkout {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;} .checkoutinput {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;} .nopcart {background: #464444;border: 1px;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #ffffff;} .nopheader {background: #464444;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #FFFFFF;} .nopentry {background: #FFFFFF;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;} .noptotal {background: #FFFFFF;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;} .nopbutton {background: #FFFFFF;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;} var ccErrorNo = 0; var ccErrors = new Array () ccErrors [0] = "Unknown card type"; ccErrors [1] = "No card number provided"; ccErrors [2] = "Credit card number is in invalid format"; ccErrors [3] = "Credit card number is invalid"; ccErrors [4] = "Credit card number has an inappropriate number of digits"; function allcheck() { if (testCreditCard ()){ if (expiredate()){ alert(" Your order has been placed"); return true } } return false } function testCreditCard () { myCardNo = document.getElementById('CardNumber').value; myCardType = document.getElementById('CardType').value; if (checkCreditCard (myCardNo,myCardType)) { return true } else {alert (ccErrors[ccErrorNo])}; return false } function checkCreditCard (cardnumber, cardname) { // Array to hold the permitted card characteristics var cards = new Array(); // Define the cards we support. You may add addtional card types as follows. // Name: As in the selection box of the form - must be same as user's // Length: List of possible valid lengths of the card number for the card // prefixes: List of possible prefixes for the card // checkdigit: Boolean to say whether there is a check digit cards [0] = {name: "Visa", length: "13,16", prefixes: "4", checkdigit: true}; cards [1] = {name: "MasterCard", length: "16", prefixes: "51,52,53,54,55", checkdigit: true}; cards [2] = {name: "VisaElectron", length: "16", prefixes: "4026,417500,4508,4844,4913,4917", checkdigit: true}; cards [3] = {name: "LaserCard", length: "16,17,18,19", prefixes: "6304,6706,6771,6709", checkdigit: true}; // Establish card type var cardType = -1; for (var i=0; i= 0; i--) { // Extract the next digit and multiply by 1 or 2 on alternative digits. calc = Number(cardNo.charAt(i)) * j; // If the result is in two digits add 1 to the checksum total if (calc > 9) { checksum = checksum + 1; calc = calc - 10; } // Add the units element to the checksum total checksum = checksum + calc; // Switch the value of j if (j ==1) {j = 2} else {j = 1}; } // done - if checksum is divisible by 10, it is a valid modulus 10. // If not, report an error. if (checksum % 10 != 0) { ccErrorNo = 3; return false; } } // Check it's not a spam number if (cardNo == '5490997771092064') { ccErrorNo = 5; return false; } // The following are the card-specific checks we undertake. var LengthValid = false; var PrefixValid = false; var undefined; // We use these for holding the valid lengths and prefixes of a card type var prefix = new Array (); var lengths = new Array (); // Load an array with the valid prefixes for this card prefix = cards[cardType].prefixes.split(","); // Now see if any of them match what we have in the card number for (i=0; i
VIEWS ON THIS POST

144

Posted on:

Saturday 10th November 2012
View Replies!

Need help with formula to add up a series

, I'm trying to use the for loop below to add up a series of numbers, but all I get is the sum of the first number only. How can I accomplish this How can I make the function recursive
VIEWS ON THIS POST

104

Posted on:

Saturday 10th November 2012
View Replies!

giving a message with design when the button is clicked

, I'm really sorry if my problem is so basic, I'm just new in Javascript. Here's my problem.. I have a search form all over my pages and I have a page for the results. What I wanted to do is when I clicked the button, I want message on the page where the results are. the message would would be "Results related for (text that inputted on the search form)" and I also wanted to put an image background for that. Is there any way for that..
VIEWS ON THIS POST

112

Posted on:

Saturday 10th November 2012
View Replies!

What is going wrong with my mouse coordinates?

Now, the code I have now works perfectly fine, as advertised, but I had a bit of a hack with my mouse coordinates. I know it's not a terribly huge deal, but I thought this would definitely be the place to come to pick up some good programming habits, and maybe somebody could point out something that I did incorrectly, or could do differently next time. The program is a simple one that creates an image at the spot where the user clicks. var zombies = 0; function stamp(x,y) { /*This is me offsetting my co-ordinates. The image is 200px x 200px, so I shouldn't have to offset it by that much to fix it.*/ x = x - 370; y = y - 250; var i = new Image(); i.src = 'images/Zombies.gif'; document.getElementById('target').appendChild(i); i.style.position = "absolute"; i.style.left = (x + "px"); i.style.top = (y + "px"); zombies++; if (zombies == 10) { var answer = confirm("Ahh!! That's a lot of Zombies! Flee back to the main menu"); if (answer) location.href = "index.html"; else alert("Good Luck.") } That's my script, and this is all I have in the html: The other problem I have is that it doesn't create the zombies at all in Chrome or IE. I believe it has something to do with the "document.getElementById('target').appendChild(i);" because I've had troubles with that before. Does anyone know if that's the case
VIEWS ON THIS POST

101

Posted on:

Saturday 10th November 2012
View Replies!

AS3 ExternalInterface won't work with SWFObject, works fine withou

So I have googled and searched for hours, and cannot seem to find an actual working solution for myself. I see solutions that have fixed others having similar issues but none of these solutions seem to work for me. I have a flash file (video player) that once the video finishes, calls a javascript function which removes the video and starts a slideshow in place of the video. Everything works perfect when I have the video player embedded directly in the page, but if I instead use swfobject.embedSWF the javascript fails to work any longer. I've added id and name attributes, but nothing seems to work with swfobject. Please let me know if I am missing something, or if this is something with swfobject. TIA My AS3 code import fl.video.*; import flash.external.*; var url:String; var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters; for (var i in paramObj) { url = String(paramObj[i]); } var myVideo:FLVPlayback = new FLVPlayback(); myVideo.source = url; myVideo.scaleMode = VideoScaleMode.MAINTAIN_ASPECT_RATIO; myVideo.width = 485; myVideo.height = 273; myVideo.x = -10; myVideo.addEventListener(VideoEvent.COMPLETE, completeHandler); function completeHandler(e:VideoEvent):void { ExternalInterface.call("convertViewport"); } addChild(myVideo); My javascript (video url comes from a var earlier in the script) var flashvars = { url: '../videos/' + videoUrl }; var params = { quality: 'high', wmode: 'transparent', allowScriptAccess: 'always' }; var attributes = { id: 'main-video', name: 'main-video' }; swfobject.embedSWF("flash/main-video.swf", "flash_container", "457", "273", "9.0.0","expressInstall.swf", flashvars, params, attributes);
VIEWS ON THIS POST

72

Posted on:

Saturday 10th November 2012
View Replies!